views:

45

answers:

1

I have a VB6 app. I am trying to figure out what command line parameters got passed into the application. If I type in ? Command$ into the Immediate window, it prints out the command line params fine. Same, if I place Command$ into the Watch window.

However, if I assign the Command$ function to a string:

Dim s as string 
s = Command$

the s variable will be empty.

What am I missing here?
I should mention that the code in question is located not in the main form, but in a DLL 2 levels down (e.g. the form calls DLL1, then DLL1 calls DLL2).

+2  A: 

Pretty sure the GetCommandLine() API would be an alternative (it should work for anything thats in-process with the executable) so you could try that instead of Command$.

Alex K.