progman: Fix two simple bugs.
Use correctly the GetOpenFileName function. Use _lcreat instead of _lopen to create a new file.
This commit is contained in:
parent
11e4b21a30
commit
d6cb3e8b98
|
@ -328,6 +328,7 @@ static BOOL CALLBACK DIALOG_PROGRAM_DlgProc(HWND hDlg, UINT msg, WPARAM wParam,
|
||||||
case PM_BROWSE:
|
case PM_BROWSE:
|
||||||
{
|
{
|
||||||
CHAR filename[MAX_PATHNAME_LEN];
|
CHAR filename[MAX_PATHNAME_LEN];
|
||||||
|
filename[0] = 0;
|
||||||
if (DIALOG_BrowsePrograms(hDlg, filename, sizeof(filename)))
|
if (DIALOG_BrowsePrograms(hDlg, filename, sizeof(filename)))
|
||||||
SetDlgItemText(hDlg, PM_COMMAND_LINE, filename);
|
SetDlgItemText(hDlg, PM_COMMAND_LINE, filename);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -450,6 +451,7 @@ static BOOL CALLBACK DIALOG_SYMBOL_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, L
|
||||||
case PM_BROWSE:
|
case PM_BROWSE:
|
||||||
{
|
{
|
||||||
CHAR filename[MAX_PATHNAME_LEN];
|
CHAR filename[MAX_PATHNAME_LEN];
|
||||||
|
filename[0] = 0;
|
||||||
if (DIALOG_BrowseSymbols(hDlg, filename, sizeof(filename)))
|
if (DIALOG_BrowseSymbols(hDlg, filename, sizeof(filename)))
|
||||||
SetDlgItemText(hDlg, PM_ICON_FILE, filename);
|
SetDlgItemText(hDlg, PM_ICON_FILE, filename);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -518,6 +520,7 @@ static BOOL CALLBACK DIALOG_EXECUTE_DlgProc(HWND hDlg, UINT msg,
|
||||||
case PM_BROWSE:
|
case PM_BROWSE:
|
||||||
{
|
{
|
||||||
CHAR filename[MAX_PATHNAME_LEN];
|
CHAR filename[MAX_PATHNAME_LEN];
|
||||||
|
filename[0] = 0;
|
||||||
if (DIALOG_BrowsePrograms(hDlg, filename, sizeof(filename)))
|
if (DIALOG_BrowsePrograms(hDlg, filename, sizeof(filename)))
|
||||||
SetDlgItemText(hDlg, PM_COMMAND, filename);
|
SetDlgItemText(hDlg, PM_COMMAND, filename);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -559,21 +562,19 @@ static BOOL DIALOG_Browse(HWND hDlg, LPCSTR lpszzFilter,
|
||||||
{
|
{
|
||||||
OPENFILENAME openfilename;
|
OPENFILENAME openfilename;
|
||||||
|
|
||||||
CHAR szPath[MAX_PATH];
|
|
||||||
CHAR szDir[MAX_PATH];
|
CHAR szDir[MAX_PATH];
|
||||||
CHAR szDefaultExt[] = "exe";
|
CHAR szDefaultExt[] = "exe";
|
||||||
|
|
||||||
ZeroMemory(&openfilename, sizeof(openfilename));
|
ZeroMemory(&openfilename, sizeof(openfilename));
|
||||||
|
|
||||||
GetCurrentDirectory(sizeof(szDir), szDir);
|
GetCurrentDirectory(sizeof(szDir), szDir);
|
||||||
lstrcpy(szPath,"*.exe");
|
|
||||||
|
|
||||||
/* FIXME is this correct ? */
|
|
||||||
openfilename.lStructSize = sizeof(openfilename);
|
openfilename.lStructSize = sizeof(openfilename);
|
||||||
openfilename.hwndOwner = Globals.hMainWnd;
|
openfilename.hwndOwner = Globals.hMainWnd;
|
||||||
openfilename.hInstance = Globals.hInstance;
|
openfilename.hInstance = Globals.hInstance;
|
||||||
openfilename.lpstrFile = szPath;
|
openfilename.lpstrFilter = lpszzFilter;
|
||||||
openfilename.nMaxFile = sizeof(szPath);
|
openfilename.lpstrFile = lpstrFile;
|
||||||
|
openfilename.nMaxFile = nMaxFile;
|
||||||
openfilename.lpstrInitialDir = szDir;
|
openfilename.lpstrInitialDir = szDir;
|
||||||
openfilename.Flags = 0;
|
openfilename.Flags = 0;
|
||||||
openfilename.lpstrDefExt = szDefaultExt;
|
openfilename.lpstrDefExt = szDefaultExt;
|
||||||
|
@ -591,7 +592,6 @@ static BOOL DIALOG_Browse(HWND hDlg, LPCSTR lpszzFilter,
|
||||||
openfilename.lpTemplateName = 0;
|
openfilename.lpTemplateName = 0;
|
||||||
|
|
||||||
return GetOpenFileName(&openfilename);
|
return GetOpenFileName(&openfilename);
|
||||||
/* FIXME */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
|
@ -399,16 +399,8 @@ BOOL GRPFILE_WriteGroupFile(HLOCAL hGroup)
|
||||||
MB_OKCANCEL | MB_DEFBUTTON2)) return FALSE;
|
MB_OKCANCEL | MB_DEFBUTTON2)) return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME */
|
|
||||||
if (OpenFile(szPath, &dummy, OF_EXIST) == HFILE_ERROR)
|
|
||||||
{
|
|
||||||
CHAR msg[MAX_PATHNAME_LEN + 200];
|
|
||||||
wsprintf(msg, "Cause of a bug you must now touch the file %s\n", szPath);
|
|
||||||
MessageBox(Globals.hMainWnd, msg, "", MB_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Open file */
|
/* Open file */
|
||||||
file = _lopen(szPath, OF_WRITE);
|
file = _lcreat(szPath, 0);
|
||||||
if (file != HFILE_ERROR)
|
if (file != HFILE_ERROR)
|
||||||
{
|
{
|
||||||
ret = GRPFILE_DoWriteGroupFile(file, group);
|
ret = GRPFILE_DoWriteGroupFile(file, group);
|
||||||
|
|
Loading…
Reference in New Issue