From 734247b529aebd04912cf1e5bb5bb0472f2929f5 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sat, 3 Apr 1999 13:52:04 +0000 Subject: [PATCH] Casts to (SEGPTR) removed. They did nothing anyway. Includes added or removed where necessary. Win16 functions replaced with their Win32 counterparts. Comments added where it was impossible. CALLBACK added where necessary. Some declarations fixed. Constructs like "#if WINDOWS" corrected. Using "#ifdef __unix__" instead. DlgProc in hello3 uses EndDialog() instead of DestroyWindow(). Listbox enabled in hello3. --- libtest/hello3.c | 31 ++++++++++++++++--------------- libtest/hello3res.rc | 5 ++--- libtest/hello4.c | 9 ++++++--- libtest/new.c | 10 +++++----- libtest/rolex.c | 2 +- libtest/vartest.c | 10 ++-------- libtest/volinfo.c | 3 ++- 7 files changed, 34 insertions(+), 36 deletions(-) diff --git a/libtest/hello3.c b/libtest/hello3.c index ef22314267c..462bbe324a3 100644 --- a/libtest/hello3.c +++ b/libtest/hello3.c @@ -1,7 +1,5 @@ #include -#include #include -#include "hello3res.h" typedef struct { @@ -22,21 +20,24 @@ BOOL FileOpen(HWND hWnd) return GetOpenFileName(&ofn); } -BOOL CALLBACK DlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) +LRESULT CALLBACK DlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { - switch(msg) - { - case WM_INITDIALOG: - return 1; - case WM_COMMAND: - if(wParam==100) - DestroyWindow(hWnd); - return 0; - } - return 0; + switch(msg) + { + case WM_INITDIALOG: + break; + case WM_COMMAND: + switch (wParam) + { + case 100: + EndDialog(hWnd, 100); + return TRUE; + } + } + return FALSE; } -LRESULT WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l) +LRESULT CALLBACK WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l) { switch (msg){ @@ -99,7 +100,7 @@ int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show) class.hCursor = LoadCursor (0, IDC_ARROW); class.hbrBackground = GetStockObject (WHITE_BRUSH); class.lpszMenuName = 0; - class.lpszClassName = (SEGPTR)className; + class.lpszClassName = className; } if (!RegisterClass (&class)) return FALSE; diff --git a/libtest/hello3res.rc b/libtest/hello3res.rc index 60ab44a94b4..9b7d2d7e80d 100644 --- a/libtest/hello3res.rc +++ b/libtest/hello3res.rc @@ -21,7 +21,6 @@ BEGIN CONTROL "Static text", 102, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 17, 60, 39, 10 CONTROL "Edit control", 103, "EDIT", ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 18, 41, 44, 13 CONTROL "Radio button", 104, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 17, 23, 58, 12 - CONTROL "Checkbox", 101, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 19, 76, 47, 12 - CONTROL "", 106, "COMBOBOX", CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 86, 23, 86, 85 -/* CONTROL "", 106, "LISTBOX", LBS_STANDARD | LBS_DISABLENOSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 86, 23, 86, 85 */ + CONTROL "", 105, "COMBOBOX", CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 86, 13, 86, 85 + CONTROL "", 106, "LISTBOX", LBS_STANDARD | LBS_DISABLENOSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 86, 33, 86, 85 END diff --git a/libtest/hello4.c b/libtest/hello4.c index 54771159fa3..259d4554a39 100644 --- a/libtest/hello4.c +++ b/libtest/hello4.c @@ -1,5 +1,8 @@ #include #include +/* Win32 counterpart for CalcChildScroll16 is not implemented */ +/* even in MS Visual C++ */ +#include void Write (HDC dc, int x, int y, char *s) { @@ -7,7 +10,7 @@ void Write (HDC dc, int x, int y, char *s) TextOut (dc, x, y, s, strlen (s)); } -LRESULT WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l) +LRESULT CALLBACK WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l) { static short xChar, yChar; static RECT rectHola; @@ -49,7 +52,7 @@ LRESULT WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l) return 0l; } -LRESULT WndProc2 (HWND wnd, UINT msg, WPARAM w, LPARAM l) +LRESULT CALLBACK WndProc2 (HWND wnd, UINT msg, WPARAM w, LPARAM l) { static short xChar, yChar; static RECT rectInfo; @@ -113,7 +116,7 @@ int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show) class.hCursor = LoadCursor (0, IDC_ARROW); class.hbrBackground = GetStockObject (WHITE_BRUSH); class.lpszMenuName = NULL; - class.lpszClassName = (SEGPTR)className; + class.lpszClassName = className; if (!RegisterClass (&class)) return FALSE; } diff --git a/libtest/new.c b/libtest/new.c index fb1ea404b40..63c6488984a 100644 --- a/libtest/new.c +++ b/libtest/new.c @@ -3,8 +3,8 @@ HANDLE ghInstance; -long FAR PASCAL WndProc (HWND, WORD, WPARAM, LPARAM); -long FAR PASCAL ChildProc(HWND, WORD, WPARAM, LPARAM); +LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); +LRESULT CALLBACK ChildProc (HWND, UINT, WPARAM, LPARAM); int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow) @@ -54,7 +54,7 @@ int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance, return msg.wParam ; } -long FAR PASCAL WndProc (HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc ; PAINTSTRUCT ps ; @@ -102,7 +102,7 @@ long FAR PASCAL WndProc (HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam) return DefWindowProc (hwnd, message, wParam, lParam) ; } -long FAR PASCAL ChildProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK ChildProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hDC; PAINTSTRUCT ps; @@ -142,7 +142,7 @@ long FAR PASCAL ChildProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam) break; hDC = BeginPaint(hwnd, &ps); */ - MoveTo16(hDC, 0, 0); + MoveToEx(hDC, 0, 0, NULL); LineTo(hDC, 500, 500); EndPaint(hwnd, &ps); break; diff --git a/libtest/rolex.c b/libtest/rolex.c index f7aadd00550..ca84e99d670 100644 --- a/libtest/rolex.c +++ b/libtest/rolex.c @@ -170,7 +170,7 @@ void Idle(HDC idc) if(!idc) ReleaseDC(HWindow,dc); } -LRESULT ProcessAppMsg(HWND wnd,UINT msg,WPARAM w,LPARAM l) +LRESULT CALLBACK ProcessAppMsg(HWND wnd,UINT msg,WPARAM w,LPARAM l) { PAINTSTRUCT PaintInfo; HDC dc; diff --git a/libtest/vartest.c b/libtest/vartest.c index be5fed21b2d..5926dad1b72 100644 --- a/libtest/vartest.c +++ b/libtest/vartest.c @@ -54,15 +54,9 @@ #include #include -#if WINDOWS -#include -#else #include -#endif - -#ifdef WINDOWS -#else +#ifdef __unix__ #include extern LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str ); #endif @@ -71,7 +65,7 @@ extern LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str ); static const int MAX_BUFFER = 1024; -#ifdef WINDOWS +#ifndef __unix__ char* WtoA( OLECHAR* p ) { int i = 0; diff --git a/libtest/volinfo.c b/libtest/volinfo.c index 65baf130551..7b64afcf6ef 100644 --- a/libtest/volinfo.c +++ b/libtest/volinfo.c @@ -5,7 +5,8 @@ #include #include /* for strcat() */ -int WinMain(int argc,char **argv[]) +int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpszCmdLine, int nCmdShow) { char drive, root[]="C:\\", label[1002], fsname[1002]; DWORD serial, flags, filenamelen, labellen = 1000, fsnamelen = 1000;