|
-
Apr 21st, 2003, 01:58 PM
#1
Thread Starter
Lively Member
Command Line Argument Problem
Hello Everyone-
I am having a problem passing in Command Line Arguments to my VB program.
My program does not seem to recognize any parameters that I pass into it when calling the EXE or when trying to test it passing the parameters in through the IDE.
I am using:
VB Code:
If Command$ <> "" then
'Do stuff here
end if
to determine if any arguments are being passed into my program. But no matter what I pass in as an argument the "Command$" variable always equals "". I have another program that accepts the exact same argument and I do not have any problems.
Has anybody else ever had this problem or have any advice on what is happening?
Thanks
Thanks in Advance!
TRIP85
In the game of life, it's not whether you win or lose, it's how drunk you get.
-Homer Simpson
-
Apr 21st, 2003, 02:16 PM
#2
Frenzied Member
Sounds really weird as I don't know how you pass those args. To debug what values are comming in go to you Project Properties and set some value to "Command Line Arguments" on the "Make" tab and run your project.
Note: your logic must be within your app's startup procedure (Form_Load or Sub Main)
-
Apr 21st, 2003, 02:20 PM
#3
Need-a-life Member
-
Apr 21st, 2003, 02:21 PM
#4
Need-a-life Member
This DOES work:
VB Code:
Private Sub Form_Load()
If Command <> "" Then
MsgBox "Command!!"
End If
End Sub
This DOESN'T:
VB Code:
Private Sub Form_Load()
Dim Command As String
If Command <> "" Then
MsgBox "Command!!"
End If
End Sub
Check if you don't have anything like this.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Apr 21st, 2003, 02:22 PM
#5
Thread Starter
Lively Member
When running the EXE I pass the arguments as follows:
c:\Vivid\Software\EnhancedMenuGenerator.exe Headend01Days001
And the my program will not pick up the argument.
I also tried passing the same Headend01Days001 argument into the program using the IDE through the "Properties/Make" tab and I get the same results , the program acts as if it is not getting any arguments passed to it.
It is really wierd because i have another piece of software that i wrote that is almost identical to the one I am working on now and it has no problem accecpting the same command line argument.
Thanks in Advance!
TRIP85
In the game of life, it's not whether you win or lose, it's how drunk you get.
-Homer Simpson
-
Apr 21st, 2003, 02:27 PM
#6
Thread Starter
Lively Member
Here is the code that I am using:
VB Code:
If Command$ <> "" Then
'/* Don't allow the GeneratedTitles screen to be */
'/* shown if the menus are running under */
'/* autmation. */
MenuGenerator.chkOptions(0).Value = 0
chkAutomaticPackage.Value = 1
MidnightDate = Format(Date, "MM/DD/YY HH:MM:SS")
'/* "Command$" must be passed in the through the */
'/* Command Line in the following format: */
'/* Headend00Days000 */
CommandString = Command$
Days = Mid(CommandString, 14, 3)
Headend = Mid(CommandString, 8, 2)
If Days = 0 Then
txtBuildDate.Value = Now
ElseIf Days = 1 Then
txtBuildDate.Value = DateAdd("d", 1, MidnightDate)
txtBuildDate.Value = Format(txtBuildDate.Value, "MM/DD/YY 12:00:00") & " AM"
Else
txtBuildDate.Value = DateAdd("d", Days, MidnightDate)
txtBuildDate.Value = Format(txtBuildDate.Value, "MM/DD/YY 12:00:00") & " AM"
End If
Call MenuGenerator.SQLQueries(adoExpirationDate, "", "", 6)
If Headend = 0 Then
MenuGenerator.chkMultiHeadends.Value = 1
Else
MenuGenerator.chkMultiHeadends.Value = 0
HeadendCode = Headend
cboHeadends.BoundText = HeadendCode
End If
'Call RefreshHeadends
SSTVODGenerator.Tab = 0
MenuGenerator.Show
Call cmdGenerateVOD_Click
End If
Which is the same code that I use in another piece of software for a different customer and it doesn't have any problems.
Thanks in Advance!
TRIP85
In the game of life, it's not whether you win or lose, it's how drunk you get.
-Homer Simpson
-
Apr 21st, 2003, 02:30 PM
#7
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|