Link to home
Start Free TrialLog in
Avatar of gbmcneil
gbmcneil

asked on

Launching an app quietly and be the last in line at boot up

I am trying to write a Sleep function that delays the execution of a given app until all other apps at startup have been loaded, and will launch my app without opening the command window or making other obvious "noise".

I think I could do this in VB 6.0. with a Loop While and a DoEvents() in between. If I gave it 2 minutes, you'd think that would be adequate time to allow the other apps in my system to load / launch.

I am not sure if VB would be entirely quiet (it might display an icon), which I would like to stay away from.  In addition, I am curious to know whether there might be a quicker way to do this.

Do I have access to the Timer functions if I were to do it in VBScript?

Any ideas, Experts?
Avatar of gbmcneil
gbmcneil

ASKER

There is no DoEvents() in VBScript. If there isn't one in VBScript, there most certainly isn't a counterpart in BAT language.
Avatar of Jim Dettman (EE MVE)
   I doubt too that you could simply time this.  My station varies in boot up time from two to five minutes for example, so simple timing won't work.

  Maybe if you explain what it is your trying to do, we may be able to suggest something else.

JimD.
Shell, Shell and Wait, FindWindow,SendMessageAPI, etc.  See the following link wh downloadable example:
                http://www.daniweb.com/software-development/visual-basic-4-5-6/threads/47356
Thanks for responding Experts.

I quickly wrote an AWAIT program. I call it AWAIT because, I am not trying to stop everything in its tracks. No, I am trying to allow everything that's in the queue to occur and then step in at the end to direct what I want to do (which are essentially daily downloads of stock market information).

In otherwords, I have a machine that is dedicated to downloading data - whether I'm here at my office or not. The program I wrote checks an INI file to learn if the daily downloads were run. If not, it runs them. The little monitoring app kiicks in at boot time, because this would be the scenario if a power failure were to occur.  That's why I want to be the last app to run.

My VB 6.0 program simply sends my program into delay mode, by looping through 2 minutes worth of DoEvents(). Then it checks out what needs to be done. The VB 6.0 applet turned out to be only 16KB, which was a surprise. And, after removing the only form in the app, it runs quietly.

I guess there really is no better way to do it.

Thanks for your suggestions, anyway.
I ran Process Explorer (from SysInternals) this morning immediately after I booted up.

I could see that my AWAIT.EXE program simply held everything up from being launched, because after the 2 minutes was up, AWAIT.EXE got kicked out and a lot of other apps got quickly loaded. You could see the whole thing take place in Process Explorer.

That means my program doesn't work. It's just puttting "everything" to sleep. My DoEvents() command doesn't allow anything to happen and I can't figure out how to end up at the end of the queue.

 I don't understand why your DoEvents() didn't work.  DoEvents yeilds time to the OS for other apps.  The other apps should have loaded.

  I take it you defined AWAIT.EXE in the Run registry key?

JimD.
Okay. I'll bite.

Why should I define AWAIT.EXE in the Run registry?  I never heard of such a thing.
<<Why should I define AWAIT.EXE in the Run registry?  I never heard of such a thing. >>

  No specific reason to do so, it's just one way of getting an app to execute at startup or login.

  I was asking because I was wondering how you started your app.  DoEvents() should not be holding up other processes.

JimD.
The problem with the registry as a launcher of various apps is that there is no way to systematically establish "what gets run when". Given the state of affairs, re-introducing an autoexec.bat capability would be an improvement because at least it would define the order of things being run.

Furthermore, I've got utility apps like PCTools and Acronis Backup that are unknowingly installing memory-resident scheduling programs to start up their respective programs to do whatever at midnight on Monday. It's out of control.

I'd prefer to take charge of the entire process and I can't even dictate what is started at boot up. I'll try increase the amount of time that my AWAIT.EXE program loops thru DoEvenets() to see if I can pick up at the very end of boot up.

Do you know of a program that eliminates all of the stuff from the registry and takes complete charge?  
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If the intent of my program at boot up is to in turn run 10 or 12 other programs whose completion is dependent on the results of each of the previous programs (or maybe not, depending on other factors determined when each of the individual programs runs) why wouldn't I want to wait until all of the utility type stuff is done first?

Consider, too, that if all 12 of my programs run we might be looking at 6 or 7 hours of processing.

If so, why would I want something pending after seven hours that should have been taken care of at boot time?
<< why wouldn't I want to wait until all of the utility type stuff is done first?>>

  Why would you?  Unless there is a conflict with another program for a resource, then why does it matter when the program starts?  Either way, it's going to get executed and complete at some point.

  Suffice to say, other then waiting, I can't think of anything within Windows that will tell you when all startup programs and services have been executed and that they have finished processing.

  And some, like anti-virus will never stop until you shutdown.

JimD.
You're telling me the way it works.

 I'm telling you the way I would like it to work. You don't agree. That's what makes a horse race.


 Well you might not like the answer "you can't do that", but that is the answer.

 Feel free to delete the question.

JimD.