Results 1 to 6 of 6

Thread: Passing a variable

  1. #1

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303

    Question

    How can I pass a string variable from one EXE file to another?
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Location
    Rochester NY, USA
    Posts
    93
    are you talking about passing a string to an exe at startup or passing a string to an exe while it's running?

  3. #3

  4. #4

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    I want to pass the string across at startup
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  5. #5
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    I guess you mean command line arguments. It is quite simple to get these back.
    Code:
    Dim sBuffer As String
    
    sBuffer = Command
    so if you called your program like this
    Code:
    myProg.exe test command
    sBuffer would contain "test command"

    Hope this helps.

    [Edited by Iain17 on 05-04-2000 at 03:27 PM]
    Iain, thats with an i by the way!

  6. #6
    Lively Member
    Join Date
    Jan 1999
    Location
    Rochester NY, USA
    Posts
    93
    so you want one program to launch another program with certian command line arguments? If that's the case then just use the Shell() command to do this. You'd format it just like you were typing it in the run box or at a command line.. or how it's set up in a shortcut..

    Shell("c:\myprogram\myprogram.exe /s")

    use vars if you want

    Dim program as String
    Dim switches as String

    program = "c:\myprogram\myprogram.exe"
    switches = "/s"

    Shell(program & " " & switches)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width