Jump to content
  • Advertisement
Sign in to follow this  
VosKeyGen

this won't compile =(

This topic is 4934 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This would be my first window's app... after months and months of dos but it won't compile -.- I'm using VisualStudioC++.6 any help will be appreiated #include <windows.h> HINSTANCE hInst; //global handle to hold appication instance HWND wndHandle; //global variable to hold the window hanle // forward declarations bool initWindow( HINSTANCE hInstance ); LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM ); // main entry point for windows applications int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow ) { // initalize the window if ( !initWindow( hInstance ) ) return false; // main message loop: MSG msg; ZeroMemory( &msg, sizeof( msg ) ); while( msg.message != WM_QUIT ) { // check the message queue while (GetMessage(&msg, wndHandle, 0, 0) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } } return (int) msg.wParam; } /*********************************************************************************** * bool initWindow( HINSTANCE hInstance ) * initWindow registers the window class for the application, creates the window ***********************************************************************************/ bool initWindow( HINSTANCE hInstance ) { WNDCLASSEX wcex; // Fill in the WNDCLASSEX structure. This discribes how the window will look to the system wcex.cbSize = sizeof(WNDCLASSEX); // size of structure wcex.style = CS_HREDRAW | CS_VREDRAW; // the class style wcex.lpfnWndProc = (WNDPROC)WndProc; // the window procedure callback wcex.cbClsExtra = 0; // extra bytes to allocate for this class wcex.cbWndExtra = 0; // extra bytes to allocate for this instance wcex.hInstance = hInstance; // handle to the application instance wcex.hIcon = 0; // icon to associate with the application wcex.hCursor = LoadCursor(NULL, IDC_ARROW); // the default cursor wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); // the background color wcex.lpszMenuName = NULL; // the resource name for the menu wcex.lpszClassName = "DirectXExample"; // the class name being created wcex.hIconSm = 0; // the handle to the small icon RegisterClassEx(&wcex); // Create the window wndHandle = CreateWindow( "DirectXExample", "DirectXExample", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, // the starting x coordinate CW_USEDEFAULT, // the starting y coordinate 640; // pixel width of the window 480; // pixel hieght of the window NULL, // the parent window; NULL for destop NULL, // the menu for the application; NULL for none hInstance, // the handle to the application instance NULL); // no values pass to the window // this line is where my error is // make sure that the window handle that is created is valid if (!wndHandle) return false; // Display the window on the screen ShowWindow(wndHandle, SW_SHOW); UpdateWindow(wndHandle); return true; } /************************************************************************************** * the window procedure **************************************************************************************/ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { // Check any available messages from the queue switch (message) { case WM_DESTROY: PostQuitMessage(0); break; } // always return the message to the default window // procedure for future processing return DefWindowProc(hWnd, message, wParam, lParam); }

Share this post


Link to post
Share on other sites
Advertisement
These two lines are wrong in your CreateWindow() call:

640; // pixel width of the window
480; // pixel hieght of the window

Replace the semi-colons with commas.

ace

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
look into optimizing that file because for games you need more optimizations to the file, for instance you should use peekmessage, not getmessage, read about it and ask

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!