And then use the command line parameters to set them in the vc2005 debugging settings. Input Parameters, such:
Download (61.3 KB)
You can see that in command arguments Program Command line parameters (cmd1 cmd2 command line parameters ).
Then modify the original program as follows:
#001 int apientry _ twinmain (hinstance,
#002 hinstance hprevinstance,
#003 lptstr lpcmdline,
#004 int ncmdshow)
#005 {
#006 unreferenced_parameter (hprevinstance );
#007 unreferenced_parameter (ncmdshow );
#008
#009 // use the application Handle
#010Const Int maxsize_appended Buf = 256;
#011 tchar wapptile [maxsize_appbuf];
#012 :: Loadstring (Hinstance, ids_app_title, wapptile, maxsize_appbuf );
#013
#014 // Obtain The handle of the desktop.
#015 hwnd =: getdomaintopwindow ();
#016
#017 // display command line parameters.
#018: MessageBox (hwnd, lpcmdline, wapptile, mb_ OK );
#019
#020
#021 // display a message.
#022: MessageBox (hwnd, _ T ("first application"), wapptile, mb_ OK );
#023
#024 //
#025 return 0;
#026}
#027
In the above program, 18th rows Code To display the program command line parameters. The result is as follows:
Download (37.69 KB)
In this way, we can see the use of the winmain parameters. Now we use the first APIFunctionWinmain, So you simply learned to use the first API function.