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.
oldstable
Pavel Roskin 1999-04-03 13:52:04 +00:00 committed by Alexandre Julliard
parent 24f5ffc620
commit 734247b529
7 changed files with 34 additions and 36 deletions

View File

@ -1,7 +1,5 @@
#include <windows.h> #include <windows.h>
#include <resource.h>
#include <commdlg.h> #include <commdlg.h>
#include "hello3res.h"
typedef struct typedef struct
{ {
@ -22,21 +20,24 @@ BOOL FileOpen(HWND hWnd)
return GetOpenFileName(&ofn); 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) switch(msg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
return 1; break;
case WM_COMMAND: case WM_COMMAND:
if(wParam==100) switch (wParam)
DestroyWindow(hWnd); {
return 0; case 100:
} EndDialog(hWnd, 100);
return 0; 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){ switch (msg){
@ -99,7 +100,7 @@ int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
class.hCursor = LoadCursor (0, IDC_ARROW); class.hCursor = LoadCursor (0, IDC_ARROW);
class.hbrBackground = GetStockObject (WHITE_BRUSH); class.hbrBackground = GetStockObject (WHITE_BRUSH);
class.lpszMenuName = 0; class.lpszMenuName = 0;
class.lpszClassName = (SEGPTR)className; class.lpszClassName = className;
} }
if (!RegisterClass (&class)) if (!RegisterClass (&class))
return FALSE; return FALSE;

View File

@ -21,7 +21,6 @@ BEGIN
CONTROL "Static text", 102, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 17, 60, 39, 10 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 "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 "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 "", 105, "COMBOBOX", CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 86, 13, 86, 85
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, 33, 86, 85
/* CONTROL "", 106, "LISTBOX", LBS_STANDARD | LBS_DISABLENOSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 86, 23, 86, 85 */
END END

View File

@ -1,5 +1,8 @@
#include <stdio.h> #include <stdio.h>
#include <windows.h> #include <windows.h>
/* Win32 counterpart for CalcChildScroll16 is not implemented */
/* even in MS Visual C++ */
#include <wine/winuser16.h>
void Write (HDC dc, int x, int y, char *s) 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)); 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 short xChar, yChar;
static RECT rectHola; static RECT rectHola;
@ -49,7 +52,7 @@ LRESULT WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l)
return 0l; 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 short xChar, yChar;
static RECT rectInfo; 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.hCursor = LoadCursor (0, IDC_ARROW);
class.hbrBackground = GetStockObject (WHITE_BRUSH); class.hbrBackground = GetStockObject (WHITE_BRUSH);
class.lpszMenuName = NULL; class.lpszMenuName = NULL;
class.lpszClassName = (SEGPTR)className; class.lpszClassName = className;
if (!RegisterClass (&class)) if (!RegisterClass (&class))
return FALSE; return FALSE;
} }

View File

@ -3,8 +3,8 @@
HANDLE ghInstance; HANDLE ghInstance;
long FAR PASCAL WndProc (HWND, WORD, WPARAM, LPARAM); LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
long FAR PASCAL ChildProc(HWND, WORD, WPARAM, LPARAM); LRESULT CALLBACK ChildProc (HWND, UINT, WPARAM, LPARAM);
int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance, int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance,
LPSTR lpszCmdParam, int nCmdShow) LPSTR lpszCmdParam, int nCmdShow)
@ -54,7 +54,7 @@ int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInstance,
return msg.wParam ; 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 ; HDC hdc ;
PAINTSTRUCT ps ; PAINTSTRUCT ps ;
@ -102,7 +102,7 @@ long FAR PASCAL WndProc (HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam)
return DefWindowProc (hwnd, message, wParam, 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; HDC hDC;
PAINTSTRUCT ps; PAINTSTRUCT ps;
@ -142,7 +142,7 @@ long FAR PASCAL ChildProc(HWND hwnd, WORD message, WPARAM wParam, LPARAM lParam)
break; break;
hDC = BeginPaint(hwnd, &ps); hDC = BeginPaint(hwnd, &ps);
*/ */
MoveTo16(hDC, 0, 0); MoveToEx(hDC, 0, 0, NULL);
LineTo(hDC, 500, 500); LineTo(hDC, 500, 500);
EndPaint(hwnd, &ps); EndPaint(hwnd, &ps);
break; break;

View File

@ -170,7 +170,7 @@ void Idle(HDC idc)
if(!idc) ReleaseDC(HWindow,dc); 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; PAINTSTRUCT PaintInfo;
HDC dc; HDC dc;

View File

@ -54,15 +54,9 @@
#include <float.h> #include <float.h>
#include <time.h> #include <time.h>
#if WINDOWS
#include <wtypes.h>
#else
#include <windef.h> #include <windef.h>
#endif
#ifdef __unix__
#ifdef WINDOWS
#else
#include <debugstr.h> #include <debugstr.h>
extern LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str ); extern LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str );
#endif #endif
@ -71,7 +65,7 @@ extern LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str );
static const int MAX_BUFFER = 1024; static const int MAX_BUFFER = 1024;
#ifdef WINDOWS #ifndef __unix__
char* WtoA( OLECHAR* p ) char* WtoA( OLECHAR* p )
{ {
int i = 0; int i = 0;

View File

@ -5,7 +5,8 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> /* for strcat() */ #include <string.h> /* 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]; char drive, root[]="C:\\", label[1002], fsname[1002];
DWORD serial, flags, filenamelen, labellen = 1000, fsnamelen = 1000; DWORD serial, flags, filenamelen, labellen = 1000, fsnamelen = 1000;