Link to home
Start Free TrialLog in
Avatar of Cristi_E
Cristi_EFlag for Romania

asked on

Detect when Windows has finished loading

Hi,
Is there a key (or anything) that i can read from windows to know that it  has finished loading?
Can you provide some techniques to detect when Windows has finished loading especially using WMI, Visual Basic6 or Windows API?
I have a program that runs at startup, and i need it to open after the windows has finished loading (network is initialized etc).
Regards,
Cristi
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

if your program is runs from startup, then u can bet windows has finished loading...if it is depend on specific process/service, u can query their status to make sure they are loaded and running
Avatar of Cristi_E

ASKER

For example it reads all the installed printers. Some times it tells that there are no installed printers bechause it cannot read them (or the returned value by the WMI is that there are no printers) and that is i think bechause Windows did not finished loading.
so you need to make sure the Spooler service is running and then it should give you list of installed printers.
Yes in this particular case. It also tryes to connect to the internet and check if a licence is still valid, and also some tymes return a error bechause the network is not ready.
So should i understand that there is no universal method to tell taht windows has finished loading and it is ready to be used?
I really need that for all my programms that run at startup and perform som tasks.
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel 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
OK.
So in my case when i use WMI to read all the installed printers, what should i check first before trying to read them? Is it possible that WMI itself not being ready when i try to use it?
you can be positive to use WMI when your program was launched, if that what you are concern about.
SOLUTION
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
Just add your program to

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

and it will be execuuted as soon as Windows has finished loading and before a user logs on. See also http://support.microsoft.com/kb/179365 ("INFO: Run, RunOnce, RunServices, RunServicesOnce and Startup")
Thenks for help!