dcsimg
Results 1 to 7 of 7

Thread: Start EXE from another EXE

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2014
    Posts
    310

    Start EXE from another EXE

    I have a project (exe). let's call it B.exe which takes a pretty long time to display the form on the screen - up to 20-30 seconds. It is due to complex selection from the database and following calculations. I would'n want to display the blank form and ask the user to click on some control tto populate controls with data. By some reason I need to display the form with data.
    It should be started from another project A.exe via menu or button click.
    Is there any way to set the cursor to vbHourGlass right after the click and set it to vbDefault after the E.exe appears on the screen?

    Thank you

  2. #2
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,801

    Re: Start EXE from another EXE

    Hi chapran,

    Since you're starting a second EXE, I assume you're doing that will Shell (or maybe the ShellExecute API). And, as such, you're getting another thread (and process).

    Therefore, I'd always let whatever process is taking the time be the one to deal with the mouse icon. For instance, your program A.exe could continue to do things while your program B.exe is getting up and running, and you wouldn't want to deal with an hourglass in program A.exe just because program B.exe is taking a while.

    So, let's just talk about program B.exe. If it were me, I'd consider quickly loading some form that would show before I started whatever long initialization processes there were. And, on that form, I'd show some "loading..." message, possibly changing the mouse icon to an hourglass on that initial form. That way, all of your problems would be solved.

    Hope that helps.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2014
    Posts
    310

    Re: Start EXE from another EXE

    Thank you very much. I did not try yet, but I believe it is exactly what I need.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2014
    Posts
    310

    Re: Start EXE from another EXE

    I tried this:
    I added a new form (frmStart) to the project B
    I replaced the form (frmMain) which takes a long time with the new form (in Sub Main.
    In the new form Load event I placed frmMain.Show

    When I start B.exe with Shell the form frmStart does not appear right away as I expected, but when after delay frmMain form appears then the form frmStart appears.
    What am I doing wrong?

    Thank you

  5. #5
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,801

    Re: Start EXE from another EXE

    Try frmStart.Refresh right after your frmStart.Show (or however you're showing it).
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  6. #6
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    5,801

    Re: Start EXE from another EXE

    Wait, you're loading frmMain from the Form_Load event of frmStart?

    Try moving the frmMain load into the Form_Activate event of frmStart.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2014
    Posts
    310

    Re: Start EXE from another EXE

    frmStart.Refresh did not help, but the movement to the Activate event worked perfectly.

    Thank you very much!

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width