|
-
Nov 13th, 2000, 03:53 PM
#1
Thread Starter
Fanatic Member
If you have a DOS application that you would like to run out of VB and be able to place the required switches in how would you do it in VB.
Example DOS app:
dosapp -something -something else
Any ideas would be great.
-
Nov 13th, 2000, 03:59 PM
#2
Addicted Member
Use the VB Command function
Syntax: x = Command()
Here's a VB Help explanation:
quote: "Returns the argument portion of the command line used to launch Microsoft Visual Basic or an executable program developed with Visual Basic."
Hope this helps
-
Nov 13th, 2000, 04:03 PM
#3
Thread Starter
Fanatic Member
So would you place the syntax that you place in the command into a string or how would this work?
-
Nov 13th, 2000, 04:10 PM
#4
Put this code into VB.
Code:
Private Sub Form_Load()
MsgBox Command
End sub
Now run it from DOS like this:
C:\>MyApp.exe -Hello
Now when you run the program, it will display a messagebox with -Hello in it.
-
Nov 13th, 2000, 04:14 PM
#5
Thread Starter
Fanatic Member
I appreciate your insight, is there a way to run it without having to manually fill in the information at the command line? This will be going out to users that have no clue how to write at the command line.
Thanks
-
Nov 13th, 2000, 05:17 PM
#6
transcendental analytic
Hmm, what do you want to have done brian? Have the user enter a command line, (you could as well do it with run in startmenu) or have it ask you them in runtime?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 13th, 2000, 05:30 PM
#7
Are you looking for an example? 
Code:
Private Sub Form_Load()
Select Case Command
Case "/k"
MsgBox "Paramater = /kedaman"
Case "/m"
MsgBox "Paramater = /Megatron"
Case Else
MsgBox "Usage:" & vbCrLf & vbCrLf & "/k - kedaman" _
& vbCrLf & "/m - Megatron"
End Select
End Sub
This works as like, if a user were to go into dos, type:
C:\MyDir\MyProgram.exe /k
A msgbox would come up saying kedaman.
C:\MyDir\MyProgram.exe /m
A msgbox would come up saying Megatron.
Case Else
Is if nothing is if nothing or the wrong command lines are typed.
You may also want to hide your program since Windows actually loads it.
Notice: Your program will only work when Windows is loaded and the Windows DOS is used.
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
|