OK, so I'm trying to learn C++ and get into game programming in windows.... I've been using the book Tricks of the Windows Game Programming Gurus and I had some trouble compiling the second example. I'm using VC++ 6.0 Introductory Edition and am running Win XP.
This is my WINMAIN.... I used ^ and ^^ to indicate the lines that the errors occure on.
I get the following errors during compile...Code:int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) { WNDCLASSEX winclass; // this will hold the class we create HWND hwnd; // generic window handle MSG msg; // generic message // first fill in the window class structure winclass.cbSize = sizeof(WNDCLASSEX); winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; winclass.lpfnWndProc = WindowProc; winclass.cbClsExtra = 0; winclass.cbWndExtra = 0; winclass.hInstance = hinstance; winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); winclass.hCursor = LoadCursor(NULL, IDC_ARROW); ^winclass.hbrBackground = GetStockObject(BLACK_BRUSH); winclass.lpszMenuName = NULL; winclass.lpszClassName = WINDOW_CLASS_NAME; winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION); // register the window class if (!RegisterClassEx(&winclass)) return(0); // create the window if (!(hwnd = CreateWindowEx(NULL, // extended style WINDOW_CLASS_NAME, // class "Your Basic Window", // title ^^WS_OVERLAPPEDWINDOW | WS_VISBLE, 0,0, // initial x,y 400,400, // initial width, height NULL, // handle to parent NULL, // handle to menu hinstance, // instance of this application NULL))) // extra creation parms return(0); // enter main event loop while(GetMessage(&msg,NULL,0,0)) { // translate any accelerator keys TranslateMessage(&msg); // sned the message to the window proc DispatchMessage(&msg); } // end while // return to Windows like this return(msg.wParam); } // end WinMain
^error C2440: '=' : cannot convert from 'void *' to 'struct HBRUSH__ *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
^^error C2065: 'WS_VISBLE' : undeclared identifier
Error executing cl.exe.
If you need any more info to help me out just ask.
Thanks.



LinkBack URL
About LinkBacks



