Shoutbox

VB6 Questions - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: VB6 Questions (/showthread.php?tid=51538)

VB6 Questions by Salem on 10-08-2005 at 04:16 PM

Hi, Its me again

I thought i'd post me to question regarding Visual Basic 6 here, as i have previously received very usefull help regarding my previous VB6 problems/questions.

  1. Can i get a VB6 app to read an XML file? If so what code and/or modules would i need?
  2. I would like to give my VB6 Application the ability to use parameters. So that i can use different parameters to get it to perform specific actions when opening. eg. "appname.exe" /min could open it minimised. How would i go about doing this?
    [/list]

    Thanks in advance
    RileyM

RE: VB6 Questions by Dempsey on 10-08-2005 at 04:56 PM

1   You can reference the Microsoft XML Object or something and do stuff that way, I havent used it much myself, try Googling for VB and XML parsing.

2.  Command line arguments can be access from within VB from the Command$ variable.

eg

code:
Private Sub Form_Load()
    If Len(Command) <> 0 Then MsgBox Command
End Sub



RE: RE: VB6 Questions by Salem on 10-08-2005 at 09:54 PM

quote:
Originally posted by Dempsey
1   You can reference the Microsoft XML Object or something and do stuff that way, I havent used it much myself, try Googling for VB and XML parsing.

2.  Command line arguments can be access from within VB from the Command$ variable.

eg
code:
Private Sub Form_Load()
    If Len(Command) <> 0 Then MsgBox Command
End Sub





Thanks for you help.

I have looked into the MS XML Object, and have downloaded the MSXML Parser & SDK. And have started looking at it

Sorry, i do not understand what you mean with regard to the command line arguments. Please can you explain?

Cheers
RileyM
RE: RE: RE: VB6 Questions by CookieRevised on 10-08-2005 at 09:58 PM

quote:
Originally posted by RileyM
quote:
Originally posted by Dempsey
2.  Command line arguments can be access from within VB from the Command$ variable.
eg
code:
Private Sub Form_Load()
    If Len(Command) <> 0 Then MsgBox Command
End Sub


Sorry, i do not understand what you mean with regard to the command line arguments. Please can you explain?
Just try the example that Dempsey has shown and things will become clear. Or press F1 and search your VB helpfiles for the Command$ function. Or look it up in the MSDN library.

The function Command$ returns whatever you have typed as parameters at the command line. (Remember that when you try to use Command$ in the IDE of VB that you need to set the wanted parameters in Project > Properties > Make > Command Line Arguments).
RE: RE: RE: RE: VB6 Questions by Salem on 10-08-2005 at 10:06 PM

quote:
Originally posted by CookieRevised
quote:
Originally posted by RileyM
quote:
Originally posted by Dempsey
2.  Command line arguments can be access from within VB from the Command$ variable.
eg
code:
Private Sub Form_Load()
    If Len(Command) <> 0 Then MsgBox Command
End Sub


Sorry, i do not understand what you mean with regard to the command line arguments. Please can you explain?
Just try the example that Dempsey has shown and things will become clear. Or press F1 and search your VB helpfiles for the Command$ function. Or look it up in the MSDN library.

The function Command$ returns whatever you have typed as parameters at the command line. (Remember that when you try to use Command$ in the IDE of VB that you need to set the wanted parameters in Project > Properties > Make > Command Line Arguments).


So if i try and use commands in the VB app still running in VB, i need to set the parameters in the project properties. Are parameters seperated by ";"? And if running the app as a stand-alone (not throught VB, will i still need to put the commands on the project properties.

Finaly just to make sure...So basically i would just need to copy the example code Dempsey gave (obviously modifying it for my needs).
RE: RE: RE: RE: RE: VB6 Questions by CookieRevised on 10-08-2005 at 10:55 PM

quote:
Originally posted by RileyM
So if i try and use commands in the VB app still running in VB, i need to set the parameters in the project properties.
Yes

quote:
Originally posted by RileyM
Are parameters seperated by ";"?
No. There aren't multiple parameters; It is one string and thus completely up to you what you wanna do with it. The parameter function Command$ simply returns everything which is typed on the command prompt in one complete string. You need to do your own parsing and/or splitting if you are planning to use more parameters.

When you set blahblah as parameter, Command$ will return the string "blahblah"
When you set /one /two as parameter, Command$ will return the string "/one /two"
When you set /one;two    /nine as parameter, Command$ will return the string "/one;two    /nine"
etc...

quote:
Originally posted by RileyM
And if running the app as a stand-alone (not throught VB, will i still need to put the commands on the project properties.
No. You couldn't anyway since the VB IDE isn't used in that case...

Entering the parameters in you project properties is simply a way to simulate what you otherwise would type on the command prompt when you've compiled your program. It isn't saved inside your compiled program, the option is simply there to simulate the command line.

quote:
Originally posted by RileyM
Finaly just to make sure...So basically i would just need to copy the example code Dempsey gave (obviously modifying it for my needs).
To know how it works, yes. Simply make a new project and add that line to the forms load event, set some text in the parameter textbox of that project and run it...


[Image: attachment.php?pid=548317]

----

Note all this can be found in your VB help files
RE: VB6 Questions by Salem on 10-09-2005 at 09:55 AM

quote:
Originally posted by CookieRevised
quote:
Originally posted by RileyM
So if i try and use commands in the VB app still running in VB, i need to set the parameters in the project properties.
Yes

quote:
Originally posted by RileyM
Are parameters seperated by ";"?
No. There aren't multiple parameters; It is one string and thus completely up to you what you wanna do with it. The parameter function Command$ simply returns everything which is typed on the command prompt in one complete string. You need to do your own parsing and/or splitting if you are planning to use more parameters.

When you set blahblah as parameter, Command$ will return the string "blahblah"
When you set /one /two as parameter, Command$ will return the string "/one /two"
When you set /one;two    /nine as parameter, Command$ will return the string "/one;two    /nine"
etc...

quote:
Originally posted by RileyM
And if running the app as a stand-alone (not throught VB, will i still need to put the commands on the project properties.
No. You couldn't anyway since the VB IDE isn't used in that case...

Entering the parameters in you project properties is simply a way to simulate what you otherwise would type on the command prompt when you've compiled your program. It isn't saved inside your compiled program, the option is simply there to simulate the command line.

quote:
Originally posted by RileyM
Finaly just to make sure...So basically i would just need to copy the example code Dempsey gave (obviously modifying it for my needs).
To know how it works, yes. Simply make a new project and add that line to the forms load event, set some text in the parameter textbox of that project and run it...


[Image: attachment.php?pid=548317]

----

Note all this can be found in your VB help files


Thanks for all the help. its much appreciated.
RileyM