I'm using Visual C++.NET. I need to pass a port number to my gui. What the syntax for passing arguments to "int __stdcall WinMain()." For regular C++ it would be "int main(int argc, char* argv)" Thanks.
lpCmdLine [in] Pointer to a null-terminated string specifying the command line for the application, excluding the program name. To retrieve the entire command line, use the GetCommandLine function.
So in WinMain do something like this:
lpCmdLine = GetCommandLine();
Then parse the lpCmdLine string. (REMEMBER IT DOES NOT INCLUDE THE PROGRAM PATH).
Also, a Visual C++ dependent way is to use __argv and __argc as you would argv and argc. This only applies to 32-bit windows programs. 16-bit windows programs require you to declare the variables the following way:
Below is a simple example I found on MSDN. I added the #include <windows.h> but it still has an error. Am I forgetting to set something in my environment? I'm using Visual C++.NET 2003.
error C2731: 'WinMain' : function cannot be overloaded
#undef MessageBox // undefine the MessageBox macro of windows.h to use the managed MessageBox class
void __stdcall WinMain(HINSTANCE hInstance,
System::Windows::Forms::MessageBox::Show("Hello, Windows Forms");