🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #122

Command line arguments question

#122
From: Scott Barman
Date: Wed, 29 Jul 1992 20:13
33 lines
1901 bytes
I am far from a Windows expert but I am trying to help a friend out with
a program written for Windows 3.0.  What we are trying to do is access
the command line in a section that is not part of the WinMain()
function.  Yes, we know about that the command line is passed to the
WinMain() function [please excuse me but I do not have the source code
in front of me to refer to and I'm trusting my increasingly failing
memory], but one has to parse this thing and I'm not really in the mood
to write this type of function or re-invent the wheel.  So I RTFM.

Now after RTFM (the MicroSoft books), I found that there are variables
__argc and __argv that seem to echo the "normal" argc and argv that
would be passed to main() if I wasn't dealing with a Windows program.
HOWEVER, in trying to determine the best way to do this, several
"experts" have said to use that "szCmdLine" (or whatever) variable from
the WinMain() call that there is no __argc or __argv.  Personally, I
would rather use the __argc and __argv if they behave like they are
supposed to rather than re-invent the wheel and parse the command line.

So the question is can I define:

	extern int	__argc;
	extern char	**__argv;

and access the command line using those variables?

Please respond via email since my net reading time is at a minimum these
days (just too much to do!).

THANKS!!!!
-- 
scott barman			| <This space intentionally left blank>
scott@asd.com			|
 (I can barely speak for myself, you expect me to speak for my employer??)
Technical Details
Message-ID: <1992Jul29.201353.4770@asd.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!asd.com!scott

Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.ms.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!asd.com!scott
From: scott@asd.com (Scott Barman)
Subject: Command line arguments question
Message-ID: <1992Jul29.201353.4770@asd.com>
Sender: scott@asd.com (Scott Barman)
Organization: American Software Development Corp., W. Babylon, NY
Date: Wed, 29 Jul 1992 20:13:53 GMT
Lines: 33