This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Simple windows program won't compile
- To: gnu-win32 at cygnus dot com
- Subject: Simple windows program won't compile
- From: theace <jbanes at midplains dot net>
- Date: Thu, 29 May 1997 15:32:28 -0500
- Organization: Slip.net
Hello. I have a little problem that I was hoping someone could help
with. I can not figure out why the following program won't compile
without errors. If you don't see anything wrong with it, could you try
compiling it and see if you have problems? Thank you.
Begin Program:
#include <windows.h>
LRESULT CALLBACK MyFunc(HWND, UNIT, WPARAM, LPARAM);
char szWinName[] = "MyWin";
int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode)
{
HWND hwnd;
MSG msg;
WNDCLASS wcl;
wcl.hInstance = hThisInst;
wcl.lpszClassName = szWinName;
wcl.lpfnWndProc = MyFunc;
wcl.style = 0;
wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
wcl.lpszMenuName = NULL;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
if(!RegisterClass(&wcl)) return 0;
hwnd = CreateWindow(szWinName, "Windows 95 Skeleton", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hThisInst, NULL);
ShowWindow(hwnd, nWinMode);
UpdateWindow(hwnd);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK MyFunc(HWND hwnd,UNIT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}