This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Simple windows program won't compile


   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;

}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]