Solved

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

Posted on 2011-03-13
14
308 Views
Last Modified: 2012-08-13
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?
0
Comment
Question by:gbmcneil
  • 7
  • 6
14 Comments
 

Author Comment

by:gbmcneil
ID: 35122399
There is no DoEvents() in VBScript. If there isn't one in VBScript, there most certainly isn't a counterpart in BAT language.
0
 
LVL 57
ID: 35127533
   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.
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 35128721
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
0
 

Author Comment

by:gbmcneil
ID: 35132254
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.
0
 

Author Comment

by:gbmcneil
ID: 35139090
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.
0
 
LVL 57
ID: 35139447

 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.
0
 

Author Comment

by:gbmcneil
ID: 35139914
Okay. I'll bite.

Why should I define AWAIT.EXE in the Run registry?  I never heard of such a thing.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 57
ID: 35140105
<<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.
0
 

Author Comment

by:gbmcneil
ID: 35140327
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?  
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 125 total points
ID: 35141407
<<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.
>>

  Not really.  When a program is launched, what it does after that is up to it.  The startup process is not a synchronous one. That's why on a PC, bootup can often be short, but sometimes it can be long.

<<Do you know of a program that eliminates all of the stuff from the registry and takes complete charge?   >>

  None that I know of.  There's nothing here to be "fixed"; it's the way it works.

  And I still don't understand why your stock download needs to be last and make sure that everything else is finished.  Software is just not typically written that way.  If you need a resource, you simply wait for it.

JimD.
0
 

Author Comment

by:gbmcneil
ID: 35141600
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?
0
 
LVL 57
ID: 35141723
<< 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.
0
 

Author Comment

by:gbmcneil
ID: 35141802
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.

0
 
LVL 57
ID: 35142610

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

 Feel free to delete the question.

JimD.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now