Results 1 to 11 of 11

Thread: Quick, Easy Question

  1. #1

    Thread Starter
    Addicted Member tonyenkiducx's Avatar
    Join Date
    Oct 2000
    Location
    London England
    Posts
    147

    Talking

    Hi,
    This is such a simple question, you have permission to attach some hate mail to your reply. I want to call "something" and have it run in the back ground.. IE I have a form, and I want to call a seperate process, so that the process will run in the background and do what it has to do, and the form will continue along its merry way without going waiting for the process to finish.

  2. #2
    New Member
    Join Date
    Oct 2000
    Location
    Abingdon, England
    Posts
    5

    Wink

    One of the easiest ways is to use "Shell" - so long as you have an address for the process. Using various flag options you can run this process minimized and in the background - VB help will tell you the relevant flag settings.
    Chris Franklin

  3. #3

    Thread Starter
    Addicted Member tonyenkiducx's Avatar
    Join Date
    Oct 2000
    Location
    London England
    Posts
    147
    But I thought there was a way to use an internal function? Is it a module? I think a module runs in the background, Im just not sure if it needs to finish before the first process can continue..

  4. #4

    Thread Starter
    Addicted Member tonyenkiducx's Avatar
    Join Date
    Oct 2000
    Location
    London England
    Posts
    147
    Ok, heres a better way to explain it, I want to be able to call a process inside my vb app, something that is part of that application(Like in that vb6 project), but runs independantly.

  5. #5
    Guest
    I'm not sure what you mean. You want to use the built-in Shell function?

    Code:
    Shell "C:\prog.exe", vbNormalFocus
    DoEvents
    'anything below the DoEvents will be processed
    'after the application has fully loaded
    The Shell function also accepts command lines.

    Code:
    Shell "Notepad.exe C:\Autoexec.bat", vbNormalFocus

  6. #6

    Thread Starter
    Addicted Member tonyenkiducx's Avatar
    Join Date
    Oct 2000
    Location
    London England
    Posts
    147

    Talking

    What I mean is, say I execute a function in VB, I have to wait for the function to exit before the code that called the function can continue. I want to be able to call a function(Or a slice of code) without stopping my main program.

  7. #7
    Hyperactive Member dsy5's Avatar
    Join Date
    Jul 2000
    Location
    Lockport, NY
    Posts
    362
    If you are looping in your function, you could use DoEvents, I believe.
    Donald Sy - VB (ab)user

  8. #8

    Thread Starter
    Addicted Member tonyenkiducx's Avatar
    Join Date
    Oct 2000
    Location
    London England
    Posts
    147

    Talking

    Whats doevent, and how does that work? The actual task I wish to accomplish is to have my front end winsock client tell another "thing(This could be ANYTHING, but it has to be lightningly fast, and I would therefore assume part of the same program)" to update an array. Obviously SHELL is to slow for this, and I would hope theres a way of executing a module(Or something like a module) and continuing through your main code, letting the module do its thing in the background(I mean, this IS a multi-tasking environment, right?)..

  9. #9

    Thread Starter
    Addicted Member tonyenkiducx's Avatar
    Join Date
    Oct 2000
    Location
    London England
    Posts
    147

    Talking

    Managed to sort it his AM(GMT), I used a trigger to spot a variable being changed, this then called a module, and they all continued on there merry way... Is this efficient, or is this crap?

  10. #10
    Guest
    Create yourslef an activeX exe that does the processing.

    Have a public function in the exe called "ProcessingDone" or something similar, and a sub that starts the processing

    Create a reference to the exe using the Withevents keyword

    eg:
    Code:
    Private Withevents mObject as ExeClassName.ProgID
    Then all you need to do is call the sub in the exe;
    Code:
    mObject.MySub
    And wait for the event to come back:

    Code:
    Private Sub mObject_ProcessingDone()
        'Do something here now that the
        'processign has finished
    End Sub
    That should work nicely.

    - gaffa

  11. #11

    Thread Starter
    Addicted Member tonyenkiducx's Avatar
    Join Date
    Oct 2000
    Location
    London England
    Posts
    147

    Talking

    cheers Gaffa, very usefull, but unfortunately still not fast enough, is my method of using a timer ****? It seems fast, I just dont know if its considered "taboo" or anything.. are timers ok?

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