ssvvss@mixcom.UUCP (Synetics Software) (12/27/90)
M.S. documentation says I can access the command line arguments by declaring "extern char *_argv[]" (actually it's __argv with 2 underscores, _argv with 1 underscore is not defined). When I do this, I get garbage when I access the array, although __argc seems to be set correctly. Is there a trick to getting this to work? I'd prefer to access argv rather than parsing lpCmdLine which gets passed to WinMain. My second question has to do with radio buttons: It seems that when a radiobutton receives focus, either via a mouse click or by the software setting it explicitly, I get a WM_COMMAND message indicating the button was selected. (So when the button is selected via a mouse click, I process the click twice - once for when it receives focus and once for the actual click.) Has anyone else seen this behavior? Is it a windows bug or am I doing something wrong? Thanks, Douglas Earl dae@synetic.UUCP or mixcom!synetic.uucp!dae@uwm.edu Synetics Software
billf@progress.COM (Bill Ferro) (12/28/90)
ssvvss@mixcom.UUCP (Synetics Software) writes: >M.S. documentation says I can access the command line arguments by >declaring "extern char *_argv[]" (actually it's __argv with 2 underscores, >_argv with 1 underscore is not defined). When I do this, I get garbage >when I access the array, although __argc seems to be set correctly. >Is there a trick to getting this to work? I'd prefer to access argv >rather than parsing lpCmdLine which gets passed to WinMain. I found that Windows "extern char *__argv[]" is actually a pointer to the real argv. In my case, in WinMain, I call a MAIN procedure. The code goes something like this: extern char *__argv[]; extern char __argc; ... main(__argc,(char **)*__argv); ... Hope this helps.... -bf -- Bill Ferro UUCP: mit-eddie!progress!billf Progress Software Corp. Internet: billf@progress.com 5 Oak Park Bedford, MA 01730
P88036@BARILVM.BITNET (Ephraim Vider) (01/02/91)
In article <1990Dec27.224724.8404@progress.com>, billf@progress.COM (Bill Ferro) says: > > >I found that Windows "extern char *__argv[]" is actually a pointer to >the real argv. In my case, in WinMain, I call a MAIN procedure. The >code goes something like this: > extern char *__argv[]; > extern char __argc; > > ... > main(__argc,(char **)*__argv); > ... > >-bf > Well, there is obviously a mistake in the docomentation, but here is the correct answer: __argc is really extern char **__argc this means that __argc is not the name of an array, but a variable containing a pointer to a pointer to char. The latter tells the compiler it has to do three levels of indirection to get to the actual char, while the former implies only two. Hence the suggested solution works, but it is not elegant nor necessary. I suppose this should be done on comp.lang.c or something, but the question was originated here... Hope this clears the fog, Ephraim Vider p88035@barilvm