A few cosmetic changes plus fixes for problems spotted by Dmitry
Timoshkov.
This commit is contained in:
parent
b0ef56c2b7
commit
83ad886aad
|
@ -34,7 +34,7 @@ static LRESULT WINAPI DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wPara
|
|||
|
||||
|
||||
|
||||
void ShowLastError()
|
||||
VOID ShowLastError()
|
||||
{
|
||||
DWORD error = GetLastError();
|
||||
if (error != NO_ERROR)
|
||||
|
@ -505,10 +505,7 @@ VOID DIALOG_FilePrinterSetup(VOID)
|
|||
|
||||
VOID DIALOG_FileExit(VOID)
|
||||
{
|
||||
if (DoCloseFile())
|
||||
{
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
PostMessage(Globals.hMainWnd, WM_CLOSE, 0, 0l);
|
||||
}
|
||||
|
||||
VOID DIALOG_EditUndo(VOID)
|
||||
|
|
|
@ -50,6 +50,7 @@ VOID DIALOG_PageSetup(VOID);
|
|||
VOID DIALOG_TimeDate(VOID);
|
||||
|
||||
/* utility functions */
|
||||
VOID ShowLastError();
|
||||
BOOL FileExists(LPSTR szFilename);
|
||||
BOOL DoCloseFile(void);
|
||||
void DoOpenFile(LPSTR szFileName);
|
||||
|
|
|
@ -117,8 +117,8 @@ LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
{
|
||||
RECT rc;
|
||||
GetClientRect(hWnd, &rc);
|
||||
LoadLibrary("RichEd32.dll");
|
||||
|
||||
if (LoadLibrary("RichEd32.dll"))
|
||||
{
|
||||
Globals.hEdit =
|
||||
CreateWindow("RICHEDIT", "",
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL |
|
||||
|
@ -127,6 +127,10 @@ LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
NULL, Globals.hInstance, NULL);
|
||||
NOTEPAD_InitData();
|
||||
DIALOG_FileNew();
|
||||
} else {
|
||||
ShowLastError();
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -140,9 +144,8 @@ LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
|
||||
case WM_CLOSE:
|
||||
if (DoCloseFile()) {
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
DestroyWindow(hWnd);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
|
@ -150,13 +153,9 @@ LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
{
|
||||
RECT rc;
|
||||
GetClientRect(hWnd, &rc);
|
||||
SetWindowPos(Globals.hEdit, NULL, 0, 0, rc.right, rc.bottom,
|
||||
SetWindowPos(Globals.hEdit, NULL, 0, 0, LOWORD(lParam), HIWORD(lParam),
|
||||
SWP_NOOWNERZORDER | SWP_NOZORDER);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DROPFILES:
|
||||
{
|
||||
|
@ -295,6 +294,11 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
|
|||
CreateWindow(className, winName, WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
|
||||
NULL, NULL, Globals.hInstance, NULL);
|
||||
if (!Globals.hMainWnd)
|
||||
{
|
||||
ShowLastError();
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
ShowWindow(Globals.hMainWnd, show);
|
||||
UpdateWindow(Globals.hMainWnd);
|
||||
|
|
Loading…
Reference in New Issue