A few cosmetic changes plus fixes for problems spotted by Dmitry

Timoshkov.
This commit is contained in:
Andriy Palamarchuk 2002-07-16 01:09:24 +00:00 committed by Alexandre Julliard
parent b0ef56c2b7
commit 83ad886aad
3 changed files with 24 additions and 22 deletions

View File

@ -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)

View File

@ -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);

View File

@ -117,16 +117,20 @@ LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
{
RECT rc;
GetClientRect(hWnd, &rc);
LoadLibrary("RichEd32.dll");
Globals.hEdit =
CreateWindow("RICHEDIT", "",
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL |
ES_AUTOVSCROLL | ES_MULTILINE,
0, 0, rc.right, rc.bottom, hWnd,
NULL, Globals.hInstance, NULL);
NOTEPAD_InitData();
DIALOG_FileNew();
if (LoadLibrary("RichEd32.dll"))
{
Globals.hEdit =
CreateWindow("RICHEDIT", "",
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL |
ES_AUTOVSCROLL | ES_MULTILINE,
0, 0, rc.right, rc.bottom, hWnd,
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);
}
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);