Help Please ! !

Started by
3 comments, last by jflanglois 18 years, 9 months ago
I'm a beginner to C++ and DirectX This is a great community ! ! ! This is my code :: // Include the Windows header file that’s needed for all Windows applications #include <windows.h> HINSTANCE hInst; // global handle to hold the application instance HWND wndHandle; // global variable to hold the window handle // forward declarations bool initWindow( HINSTANCE hInstance ); LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM ); // This is winmain, the main entry point for Windows applications int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow ) { "This is line 16 !!!!!!!!!!" // Initialize 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; } This is the error ! ! ! d:\c++\example1\example1\winmain.cpp(16) : error C2731: 'WinMain' : function cannot be overloaded d:\c++\example1\example1\winmain.cpp(14) : see declaration of 'WinMain' Thanks for the Help ! ! !
Advertisement
Well, the error means like you have 2 or more winmains, or you have a different prototype than implentation..
no the error means ur winmain has more or less paramters than it is supposed to which is wierd bc ur WinMain has the right params as far as i can see.
-Cory
Favorite Quotes:Gandalf: You cannot pass!|Smeagol: We don't need you!|Sloth: Hey you guys!|
Try using instead of LPTSTR using PSTR that should fix ur problem :-D
-cory
Favorite Quotes:Gandalf: You cannot pass!|Smeagol: We don't need you!|Sloth: Hey you guys!|
From WinMain:

int WinMain(    HINSTANCE hInstance,    HINSTANCE hPrevInstance,    LPSTR lpCmdLine,    int nCmdShow);


Look at the way you have defined it: int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow ).

You need to use LPSTR instead of LPTSTR. To use LPTSTR, you should use the function GetCommandLine()


jfl.

This topic is closed to new replies.

Advertisement