Windows Main and Command Line Parameters

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2004
Posts: 219
Reputation: BountyX is an unknown quantity at this point 
Solved Threads: 8
BountyX's Avatar
BountyX BountyX is offline Offline
Code Guru

Windows Main and Command Line Parameters

 
0
  #1
Dec 22nd, 2004
Does anyone know how to have a windows program accept command line options?

For example a terminal program just needs a parameter in the main function to accept command line parameters, how can I do the same for a windows main functions, since parameters are already there?
A Hacker's Mind:
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes..." - J.D.Salinger
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Windows Main and Command Line Parameters

 
0
  #2
Dec 22nd, 2004
From the Win32 API reference (as supplied by Microsoft):
  1. int WINAPI WinMain(
  2.  
  3. HINSTANCE hInstance, // handle to current instance
  4. HINSTANCE hPrevInstance, // handle to previous instance
  5. LPSTR lpCmdLine, // pointer to command line
  6. int nCmdShow // show state of window
  7. );

lpCmdLine

Points to a null-terminated string specifying the command line for the application.
You're not getting it as a nice array of commandline arguments but you are getting it.

Full helpfile is available here: http://www.borland.com/devsupport/bo...s/BC52HLP1.ZIP (it's a Microsoft file supplied by Borland including complete search index).
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 219
Reputation: BountyX is an unknown quantity at this point 
Solved Threads: 8
BountyX's Avatar
BountyX BountyX is offline Offline
Code Guru

Re: Windows Main and Command Line Parameters

 
0
  #3
Dec 22nd, 2004
thanks a million!
A Hacker's Mind:
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes..." - J.D.Salinger
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC