Commit 6109f05e authored by Alexandre Julliard's avatar Alexandre Julliard

progman: Avoid Unicode macros.

parent e12d39dc
MODULE = progman.exe
APPMODE = -mwindows
EXTRADEFS = -DWINE_NO_UNICODE_MACROS
IMPORTS = shell32 comdlg32 user32 gdi32
C_SRCS = \
......
......@@ -36,14 +36,14 @@ static BOOL DIALOG_Browse(HWND hDlg, LPCSTR lpszzFilter,
LPSTR lpstrFile, INT nMaxFile)
{
OPENFILENAME openfilename;
OPENFILENAMEA openfilename;
CHAR szDir[MAX_PATH];
CHAR szDefaultExt[] = "exe";
ZeroMemory(&openfilename, sizeof(openfilename));
GetCurrentDirectory(sizeof(szDir), szDir);
GetCurrentDirectoryA(sizeof(szDir), szDir);
openfilename.lStructSize = sizeof(openfilename);
openfilename.hwndOwner = Globals.hMainWnd;
......@@ -67,7 +67,7 @@ static BOOL DIALOG_Browse(HWND hDlg, LPCSTR lpszzFilter,
openfilename.lpfnHook = 0;
openfilename.lpTemplateName = 0;
return GetOpenFileName(&openfilename);
return GetOpenFileNameA(&openfilename);
}
/***********************************************************************
......@@ -77,9 +77,9 @@ static BOOL DIALOG_Browse(HWND hDlg, LPCSTR lpszzFilter,
static VOID DIALOG_AddFilterItem(LPSTR *p, UINT ids, LPCSTR filter)
{
LoadString(Globals.hInstance, ids, *p, MAX_STRING_LEN);
LoadStringA(Globals.hInstance, ids, *p, MAX_STRING_LEN);
*p += strlen(*p) + 1;
lstrcpy(*p, filter);
lstrcpyA(*p, filter);
*p += strlen(*p) + 1;
**p = '\0';
}
......@@ -163,15 +163,8 @@ static INT_PTR CALLBACK DIALOG_NEW_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, L
*/
INT DIALOG_New(INT nDefault)
{
DLGPROC lpfnDlg = MakeProcInstance(DIALOG_NEW_DlgProc, Globals.hInstance);
INT ret;
New.nDefault = nDefault;
ret = DialogBox(Globals.hInstance, STRING_NEW,
Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg);
return ret;
return DialogBoxW(Globals.hInstance, MAKEINTRESOURCEW(IDD_NEW), Globals.hMainWnd, DIALOG_NEW_DlgProc);
}
......@@ -194,11 +187,10 @@ static INT_PTR CALLBACK DIALOG_COPY_MOVE_DlgProc(HWND hDlg, UINT msg, WPARAM wPa
case WM_INITDIALOG:
/* List all group names */
for (hGroup = GROUP_FirstGroup(); hGroup; hGroup = GROUP_NextGroup(hGroup))
SendDlgItemMessage(hDlg, PM_TO_GROUP, CB_ADDSTRING, 0,
(LPARAM) GROUP_GroupName(hGroup));
SendDlgItemMessageA(hDlg, PM_TO_GROUP, CB_ADDSTRING, 0, (LPARAM)GROUP_GroupName(hGroup));
SetDlgItemText(hDlg, PM_PROGRAM, CopyMove.lpszProgramName);
SetDlgItemText(hDlg, PM_FROM_GROUP, CopyMove.lpszFromGroupName);
SetDlgItemTextA(hDlg, PM_PROGRAM, CopyMove.lpszProgramName);
SetDlgItemTextA(hDlg, PM_FROM_GROUP, CopyMove.lpszFromGroupName);
break;
case WM_COMMAND:
......@@ -207,14 +199,14 @@ static INT_PTR CALLBACK DIALOG_COPY_MOVE_DlgProc(HWND hDlg, UINT msg, WPARAM wPa
case IDOK:
{
/* Get selected group */
INT nCurSel = SendDlgItemMessage(hDlg, PM_TO_GROUP, CB_GETCURSEL, 0, 0);
INT nLen = SendDlgItemMessage(hDlg, PM_TO_GROUP, CB_GETLBTEXTLEN, nCurSel, 0);
INT nCurSel = SendDlgItemMessageW(hDlg, PM_TO_GROUP, CB_GETCURSEL, 0, 0);
INT nLen = SendDlgItemMessageW(hDlg, PM_TO_GROUP, CB_GETLBTEXTLEN, nCurSel, 0);
HLOCAL hBuffer = LocalAlloc(LMEM_FIXED, nLen + 1);
LPSTR buffer = LocalLock(hBuffer);
SendDlgItemMessage(hDlg, PM_TO_GROUP, CB_GETLBTEXT, nCurSel, (LPARAM)buffer);
SendDlgItemMessageA(hDlg, PM_TO_GROUP, CB_GETLBTEXT, nCurSel, (LPARAM)buffer);
for (hGroup = GROUP_FirstGroup(); hGroup; hGroup = GROUP_NextGroup(hGroup))
if (!lstrcmp(buffer, GROUP_GroupName(hGroup))) break;
if (!lstrcmpA(buffer, GROUP_GroupName(hGroup))) break;
LocalFree(hBuffer);
CopyMove.hToGroup = hGroup;
......@@ -237,18 +229,15 @@ static INT_PTR CALLBACK DIALOG_COPY_MOVE_DlgProc(HWND hDlg, UINT msg, WPARAM wPa
HLOCAL DIALOG_CopyMove(LPCSTR lpszProgramName, LPCSTR lpszFromGroupName,
BOOL bMove)
{
DLGPROC lpfnDlg = MakeProcInstance(DIALOG_COPY_MOVE_DlgProc, Globals.hInstance);
INT ret;
CopyMove.lpszProgramName = lpszProgramName;
CopyMove.lpszFromGroupName = lpszFromGroupName;
CopyMove.hToGroup = 0;
ret = DialogBox(Globals.hInstance,
bMove ? STRING_MOVE : STRING_COPY,
Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg);
ret = DialogBoxW(Globals.hInstance,
bMove ? MAKEINTRESOURCEW(IDD_MOVE) : MAKEINTRESOURCEW(IDD_COPY),
Globals.hMainWnd, DIALOG_COPY_MOVE_DlgProc);
return((ret == IDOK) ? CopyMove.hToGroup : 0);
}
......@@ -279,18 +268,16 @@ static INT_PTR CALLBACK DIALOG_GROUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam,
switch (msg)
{
case WM_INITDIALOG:
SetDlgItemText(hDlg, PM_DESCRIPTION, GroupAttributes.lpszTitle);
SetDlgItemText(hDlg, PM_FILE, GroupAttributes.lpszGrpFile);
SetDlgItemTextA(hDlg, PM_DESCRIPTION, GroupAttributes.lpszTitle);
SetDlgItemTextA(hDlg, PM_FILE, GroupAttributes.lpszGrpFile);
break;
case WM_COMMAND:
switch (wParam)
{
case IDOK:
GetDlgItemText(hDlg, PM_DESCRIPTION, GroupAttributes.lpszTitle,
GroupAttributes.nSize);
GetDlgItemText(hDlg, PM_FILE, GroupAttributes.lpszGrpFile,
GroupAttributes.nSize);
GetDlgItemTextA(hDlg, PM_DESCRIPTION, GroupAttributes.lpszTitle, GroupAttributes.nSize);
GetDlgItemTextA(hDlg, PM_FILE, GroupAttributes.lpszGrpFile, GroupAttributes.nSize);
EndDialog(hDlg, IDOK);
return TRUE;
......@@ -308,16 +295,13 @@ static INT_PTR CALLBACK DIALOG_GROUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam,
*/
BOOL DIALOG_GroupAttributes(LPSTR lpszTitle, LPSTR lpszGrpFile, INT nSize)
{
DLGPROC lpfnDlg = MakeProcInstance(DIALOG_GROUP_DlgProc, Globals.hInstance);
INT ret;
GroupAttributes.nSize = nSize;
GroupAttributes.lpszTitle = lpszTitle;
GroupAttributes.lpszGrpFile = lpszGrpFile;
ret = DialogBox(Globals.hInstance, STRING_GROUP,
Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg);
ret = DialogBoxW(Globals.hInstance, MAKEINTRESOURCEW(IDD_GROUP), Globals.hMainWnd, DIALOG_GROUP_DlgProc);
return(ret == IDOK);
}
......@@ -339,11 +323,11 @@ static INT_PTR CALLBACK DIALOG_SYMBOL_DlgProc(HWND hDlg, UINT msg, WPARAM wParam
switch (msg)
{
case WM_INITDIALOG:
SetDlgItemText(hDlg, PM_ICON_FILE, Symbol.lpszIconFile);
SendDlgItemMessage(hDlg, PM_SYMBOL_LIST, CB_SETITEMHEIGHT, 0, (LPARAM) 32);
SendDlgItemMessage(hDlg, PM_SYMBOL_LIST, CB_ADDSTRING, 0, (LPARAM)*Symbol.lphIcon);
SendDlgItemMessage(hDlg, PM_SYMBOL_LIST, CB_ADDSTRING, 0, (LPARAM)Globals.hDefaultIcon);
SendDlgItemMessage(hDlg, PM_SYMBOL_LIST, CB_SETCURSEL, 0, 0);
SetDlgItemTextA(hDlg, PM_ICON_FILE, Symbol.lpszIconFile);
SendDlgItemMessageA(hDlg, PM_SYMBOL_LIST, CB_SETITEMHEIGHT, 0, (LPARAM) 32);
SendDlgItemMessageA(hDlg, PM_SYMBOL_LIST, CB_ADDSTRING, 0, (LPARAM)*Symbol.lphIcon);
SendDlgItemMessageA(hDlg, PM_SYMBOL_LIST, CB_ADDSTRING, 0, (LPARAM)Globals.hDefaultIcon);
SendDlgItemMessageA(hDlg, PM_SYMBOL_LIST, CB_SETCURSEL, 0, 0);
return TRUE;
case WM_MEASUREITEM:
......@@ -369,7 +353,7 @@ static INT_PTR CALLBACK DIALOG_SYMBOL_DlgProc(HWND hDlg, UINT msg, WPARAM wParam
CHAR filename[MAX_PATHNAME_LEN];
filename[0] = 0;
if (DIALOG_BrowseSymbols(hDlg, filename, sizeof(filename)))
SetDlgItemText(hDlg, PM_ICON_FILE, filename);
SetDlgItemTextA(hDlg, PM_ICON_FILE, filename);
return TRUE;
}
......@@ -379,11 +363,11 @@ static INT_PTR CALLBACK DIALOG_SYMBOL_DlgProc(HWND hDlg, UINT msg, WPARAM wParam
case IDOK:
{
INT nCurSel = SendDlgItemMessage(hDlg, PM_SYMBOL_LIST, CB_GETCURSEL, 0, 0);
INT nCurSel = SendDlgItemMessageA(hDlg, PM_SYMBOL_LIST, CB_GETCURSEL, 0, 0);
GetDlgItemText(hDlg, PM_ICON_FILE, Symbol.lpszIconFile, Symbol.nSize);
GetDlgItemTextA(hDlg, PM_ICON_FILE, Symbol.lpszIconFile, Symbol.nSize);
*Symbol.lphIcon = (HICON)SendDlgItemMessage(hDlg, PM_SYMBOL_LIST,
*Symbol.lphIcon = (HICON)SendDlgItemMessageA(hDlg, PM_SYMBOL_LIST,
CB_GETITEMDATA,
(WPARAM) nCurSel, 0);
#if 0
......@@ -409,16 +393,12 @@ static INT_PTR CALLBACK DIALOG_SYMBOL_DlgProc(HWND hDlg, UINT msg, WPARAM wParam
static VOID DIALOG_Symbol(HICON *lphIcon, LPSTR lpszIconFile,
INT *lpnIconIndex, INT nSize)
{
DLGPROC lpfnDlg = MakeProcInstance(DIALOG_SYMBOL_DlgProc, Globals.hInstance);
Symbol.nSize = nSize;
Symbol.lpszIconFile = lpszIconFile;
Symbol.lphIcon = lphIcon;
Symbol.lpnIconIndex = lpnIconIndex;
DialogBox(Globals.hInstance, STRING_SYMBOL,
Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg);
DialogBoxW(Globals.hInstance, MAKEINTRESOURCEW(IDD_SYMBOL), Globals.hMainWnd, DIALOG_SYMBOL_DlgProc);
}
......@@ -443,19 +423,18 @@ static INT_PTR CALLBACK DIALOG_PROGRAM_DlgProc(HWND hDlg, UINT msg, WPARAM wPara
switch (msg)
{
case WM_INITDIALOG:
SetDlgItemText(hDlg, PM_DESCRIPTION, ProgramAttributes.lpszTitle);
SetDlgItemText(hDlg, PM_COMMAND_LINE, ProgramAttributes.lpszCmdLine);
SetDlgItemText(hDlg, PM_DIRECTORY, ProgramAttributes.lpszWorkDir);
SetDlgItemTextA(hDlg, PM_DESCRIPTION, ProgramAttributes.lpszTitle);
SetDlgItemTextA(hDlg, PM_COMMAND_LINE, ProgramAttributes.lpszCmdLine);
SetDlgItemTextA(hDlg, PM_DIRECTORY, ProgramAttributes.lpszWorkDir);
if (!*ProgramAttributes.lpnHotKey)
{
LoadString(Globals.hInstance, IDS_NO_HOT_KEY, buffer, sizeof(buffer));
SetDlgItemText(hDlg, PM_HOT_KEY, buffer);
LoadStringA(Globals.hInstance, IDS_NO_HOT_KEY, buffer, sizeof(buffer));
SetDlgItemTextA(hDlg, PM_HOT_KEY, buffer);
}
CheckDlgButton(hDlg, PM_SYMBOL,
(*ProgramAttributes.lpnCmdShow == SW_SHOWMINIMIZED));
SendDlgItemMessage(hDlg, PM_ICON, STM_SETICON,
(WPARAM) ProgramAttributes.hTmpIcon, 0);
SendDlgItemMessageA(hDlg, PM_ICON, STM_SETICON, (WPARAM)ProgramAttributes.hTmpIcon, 0);
break;
case WM_COMMAND:
......@@ -470,7 +449,7 @@ static INT_PTR CALLBACK DIALOG_PROGRAM_DlgProc(HWND hDlg, UINT msg, WPARAM wPara
CHAR filename[MAX_PATHNAME_LEN];
filename[0] = 0;
if (DIALOG_BrowsePrograms(hDlg, filename, sizeof(filename)))
SetDlgItemText(hDlg, PM_COMMAND_LINE, filename);
SetDlgItemTextA(hDlg, PM_COMMAND_LINE, filename);
return TRUE;
}
......@@ -481,19 +460,18 @@ static INT_PTR CALLBACK DIALOG_PROGRAM_DlgProc(HWND hDlg, UINT msg, WPARAM wPara
&ProgramAttributes.nTmpIconIndex,
MAX_PATHNAME_LEN);
SendDlgItemMessage(hDlg, PM_ICON, STM_SETICON,
(WPARAM) ProgramAttributes.hTmpIcon, 0);
SendDlgItemMessageA(hDlg, PM_ICON, STM_SETICON, (WPARAM)ProgramAttributes.hTmpIcon, 0);
return TRUE;
}
case IDOK:
GetDlgItemText(hDlg, PM_DESCRIPTION,
GetDlgItemTextA(hDlg, PM_DESCRIPTION,
ProgramAttributes.lpszTitle,
ProgramAttributes.nSize);
GetDlgItemText(hDlg, PM_COMMAND_LINE,
GetDlgItemTextA(hDlg, PM_COMMAND_LINE,
ProgramAttributes.lpszCmdLine,
ProgramAttributes.nSize);
GetDlgItemText(hDlg, PM_DIRECTORY,
GetDlgItemTextA(hDlg, PM_DIRECTORY,
ProgramAttributes.lpszWorkDir,
ProgramAttributes.nSize);
......@@ -505,9 +483,9 @@ static INT_PTR CALLBACK DIALOG_PROGRAM_DlgProc(HWND hDlg, UINT msg, WPARAM wPara
#endif
*ProgramAttributes.lphIcon = ProgramAttributes.hTmpIcon;
*ProgramAttributes.lpnIconIndex = ProgramAttributes.nTmpIconIndex;
lstrcpyn(ProgramAttributes.lpszIconFile,
ProgramAttributes.lpszTmpIconFile,
ProgramAttributes.nSize);
lstrcpynA(ProgramAttributes.lpszIconFile,
ProgramAttributes.lpszTmpIconFile,
ProgramAttributes.nSize);
}
*ProgramAttributes.lpnCmdShow =
......@@ -535,7 +513,6 @@ BOOL DIALOG_ProgramAttributes(LPSTR lpszTitle, LPSTR lpszCmdLine,
INT *lpnHotKey, INT *lpnCmdShow, INT nSize)
{
CHAR szTmpIconFile[MAX_PATHNAME_LEN];
DLGPROC lpfnDlg = MakeProcInstance(DIALOG_PROGRAM_DlgProc, Globals.hInstance);
INT ret;
ProgramAttributes.nSize = nSize;
......@@ -555,12 +532,9 @@ BOOL DIALOG_ProgramAttributes(LPSTR lpszTitle, LPSTR lpszCmdLine,
#endif
ProgramAttributes.nTmpIconIndex = *lpnIconIndex;
ProgramAttributes.lpszTmpIconFile = szTmpIconFile;
lstrcpyn(ProgramAttributes.lpszTmpIconFile, lpszIconFile, MAX_PATHNAME_LEN);
ret = DialogBox(Globals.hInstance, STRING_PROGRAM,
Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg);
lstrcpynA(ProgramAttributes.lpszTmpIconFile, lpszIconFile, MAX_PATHNAME_LEN);
ret = DialogBoxW(Globals.hInstance, MAKEINTRESOURCEW(IDD_PROGRAM), Globals.hMainWnd, DIALOG_PROGRAM_DlgProc);
return(ret == IDOK);
}
......@@ -586,7 +560,7 @@ static INT_PTR CALLBACK DIALOG_EXECUTE_DlgProc(HWND hDlg, UINT msg,
CHAR filename[MAX_PATHNAME_LEN];
filename[0] = 0;
if (DIALOG_BrowsePrograms(hDlg, filename, sizeof(filename)))
SetDlgItemText(hDlg, PM_COMMAND, filename);
SetDlgItemTextA(hDlg, PM_COMMAND, filename);
return TRUE;
}
......@@ -597,7 +571,7 @@ static INT_PTR CALLBACK DIALOG_EXECUTE_DlgProc(HWND hDlg, UINT msg,
case IDOK:
{
CHAR cmdline[MAX_PATHNAME_LEN];
GetDlgItemText(hDlg, PM_COMMAND, cmdline, sizeof(cmdline));
GetDlgItemTextA(hDlg, PM_COMMAND, cmdline, sizeof(cmdline));
WinExec(cmdline, IsDlgButtonChecked(hDlg, PM_SYMBOL) ?
SW_SHOWMINIMIZED : SW_SHOWNORMAL);
......@@ -622,11 +596,5 @@ static INT_PTR CALLBACK DIALOG_EXECUTE_DlgProc(HWND hDlg, UINT msg,
VOID DIALOG_Execute(void)
{
DLGPROC lpfnDlg = MakeProcInstance(DIALOG_EXECUTE_DlgProc, Globals.hInstance);
DialogBox(Globals.hInstance, STRING_EXECUTE, Globals.hMainWnd, lpfnDlg);
FreeProcInstance(lpfnDlg);
DialogBoxW(Globals.hInstance, MAKEINTRESOURCEW(IDD_EXECUTE), Globals.hMainWnd, DIALOG_EXECUTE_DlgProc);
}
/* Local Variables: */
/* c-file-style: "GNU" */
/* End: */
......@@ -44,12 +44,12 @@ static LRESULT CALLBACK GROUP_GroupWndProc(HWND hWnd, UINT msg,
case WM_CHILDACTIVATE:
case WM_NCLBUTTONDOWN:
Globals.hActiveGroup = (HLOCAL) GetWindowLongPtr(hWnd, 0);
Globals.hActiveGroup = (HLOCAL)GetWindowLongPtrW(hWnd, 0);
EnableMenuItem(Globals.hFileMenu, PM_MOVE , MF_GRAYED);
EnableMenuItem(Globals.hFileMenu, PM_COPY , MF_GRAYED);
break;
}
return(DefMDIChildProc(hWnd, msg, wParam, lParam));
return DefMDIChildProcW(hWnd, msg, wParam, lParam);
}
/***********************************************************************
......@@ -59,20 +59,20 @@ static LRESULT CALLBACK GROUP_GroupWndProc(HWND hWnd, UINT msg,
ATOM GROUP_RegisterGroupWinClass(void)
{
WNDCLASS class;
WNDCLASSW class;
class.style = CS_HREDRAW | CS_VREDRAW;
class.lpfnWndProc = GROUP_GroupWndProc;
class.cbClsExtra = 0;
class.cbWndExtra = sizeof(LONG_PTR);
class.hInstance = Globals.hInstance;
class.hIcon = LoadIcon (0, IDI_WINLOGO);
class.hCursor = LoadCursor (0, IDC_ARROW);
class.hIcon = LoadIconW (0, (LPWSTR)IDI_WINLOGO);
class.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
class.hbrBackground = GetStockObject (WHITE_BRUSH);
class.lpszMenuName = 0;
class.lpszClassName = STRING_GROUP_WIN_CLASS_NAME;
return RegisterClass(&class);
return RegisterClassW(&class);
}
/***********************************************************************
......@@ -118,12 +118,12 @@ HLOCAL GROUP_AddGroup(LPCSTR lpszName, LPCSTR lpszGrpFile, INT nCmdShow,
BOOL bSuppressShowWindow)
{
PROGGROUP *group, *prior;
MDICREATESTRUCT cs;
MDICREATESTRUCTW cs;
INT seqnum;
HLOCAL hPrior, *p;
HLOCAL hGroup = LocalAlloc(LMEM_FIXED, sizeof(PROGGROUP));
HLOCAL hName = LocalAlloc(LMEM_FIXED, 1 + lstrlen(lpszName));
HLOCAL hGrpFile = LocalAlloc(LMEM_FIXED, 1 + lstrlen(lpszGrpFile));
HLOCAL hName = LocalAlloc(LMEM_FIXED, 1 + strlen(lpszName));
HLOCAL hGrpFile = LocalAlloc(LMEM_FIXED, 1 + strlen(lpszGrpFile));
if (!hGroup || !hName || !hGrpFile)
{
MAIN_MessageBoxIDS(IDS_OUT_OF_MEMORY, IDS_ERROR, MB_OK);
......@@ -132,8 +132,8 @@ HLOCAL GROUP_AddGroup(LPCSTR lpszName, LPCSTR lpszGrpFile, INT nCmdShow,
if (hGrpFile) LocalFree(hGrpFile);
return(0);
}
memcpy(LocalLock(hName), lpszName, 1 + lstrlen(lpszName));
memcpy(LocalLock(hGrpFile), lpszGrpFile, 1 + lstrlen(lpszGrpFile));
memcpy(LocalLock(hName), lpszName, 1 + strlen(lpszName));
memcpy(LocalLock(hGrpFile), lpszGrpFile, 1 + strlen(lpszGrpFile));
Globals.hActiveGroup = hGroup;
......@@ -169,7 +169,7 @@ HLOCAL GROUP_AddGroup(LPCSTR lpszName, LPCSTR lpszGrpFile, INT nCmdShow,
group->hActiveProgram = 0;
cs.szClass = STRING_GROUP_WIN_CLASS_NAME;
cs.szTitle = lpszName;
cs.szTitle = NULL;
cs.hOwner = 0;
cs.x = x;
cs.y = y;
......@@ -178,9 +178,9 @@ HLOCAL GROUP_AddGroup(LPCSTR lpszName, LPCSTR lpszGrpFile, INT nCmdShow,
cs.style = 0;
cs.lParam = 0;
group->hWnd = (HWND)SendMessage(Globals.hMDIWnd, WM_MDICREATE, 0, (LPARAM)&cs);
SetWindowLongPtr(group->hWnd, 0, (LONG_PTR) hGroup);
group->hWnd = (HWND)SendMessageA(Globals.hMDIWnd, WM_MDICREATE, 0, (LPARAM)&cs);
SetWindowTextA( group->hWnd, lpszName );
SetWindowLongPtrW(group->hWnd, 0, (LONG_PTR) hGroup);
#if 1
if (!bSuppressShowWindow) /* FIXME shouldn't be necessary */
......@@ -203,8 +203,8 @@ VOID GROUP_ModifyGroup(HLOCAL hGroup)
PROGGROUP *group = LocalLock(hGroup);
CHAR szName[MAX_PATHNAME_LEN];
CHAR szFile[MAX_PATHNAME_LEN];
lstrcpyn(szName, LocalLock(group->hName), MAX_PATHNAME_LEN);
lstrcpyn(szFile, LocalLock(group->hGrpFile), MAX_PATHNAME_LEN);
lstrcpynA(szName, LocalLock(group->hName), MAX_PATHNAME_LEN);
lstrcpynA(szFile, LocalLock(group->hGrpFile), MAX_PATHNAME_LEN);
if (!DIALOG_GroupAttributes(szName, szFile, MAX_PATHNAME_LEN)) return;
......@@ -220,7 +220,7 @@ VOID GROUP_ModifyGroup(HLOCAL hGroup)
/* FIXME Update progman.ini */
SetWindowText(group->hWnd, szName);
SetWindowTextA(group->hWnd, szName);
}
/***********************************************************************
......@@ -259,7 +259,7 @@ VOID GROUP_DeleteGroup(HLOCAL hGroup)
/* FIXME Update progman.ini */
SendMessage(Globals.hMDIWnd, WM_MDIDESTROY, (WPARAM)group->hWnd, 0);
SendMessageW(Globals.hMDIWnd, WM_MDIDESTROY, (WPARAM)group->hWnd, 0);
LocalFree(group->hName);
LocalFree(group->hGrpFile);
......@@ -324,7 +324,3 @@ LPCSTR GROUP_GroupName(HLOCAL hGroup)
group = LocalLock(hGroup);
return(LocalLock(group->hName));
}
/* Local Variables: */
/* c-file-style: "GNU" */
/* End: */
......@@ -50,10 +50,10 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, PROGGROUP *group);
static VOID GRPFILE_ModifyFileName(LPSTR lpszNewName, LPCSTR lpszOrigName,
INT nSize, BOOL bModify)
{
lstrcpyn(lpszNewName, lpszOrigName, nSize);
lstrcpynA(lpszNewName, lpszOrigName, nSize);
lpszNewName[nSize-1] = '\0';
if (!bModify) return;
if (!lstrcmpi(lpszNewName + strlen(lpszNewName) - 4, ".grp"))
if (!lstrcmpiA(lpszNewName + strlen(lpszNewName) - 4, ".grp"))
lpszNewName[strlen(lpszNewName) - 1] = '\0';
}
......@@ -382,12 +382,12 @@ BOOL GRPFILE_WriteGroupFile(HLOCAL hGroup)
{
/* Warn about the (possible) incompatibility */
CHAR msg[MAX_PATHNAME_LEN + 200];
wsprintf(msg,
wsprintfA(msg,
"Group files written by this DRAFT Program Manager "
"possibly cannot be read by the Microsoft Program Manager!!\n"
"Are you sure to write %s?", szPath);
if (IDOK != MessageBox(Globals.hMainWnd, msg, "WARNING",
MB_OKCANCEL | MB_DEFBUTTON2)) return FALSE;
if (IDOK != MessageBoxA(Globals.hMainWnd, msg, "WARNING",
MB_OKCANCEL | MB_DEFBUTTON2)) return FALSE;
}
/* Open file */
......@@ -425,9 +425,9 @@ static VOID GRPFILE_CalculateSizes(PROGRAM *program, INT *Progs, INT *Icons,
DeleteObject( info.hbmColor );
*Progs += 24;
*Progs += lstrlen(LocalLock(program->hName)) + 1;
*Progs += lstrlen(LocalLock(program->hCmdLine)) + 1;
*Progs += lstrlen(LocalLock(program->hIconFile)) + 1;
*Progs += strlen(LocalLock(program->hName)) + 1;
*Progs += strlen(LocalLock(program->hCmdLine)) + 1;
*Progs += strlen(LocalLock(program->hIconFile)) + 1;
*Icons += 12; /* IconInfo */
*Icons += *sizeAnd;
......@@ -540,7 +540,7 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, PROGGROUP *group)
hProgram = program->hNext;
}
Title = 34 + NumProg * 2;
Progs = Title + lstrlen(lpszTitle) + 1;
Progs = Title + strlen(lpszTitle) + 1;
Icons += Progs;
Extension += Icons;
......@@ -589,8 +589,7 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, PROGGROUP *group)
}
/* Title */
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, lpszTitle,
lstrlen(lpszTitle) + 1))
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, lpszTitle, strlen(lpszTitle) + 1))
return FALSE;
/* Program entries */
......@@ -618,15 +617,15 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, PROGGROUP *group)
PUT_SHORT(buffer, 16, CurrIcon + 12);
ptr = CurrProg + 24;
PUT_SHORT(buffer, 18, ptr);
ptr += lstrlen(Name) + 1;
ptr += strlen(Name) + 1;
PUT_SHORT(buffer, 20, ptr);
ptr += lstrlen(CmdLine) + 1;
ptr += strlen(CmdLine) + 1;
PUT_SHORT(buffer, 22, ptr);
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 24) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, Name, lstrlen(Name) + 1) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, CmdLine, lstrlen(CmdLine) + 1) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, IconFile, lstrlen(IconFile) + 1))
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, Name, strlen(Name) + 1) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, CmdLine, strlen(CmdLine) + 1) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, IconFile, strlen(IconFile) + 1))
return FALSE;
CurrProg = next_prog;
......@@ -685,9 +684,9 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, PROGGROUP *group)
{
PUT_SHORT(buffer, 0, 0x8101);
PUT_SHORT(buffer, 2, seqnum);
PUT_SHORT(buffer, 4, 7 + lstrlen(lpszWorkDir));
PUT_SHORT(buffer, 4, 7 + strlen(lpszWorkDir));
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 6) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, lpszWorkDir, lstrlen(lpszWorkDir) + 1))
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, lpszWorkDir, strlen(lpszWorkDir) + 1))
return FALSE;
}
......@@ -729,7 +728,3 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, PROGGROUP *group)
return TRUE;
}
/* Local Variables: */
/* c-file-style: "GNU" */
/* End: */
......@@ -56,19 +56,19 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
/* Read Options from `progman.ini' */
Globals.bAutoArrange =
GetPrivateProfileInt("Settings", "AutoArrange", 0, Globals.lpszIniFile);
GetPrivateProfileIntA("Settings", "AutoArrange", 0, Globals.lpszIniFile);
Globals.bMinOnRun =
GetPrivateProfileInt("Settings", "MinOnRun", 0, Globals.lpszIniFile);
GetPrivateProfileIntA("Settings", "MinOnRun", 0, Globals.lpszIniFile);
Globals.bSaveSettings =
GetPrivateProfileInt("Settings", "SaveSettings", 0, Globals.lpszIniFile);
GetPrivateProfileIntA("Settings", "SaveSettings", 0, Globals.lpszIniFile);
/* Load default icons */
Globals.hMainIcon = ExtractIcon(Globals.hInstance, Globals.lpszIcoFile, 0);
Globals.hGroupIcon = ExtractIcon(Globals.hInstance, Globals.lpszIcoFile, 0);
Globals.hDefaultIcon = ExtractIcon(Globals.hInstance, Globals.lpszIcoFile, 0);
if (!Globals.hMainIcon) Globals.hMainIcon = LoadIcon(0, MAKEINTRESOURCE(DEFAULTICON));
if (!Globals.hGroupIcon) Globals.hGroupIcon = LoadIcon(0, MAKEINTRESOURCE(DEFAULTICON));
if (!Globals.hDefaultIcon) Globals.hDefaultIcon = LoadIcon(0, MAKEINTRESOURCE(DEFAULTICON));
Globals.hMainIcon = ExtractIconA(Globals.hInstance, Globals.lpszIcoFile, 0);
Globals.hGroupIcon = ExtractIconA(Globals.hInstance, Globals.lpszIcoFile, 0);
Globals.hDefaultIcon = ExtractIconA(Globals.hInstance, Globals.lpszIcoFile, 0);
if (!Globals.hMainIcon) Globals.hMainIcon = LoadIconW(0, (LPWSTR)DEFAULTICON);
if (!Globals.hGroupIcon) Globals.hGroupIcon = LoadIconW(0, (LPWSTR)DEFAULTICON);
if (!Globals.hDefaultIcon) Globals.hDefaultIcon = LoadIconW(0, (LPWSTR)DEFAULTICON);
/* Register classes */
if (!prev)
......@@ -80,7 +80,7 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
/* Create main window */
MAIN_CreateMainWindow();
Globals.hAccel = LoadAccelerators(Globals.hInstance, STRING_ACCEL);
Globals.hAccel = LoadAcceleratorsW(Globals.hInstance, MAKEINTRESOURCEW(IDA_ACCEL));
/* Setup menu, stringtable and resourcenames */
STRING_LoadMenus();
......@@ -94,11 +94,11 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
MAIN_AutoStart();
/* Message loop */
while (GetMessage (&msg, 0, 0, 0))
if (!TranslateAccelerator(Globals.hMainWnd, Globals.hAccel, &msg))
while (GetMessageW (&msg, 0, 0, 0))
if (!TranslateAcceleratorW(Globals.hMainWnd, Globals.hAccel, &msg))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
DispatchMessageW (&msg);
}
return 0;
}
......@@ -115,7 +115,7 @@ static VOID MAIN_CreateGroups(void)
CHAR key[20], *ptr;
/* Initialize groups according the `Order' entry of `progman.ini' */
GetPrivateProfileString("Settings", "Order", "", buffer, sizeof(buffer), Globals.lpszIniFile);
GetPrivateProfileStringA("Settings", "Order", "", buffer, sizeof(buffer), Globals.lpszIniFile);
ptr = buffer;
while (ptr < buffer + sizeof(buffer))
{
......@@ -126,7 +126,7 @@ static VOID MAIN_CreateGroups(void)
if (ret != 1) break;
sprintf(key, "Group%d", num);
GetPrivateProfileString("Groups", key, "", szPath,
GetPrivateProfileStringA("Groups", key, "", szPath,
sizeof(szPath), Globals.lpszIniFile);
if (!szPath[0]) continue;
......@@ -147,11 +147,11 @@ VOID MAIN_AutoStart(void)
CHAR buffer[BUFFER_SIZE];
HLOCAL hGroup, hProgram;
GetPrivateProfileString("Settings", "AutoStart", "Autostart", buffer,
GetPrivateProfileStringA("Settings", "AutoStart", "Autostart", buffer,
sizeof(buffer), Globals.lpszIniFile);
for (hGroup = GROUP_FirstGroup(); hGroup; hGroup = GROUP_NextGroup(hGroup))
if (!lstrcmp(buffer, GROUP_GroupName(hGroup)))
if (!lstrcmpA(buffer, GROUP_GroupName(hGroup)))
for (hProgram = PROGRAM_FirstProgram(hGroup); hProgram;
hProgram = PROGRAM_NextProgram(hProgram))
PROGRAM_ExecuteProgram(hProgram);
......@@ -165,9 +165,6 @@ VOID MAIN_AutoStart(void)
static LRESULT CALLBACK MAIN_MainWndProc(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam)
{
#if 0
printf("M %4.4x %4.4x\n", msg, wParam);
#endif
switch (msg)
{
case WM_INITMENU:
......@@ -189,7 +186,7 @@ static LRESULT CALLBACK MAIN_MainWndProc(HWND hWnd, UINT msg,
PostQuitMessage (0);
break;
}
return(DefFrameProc(hWnd, Globals.hMDIWnd, msg, wParam, lParam));
return DefFrameProcW(hWnd, Globals.hMDIWnd, msg, wParam, lParam);
}
/***********************************************************************
......@@ -267,10 +264,10 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
CheckMenuItem(Globals.hOptionMenu, PM_AUTO_ARRANGE,
MF_BYCOMMAND | (Globals.bAutoArrange ?
MF_CHECKED : MF_UNCHECKED));
WritePrivateProfileString("Settings", "AutoArrange",
WritePrivateProfileStringA("Settings", "AutoArrange",
Globals.bAutoArrange ? "1" : "0",
Globals.lpszIniFile);
WritePrivateProfileString(NULL,NULL,NULL,Globals.lpszIniFile); /* flush it */
WritePrivateProfileStringA(NULL,NULL,NULL,Globals.lpszIniFile); /* flush it */
break;
case PM_MIN_ON_RUN:
......@@ -278,10 +275,10 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
CheckMenuItem(Globals.hOptionMenu, PM_MIN_ON_RUN,
MF_BYCOMMAND | (Globals.bMinOnRun ?
MF_CHECKED : MF_UNCHECKED));
WritePrivateProfileString("Settings", "MinOnRun",
WritePrivateProfileStringA("Settings", "MinOnRun",
Globals.bMinOnRun ? "1" : "0",
Globals.lpszIniFile);
WritePrivateProfileString(NULL,NULL,NULL,Globals.lpszIniFile); /* flush it */
WritePrivateProfileStringA(NULL,NULL,NULL,Globals.lpszIniFile); /* flush it */
break;
case PM_SAVE_SETTINGS:
......@@ -289,10 +286,10 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
CheckMenuItem(Globals.hOptionMenu, PM_SAVE_SETTINGS,
MF_BYCOMMAND | (Globals.bSaveSettings ?
MF_CHECKED : MF_UNCHECKED));
WritePrivateProfileString("Settings", "SaveSettings",
WritePrivateProfileStringA("Settings", "SaveSettings",
Globals.bSaveSettings ? "1" : "0",
Globals.lpszIniFile);
WritePrivateProfileString(NULL,NULL,NULL,Globals.lpszIniFile); /* flush it */
WritePrivateProfileStringA(NULL,NULL,NULL,Globals.lpszIniFile); /* flush it */
break;
/* Menu Windows */
......@@ -309,17 +306,17 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
if (hActiveGroupWnd && !IsIconic(hActiveGroupWnd))
ArrangeIconicWindows(hActiveGroupWnd);
else
SendMessage(Globals.hMDIWnd, WM_MDIICONARRANGE, 0, 0);
SendMessageW(Globals.hMDIWnd, WM_MDIICONARRANGE, 0, 0);
break;
/* Menu Help */
case PM_CONTENTS:
if (!WinHelp(Globals.hMainWnd, "progman.hlp", HELP_CONTENTS, 0))
if (!WinHelpA(Globals.hMainWnd, "progman.hlp", HELP_CONTENTS, 0))
MAIN_MessageBoxIDS(IDS_WINHELP_ERROR, IDS_ERROR, MB_OK);
break;
case PM_ABOUT_WINE:
ShellAbout(hWnd, "WINE", "Program Manager", 0);
ShellAboutA(hWnd, "WINE", "Program Manager", 0);
break;
default:
......@@ -335,7 +332,7 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
static ATOM MAIN_RegisterMainWinClass(void)
{
WNDCLASS class;
WNDCLASSW class;
class.style = CS_HREDRAW | CS_VREDRAW;
class.lpfnWndProc = MAIN_MainWndProc;
......@@ -343,12 +340,12 @@ static ATOM MAIN_RegisterMainWinClass(void)
class.cbWndExtra = 0;
class.hInstance = Globals.hInstance;
class.hIcon = Globals.hMainIcon;
class.hCursor = LoadCursor (0, IDC_ARROW);
class.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
class.hbrBackground = GetStockObject (NULL_BRUSH);
class.lpszMenuName = 0;
class.lpszClassName = STRING_MAIN_WIN_CLASS_NAME;
return RegisterClass(&class);
return RegisterClassW(&class);
}
/***********************************************************************
......@@ -365,8 +362,7 @@ static VOID MAIN_CreateMainWindow(void)
Globals.hMainMenu = 0;
/* Get the geometry of the main window */
GetPrivateProfileString("Settings", "Window", "",
buffer, sizeof(buffer), Globals.lpszIniFile);
GetPrivateProfileStringA("Settings", "Window", "", buffer, sizeof(buffer), Globals.lpszIniFile);
if (5 == sscanf(buffer, "%d %d %d %d %d", &left, &top, &right, &bottom, &show))
{
width = right - left;
......@@ -380,7 +376,7 @@ static VOID MAIN_CreateMainWindow(void)
/* Create main Window */
Globals.hMainWnd =
CreateWindow (STRING_MAIN_WIN_CLASS_NAME, "",
CreateWindowW(STRING_MAIN_WIN_CLASS_NAME, NULL,
WS_OVERLAPPEDWINDOW, left, top, width, height,
0, 0, Globals.hInstance, 0);
......@@ -406,7 +402,7 @@ static VOID MAIN_CreateMDIWindow(void)
/* Create MDI Window */
Globals.hMDIWnd =
CreateWindow (STRING_MDI_WIN_CLASS_NAME, "",
CreateWindowW(STRING_MDI_WIN_CLASS_NAME, NULL,
WS_CHILD, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top,
Globals.hMainWnd, 0,
......@@ -426,10 +422,10 @@ INT MAIN_MessageBoxIDS(UINT ids_text, UINT ids_title, WORD type)
CHAR text[MAX_STRING_LEN];
CHAR title[MAX_STRING_LEN];
LoadString(Globals.hInstance, ids_text, text, sizeof(text));
LoadString(Globals.hInstance, ids_title, title, sizeof(title));
LoadStringA(Globals.hInstance, ids_text, text, sizeof(text));
LoadStringA(Globals.hInstance, ids_title, title, sizeof(title));
return(MessageBox(Globals.hMainWnd, text, title, type));
return(MessageBoxA(Globals.hMainWnd, text, title, type));
}
/***********************************************************************
......@@ -442,11 +438,11 @@ INT MAIN_MessageBoxIDS_s(UINT ids_text, LPCSTR str, UINT ids_title, WORD type)
CHAR title[MAX_STRING_LEN];
CHAR newtext[MAX_STRING_LEN + MAX_PATHNAME_LEN];
LoadString(Globals.hInstance, ids_text, text, sizeof(text));
LoadString(Globals.hInstance, ids_title, title, sizeof(title));
wsprintf(newtext, text, str);
LoadStringA(Globals.hInstance, ids_text, text, sizeof(text));
LoadStringA(Globals.hInstance, ids_title, title, sizeof(title));
wsprintfA(newtext, text, str);
return(MessageBox(Globals.hMainWnd, newtext, title, type));
return(MessageBoxA(Globals.hMainWnd, newtext, title, type));
}
/***********************************************************************
......@@ -460,13 +456,9 @@ VOID MAIN_ReplaceString(HLOCAL *handle, LPSTR replace)
if (newhandle)
{
LPSTR newstring = LocalLock(newhandle);
lstrcpy(newstring, replace);
strcpy(newstring, replace);
LocalFree(*handle);
*handle = newhandle;
}
else MAIN_MessageBoxIDS(IDS_OUT_OF_MEMORY, IDS_ERROR, MB_OK);
}
/* Local Variables: */
/* c-file-style: "GNU" */
/* End: */
......@@ -190,23 +190,24 @@ VOID DIALOG_Execute(void);
VOID STRING_LoadMenus(VOID);
/* Class names */
extern CHAR STRING_MAIN_WIN_CLASS_NAME[];
extern CHAR STRING_MDI_WIN_CLASS_NAME[];
extern CHAR STRING_GROUP_WIN_CLASS_NAME[];
extern CHAR STRING_PROGRAM_WIN_CLASS_NAME[];
extern WCHAR STRING_MAIN_WIN_CLASS_NAME[];
extern WCHAR STRING_MDI_WIN_CLASS_NAME[];
extern WCHAR STRING_GROUP_WIN_CLASS_NAME[];
extern WCHAR STRING_PROGRAM_WIN_CLASS_NAME[];
/* Resource names */
extern CHAR STRING_ACCEL[];
extern CHAR STRING_MAIN[];
extern CHAR STRING_NEW[];
extern CHAR STRING_OPEN[];
extern CHAR STRING_MOVE[];
extern CHAR STRING_COPY[];
extern CHAR STRING_DELETE[];
extern CHAR STRING_GROUP[];
extern CHAR STRING_PROGRAM[];
extern CHAR STRING_SYMBOL[];
extern CHAR STRING_EXECUTE[];
#define IDD_MAIN 1
#define IDD_NEW 2
#define IDD_OPEN 3
#define IDD_MOVE 4
#define IDD_COPY 5
#define IDD_DELETE 6
#define IDD_GROUP 7
#define IDD_PROGRAM 8
#define IDD_SYMBOL 9
#define IDD_EXECUTE 10
#define IDA_ACCEL 1
/* Stringtable index */
#define IDS_PROGRAM_MANAGER 0x02
......
......@@ -83,7 +83,7 @@ IDS_SYMBOL_FILES, "Icon files"
IDS_SYMBOLS_ICO, "Icons (*.ico)"
}
ACCEL ACCELERATORS
IDA_ACCEL ACCELERATORS
{
VK_F1, PM_CONTENTS, VIRTKEY
VK_RETURN, PM_ATTRIBUTES, VIRTKEY, ALT
......@@ -91,7 +91,7 @@ VK_RETURN, PM_ATTRIBUTES, VIRTKEY, ALT
/* Dialog `New' */
DIALOG_NEW DIALOG 0, 0, 170, 65
IDD_NEW DIALOG 0, 0, 170, 65
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "New"
......@@ -107,7 +107,7 @@ PUSHBUTTON "&Help", PM_HELP, 105, 45, 60, 15, WS_TABSTOP
/* Dialog `Move' */
DIALOG_MOVE DIALOG 0, 0, 250, 65
IDD_MOVE DIALOG 0, 0, 250, 65
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Move Program"
......@@ -125,7 +125,7 @@ PUSHBUTTON "&Help", PM_HELP, 185, 45, 60, 15, WS_TABSTO
/* Dialog `Copy' */
DIALOG_COPY DIALOG 0, 0, 250, 65
IDD_COPY DIALOG 0, 0, 250, 65
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Copy Program"
......@@ -143,7 +143,7 @@ PUSHBUTTON "&Help", PM_HELP, 185, 45, 60, 15, WS_TABSTO
/* Dialog `Group attributes' */
DIALOG_GROUP DIALOG 0, 0, 250, 65
IDD_GROUP DIALOG 0, 0, 250, 65
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Program Group Attributes"
......@@ -159,7 +159,7 @@ PUSHBUTTON "&Help", PM_HELP, 185, 45, 60, 15, WS_TABSTO
/* Dialog `Program attributes' */
DIALOG_PROGRAM DIALOG 0, 0, 275, 105
IDD_PROGRAM DIALOG 0, 0, 275, 105
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Program Attributes"
......@@ -183,7 +183,7 @@ PUSHBUTTON "&Help", PM_HELP, 200, 85, 70, 15, WS
/* Dialog `Symbol' */
DIALOG_SYMBOL DIALOG 0, 0, 240, 85
IDD_SYMBOL DIALOG 0, 0, 240, 85
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Change Icon"
......@@ -201,7 +201,7 @@ PUSHBUTTON "&Help", PM_HELP, 175, 65, 60, 15, WS_TABSTOP
/* Dialog `Execute' */
DIALOG_EXECUTE DIALOG 0, 0, 200, 85
IDD_EXECUTE DIALOG 0, 0, 200, 85
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Execute Program"
......
......@@ -35,7 +35,7 @@ static LRESULT CALLBACK PROGRAM_ProgramWndProc(HWND hWnd, UINT msg, WPARAM wPara
{
case WM_NCLBUTTONDOWN:
{
HLOCAL hProgram = (HLOCAL) GetWindowLongPtr(hWnd, 0);
HLOCAL hProgram = (HLOCAL) GetWindowLongPtrW(hWnd, 0);
PROGRAM *program = LocalLock(hProgram);
PROGGROUP *group = LocalLock(program->hGroup);
group->hActiveProgram = hProgram;
......@@ -45,7 +45,7 @@ static LRESULT CALLBACK PROGRAM_ProgramWndProc(HWND hWnd, UINT msg, WPARAM wPara
}
case WM_NCLBUTTONDBLCLK:
{
PROGRAM_ExecuteProgram((HLOCAL) GetWindowLongPtr(hWnd, 0));
PROGRAM_ExecuteProgram((HLOCAL) GetWindowLongPtrW(hWnd, 0));
return(0);
}
......@@ -56,14 +56,14 @@ static LRESULT CALLBACK PROGRAM_ProgramWndProc(HWND hWnd, UINT msg, WPARAM wPara
PAINTSTRUCT ps;
HDC hdc;
hdc = BeginPaint(hWnd,&ps);
program = LocalLock((HLOCAL) GetWindowLongPtr(hWnd, 0));
program = LocalLock((HLOCAL) GetWindowLongPtrW(hWnd, 0));
if (program->hIcon)
DrawIcon(hdc, 0, 0, program->hIcon);
EndPaint(hWnd,&ps);
break;
}
}
return(DefWindowProc(hWnd, msg, wParam, lParam));
return DefWindowProcW(hWnd, msg, wParam, lParam);
}
/***********************************************************************
......@@ -73,7 +73,7 @@ static LRESULT CALLBACK PROGRAM_ProgramWndProc(HWND hWnd, UINT msg, WPARAM wPara
ATOM PROGRAM_RegisterProgramWinClass(void)
{
WNDCLASS class;
WNDCLASSW class;
class.style = CS_HREDRAW | CS_VREDRAW;
class.lpfnWndProc = PROGRAM_ProgramWndProc;
......@@ -81,12 +81,12 @@ ATOM PROGRAM_RegisterProgramWinClass(void)
class.cbWndExtra = sizeof(LONG_PTR);
class.hInstance = Globals.hInstance;
class.hIcon = 0;
class.hCursor = LoadCursor (0, IDC_ARROW);
class.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
class.hbrBackground = GetStockObject (WHITE_BRUSH);
class.lpszMenuName = 0;
class.lpszClassName = STRING_PROGRAM_WIN_CLASS_NAME;
return RegisterClass(&class);
return RegisterClassW(&class);
}
/***********************************************************************
......@@ -110,7 +110,7 @@ VOID PROGRAM_NewProgram(HLOCAL hGroup)
&nCmdShow, MAX_PATHNAME_LEN))
return;
if (!hIcon) hIcon = LoadIcon(0, IDI_WINLOGO);
if (!hIcon) hIcon = LoadIconW(0, (LPWSTR)IDI_WINLOGO);
if (!PROGRAM_AddProgram(hGroup, hIcon, szName, 0, 0, szCmdLine, szIconFile,
......@@ -133,10 +133,10 @@ VOID PROGRAM_ModifyProgram(HLOCAL hProgram)
CHAR szIconFile[MAX_PATHNAME_LEN];
CHAR szWorkDir[MAX_PATHNAME_LEN];
lstrcpyn(szName, LocalLock(program->hName), MAX_PATHNAME_LEN);
lstrcpyn(szCmdLine, LocalLock(program->hCmdLine), MAX_PATHNAME_LEN);
lstrcpyn(szIconFile, LocalLock(program->hIconFile), MAX_PATHNAME_LEN);
lstrcpyn(szWorkDir, LocalLock(program->hWorkDir), MAX_PATHNAME_LEN);
lstrcpynA(szName, LocalLock(program->hName), MAX_PATHNAME_LEN);
lstrcpynA(szCmdLine, LocalLock(program->hCmdLine), MAX_PATHNAME_LEN);
lstrcpynA(szIconFile, LocalLock(program->hIconFile), MAX_PATHNAME_LEN);
lstrcpynA(szWorkDir, LocalLock(program->hWorkDir), MAX_PATHNAME_LEN);
if (!DIALOG_ProgramAttributes(szName, szCmdLine, szWorkDir, szIconFile,
&program->hIcon, &program->nIconIndex,
......@@ -149,7 +149,7 @@ VOID PROGRAM_ModifyProgram(HLOCAL hProgram)
MAIN_ReplaceString(&program->hIconFile, szIconFile);
MAIN_ReplaceString(&program->hWorkDir, szWorkDir);
SetWindowText(program->hWnd, szName);
SetWindowTextA(program->hWnd, szName);
UpdateWindow(program->hWnd);
GRPFILE_WriteGroupFile(program->hGroup);
......@@ -171,10 +171,10 @@ HLOCAL PROGRAM_AddProgram(HLOCAL hGroup, HICON hIcon, LPCSTR lpszName,
PROGRAM *program;
HLOCAL hPrior, *p;
HLOCAL hProgram = LocalAlloc(LMEM_FIXED, sizeof(PROGRAM));
HLOCAL hName = LocalAlloc(LMEM_FIXED, 1 + lstrlen(lpszName));
HLOCAL hCmdLine = LocalAlloc(LMEM_FIXED, 1 + lstrlen(lpszCmdLine));
HLOCAL hIconFile = LocalAlloc(LMEM_FIXED, 1 + lstrlen(lpszIconFile));
HLOCAL hWorkDir = LocalAlloc(LMEM_FIXED, 1 + lstrlen(lpszWorkDir));
HLOCAL hName = LocalAlloc(LMEM_FIXED, 1 + strlen(lpszName));
HLOCAL hCmdLine = LocalAlloc(LMEM_FIXED, 1 + strlen(lpszCmdLine));
HLOCAL hIconFile = LocalAlloc(LMEM_FIXED, 1 + strlen(lpszIconFile));
HLOCAL hWorkDir = LocalAlloc(LMEM_FIXED, 1 + strlen(lpszWorkDir));
if (!hProgram || !hName || !hCmdLine || !hIconFile || !hWorkDir)
{
MAIN_MessageBoxIDS(IDS_OUT_OF_MEMORY, IDS_ERROR, MB_OK);
......@@ -185,10 +185,10 @@ HLOCAL PROGRAM_AddProgram(HLOCAL hGroup, HICON hIcon, LPCSTR lpszName,
if (hWorkDir) LocalFree(hWorkDir);
return(0);
}
memcpy(LocalLock(hName), lpszName, 1 + lstrlen(lpszName));
memcpy(LocalLock(hCmdLine), lpszCmdLine, 1 + lstrlen(lpszCmdLine));
memcpy(LocalLock(hIconFile), lpszIconFile, 1 + lstrlen(lpszIconFile));
memcpy(LocalLock(hWorkDir), lpszWorkDir, 1 + lstrlen(lpszWorkDir));
memcpy(LocalLock(hName), lpszName, 1 + strlen(lpszName));
memcpy(LocalLock(hCmdLine), lpszCmdLine, 1 + strlen(lpszCmdLine));
memcpy(LocalLock(hIconFile), lpszIconFile, 1 + strlen(lpszIconFile));
memcpy(LocalLock(hWorkDir), lpszWorkDir, 1 + strlen(lpszWorkDir));
group->hActiveProgram = hProgram;
......@@ -215,12 +215,13 @@ HLOCAL PROGRAM_AddProgram(HLOCAL hGroup, HICON hIcon, LPCSTR lpszName,
program->nHotKey = nHotKey;
program->hWnd =
CreateWindow (STRING_PROGRAM_WIN_CLASS_NAME, lpszName,
CreateWindowW(STRING_PROGRAM_WIN_CLASS_NAME, NULL,
WS_CHILD | WS_CAPTION,
x, y, CW_USEDEFAULT, CW_USEDEFAULT,
group->hWnd, 0, Globals.hInstance, 0);
SetWindowLongPtr(program->hWnd, 0, (LONG_PTR) hProgram);
SetWindowTextA(program->hWnd, lpszName);
SetWindowLongPtrW(program->hWnd, 0, (LONG_PTR) hProgram);
ShowWindow (program->hWnd, SW_SHOWMINIMIZED);
SetWindowPos (program->hWnd, 0, x, y, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
......@@ -367,7 +368,3 @@ LPCSTR PROGRAM_ProgramName(HLOCAL hProgram)
program = LocalLock(hProgram);
return(LocalLock(program->hName));
}
/* Local Variables: */
/* c-file-style: "GNU" */
/* End: */
......@@ -26,24 +26,10 @@
/* Class names */
CHAR STRING_MAIN_WIN_CLASS_NAME[] = "PMMain";
CHAR STRING_MDI_WIN_CLASS_NAME[] = "MDICLIENT";
CHAR STRING_GROUP_WIN_CLASS_NAME[] = "PMGroup";
CHAR STRING_PROGRAM_WIN_CLASS_NAME[] = "PMProgram";
/* Resource names */
CHAR STRING_ACCEL[] = "ACCEL";
CHAR STRING_MENU[] = "MENU";
CHAR STRING_NEW[] = "DIALOG_NEW";
CHAR STRING_OPEN[] = "DIALOG_OPEN";
CHAR STRING_MOVE[] = "DIALOG_MOVE";
CHAR STRING_COPY[] = "DIALOG_COPY";
CHAR STRING_DELETE[] = "DIALOG_DELETE";
CHAR STRING_GROUP[] = "DIALOG_GROUP";
CHAR STRING_PROGRAM[] = "DIALOG_PROGRAM";
CHAR STRING_SYMBOL[] = "DIALOG_SYMBOL";
CHAR STRING_EXECUTE[] = "DIALOG_EXECUTE";
WCHAR STRING_MAIN_WIN_CLASS_NAME[] = {'P','M','M','a','i','n',0};
WCHAR STRING_MDI_WIN_CLASS_NAME[] = {'M','D','I','C','L','I','E','N','T',0};
WCHAR STRING_GROUP_WIN_CLASS_NAME[] = {'P','M','G','r','o','u','p',0};
WCHAR STRING_PROGRAM_WIN_CLASS_NAME[] = {'P','M','P','r','o','g','r','a','m',0};
VOID STRING_LoadMenus(VOID)
{
......@@ -51,18 +37,18 @@ VOID STRING_LoadMenus(VOID)
HMENU hMainMenu;
/* Set frame caption */
LoadString(Globals.hInstance, IDS_PROGRAM_MANAGER, caption, sizeof(caption));
SetWindowText(Globals.hMainWnd, caption);
LoadStringA(Globals.hInstance, IDS_PROGRAM_MANAGER, caption, sizeof(caption));
SetWindowTextA(Globals.hMainWnd, caption);
/* Create menu */
hMainMenu = LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU));
hMainMenu = LoadMenuW(Globals.hInstance, MAKEINTRESOURCEW(MAIN_MENU));
Globals.hFileMenu = GetSubMenu(hMainMenu, 0);
Globals.hOptionMenu = GetSubMenu(hMainMenu, 1);
Globals.hWindowsMenu = GetSubMenu(hMainMenu, 2);
Globals.hLanguageMenu = GetSubMenu(hMainMenu, 3);
if (Globals.hMDIWnd)
SendMessage(Globals.hMDIWnd, WM_MDISETMENU,
SendMessageW(Globals.hMDIWnd, WM_MDISETMENU,
(WPARAM) hMainMenu,
(LPARAM) Globals.hWindowsMenu);
else SetMenu(Globals.hMainWnd, hMainMenu);
......@@ -71,7 +57,3 @@ VOID STRING_LoadMenus(VOID)
if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
Globals.hMainMenu = hMainMenu;
}
/* Local Variables: */
/* c-file-style: "GNU" */
/* End: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment