Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-03-13
14
Medium Priority
?
318 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 58
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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

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 58
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
 
LVL 58
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 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 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 58
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 58
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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

604 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