One-day Windows API training (3) using command line parameters

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.