From 75764eecb4128d735ed93da044d3b61bbb12f9cf Mon Sep 17 00:00:00 2001 From: VincentWei Date: Sun, 21 Jan 2018 17:19:18 +0800 Subject: [PATCH] tune code to reflect the new prototypes --- examples/buttondown.c | 2 +- examples/createwindow.c | 2 +- examples/dialogbox.c | 2 +- examples/helloworld.c | 2 +- examples/keydown.c | 2 +- examples/listenfd.c | 2 +- examples/msg_initdialog.c | 2 +- examples/rectvisible.c | 2 +- examples/registerwindowclass.c | 3 +-- examples/setcursor.c | 12 ++++++------ examples/settimer.c | 2 +- examples/socket.c | 2 +- examples/subclass.c | 4 ++-- examples/ws_ex_notdraggable.c | 2 +- 14 files changed, 20 insertions(+), 21 deletions(-) diff --git a/examples/buttondown.c b/examples/buttondown.c index 7d4f6f37..2a9c17e3 100644 --- a/examples/buttondown.c +++ b/examples/buttondown.c @@ -3,7 +3,7 @@ * This example trys to handle the event when the user presses * left button and right button of the mouse at the same time. */ -int MyWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT MyWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_LBUTTONDOWN: diff --git a/examples/createwindow.c b/examples/createwindow.c index fd76e4ed..b6b8914d 100644 --- a/examples/createwindow.c +++ b/examples/createwindow.c @@ -9,7 +9,7 @@ #define IDC_EDIT1 130 #define IDC_EDIT2 140 -int ControlTestWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT ControlTestWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HWND hStaticWnd1, hStaticWnd2, hButton1, hButton2, hEdit1, hEdit2; switch (message) { diff --git a/examples/dialogbox.c b/examples/dialogbox.c index e7795402..b9430ecb 100644 --- a/examples/dialogbox.c +++ b/examples/dialogbox.c @@ -2,7 +2,7 @@ * The following code defines the dialog box callback procedure * and displays the dialog box by calling DialogBoxIndirectParam function. */ -static int InitDialogBoxProc (HWND hDlg, int message, WPARAM wParam, LPARAM lParam) +static LRESULT InitDialogBoxProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_INITDIALOG: diff --git a/examples/helloworld.c b/examples/helloworld.c index fe515e81..68268cc7 100644 --- a/examples/helloworld.c +++ b/examples/helloworld.c @@ -11,7 +11,7 @@ #include #include -static int HelloWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT HelloWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; diff --git a/examples/keydown.c b/examples/keydown.c index b9f8b986..fd3ea722 100644 --- a/examples/keydown.c +++ b/examples/keydown.c @@ -3,7 +3,7 @@ * This example trys to handle the event when the user * presses key as the key is down. */ -int MyWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT MyWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_KEYDOWN: diff --git a/examples/listenfd.c b/examples/listenfd.c index 2967d968..8059721d 100644 --- a/examples/listenfd.c +++ b/examples/listenfd.c @@ -14,7 +14,7 @@ ... /* The window procedure. */ -static int VCOnGUIMainWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT VCOnGUIMainWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PCONINFO pConInfo; diff --git a/examples/msg_initdialog.c b/examples/msg_initdialog.c index bdb170cb..ddb586e6 100644 --- a/examples/msg_initdialog.c +++ b/examples/msg_initdialog.c @@ -1,4 +1,4 @@ -static int DepInfoBoxProc (HWND hDlg, int message, WPARAM wParam, LPARAM lParam) +static LRESULT DepInfoBoxProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { struct _DepInfo *info; diff --git a/examples/rectvisible.c b/examples/rectvisible.c index ca30e20e..8bb0c17d 100644 --- a/examples/rectvisible.c +++ b/examples/rectvisible.c @@ -1,7 +1,7 @@ /* * Use RectVisible to optimize the repaint of the window. */ -MSG_PAINT: +case MSG_PAINT: { HDC hdc = BeginPaint (hWnd); diff --git a/examples/registerwindowclass.c b/examples/registerwindowclass.c index 0bb5e66c..c40ced0c 100644 --- a/examples/registerwindowclass.c +++ b/examples/registerwindowclass.c @@ -3,8 +3,7 @@ #define MSG_SET_STEP_INFO (MSG_USER + 1) #define MSG_SET_CURR_STEP (MSG_USER + 2) -static int StepControlProc (HWND hwnd, - int message, WPARAM wParam, LPARAM lParam) +static LRESULT StepControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; HELPWININFO* info; diff --git a/examples/setcursor.c b/examples/setcursor.c index d4089fb9..0971d0d3 100644 --- a/examples/setcursor.c +++ b/examples/setcursor.c @@ -2,9 +2,9 @@ * The following MSG_SETCURSOR handler set the cursor * shape to the arrow cursor when the window is disabled. */ - case MSG_SETCURSOR: - if (GetWindowStyle (hwnd) & WS_DISABLED) { - SetCursor (GetSystemCursor (IDC_ARROW)); - return 0; - } - break; +case MSG_SETCURSOR: + if (GetWindowStyle (hwnd) & WS_DISABLED) { + SetCursor (GetSystemCursor (IDC_ARROW)); + return 0; + } + break; diff --git a/examples/settimer.c b/examples/settimer.c index 599f651e..12474004 100644 --- a/examples/settimer.c +++ b/examples/settimer.c @@ -1,7 +1,7 @@ /* * A typical handling of timer. */ -int FlyingGUIWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT FlyingGUIWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_CREATE: diff --git a/examples/socket.c b/examples/socket.c index 6c7cf503..ee787f89 100644 --- a/examples/socket.c +++ b/examples/socket.c @@ -14,7 +14,7 @@ BOOL listen_socket (HWND hwnd) * the window hwnd will receive a MSG_FDEVENT message. * Now the server can accept the request. */ -int MyWndProc (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +LRESULT MyWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { diff --git a/examples/subclass.c b/examples/subclass.c index b4b8f04e..8997e400 100644 --- a/examples/subclass.c +++ b/examples/subclass.c @@ -10,7 +10,7 @@ #define MY_ES_DIGIT_ONLY 0x0001 #define MY_ES_ALPHA_ONLY 0x0002 static WNDPROC old_edit_proc; -static int RestrictedEditBox (HWND hwnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT RestrictedEditBox (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { if (message == MSG_CHAR) { DWORD my_style = GetWindowAdditionalData (hwnd); @@ -28,7 +28,7 @@ static int RestrictedEditBox (HWND hwnd, int message, WPARAM wParam, LPARAM lPar return (*old_edit_proc) (hwnd, message, wParam, lParam); } -static int ControlTestWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT ControlTestWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_CREATE: diff --git a/examples/ws_ex_notdraggable.c b/examples/ws_ex_notdraggable.c index 4fc3a222..9c7d6d43 100644 --- a/examples/ws_ex_notdraggable.c +++ b/examples/ws_ex_notdraggable.c @@ -10,7 +10,7 @@ #include #include -static int HelloWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) +static LRESULT HelloWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc;