First caller on tray

My application startup on the windows tray during windows startup. Is there a way to insure that my application will always be the first one that is executed during windows startup. It must work for both Win9X and NT.
npatelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:
id suggest putting your program under
HKEY_CURRENT_USERS\Software\microsoft\windows\currentversion\run key and make your program the first one in the list.
if you need the code to put it there i shall give it you just ask.
cheers
0
npatelAuthor Commented:
Thank you for your response.

I will check this out and give you an answer for the points tomorrow.

How can I garantee that no other program when loaded will change the order of this call?


0
intheCommented:
as far as i can tell the orderis first in the list starst first.
notice the order is alphabetical so you just need to name your program something with a couple of "a's" first like "aapple" or name it something like "!apple" to pu it first in list.
0
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

MadshiCommented:
There are several places where you can install the autostart for your program:

HKEY_LOCAL_MACHINE\...\Run
HKEY_LOCAL_MACHINE\...\RunService
HKEY_CURRENT_USER\...\Run
HKEY_CURRENT_USER\...\RunService
c:\windows\startmenu\programs\startup
win.ini\[windows]\load
win.ini\[windows]\run

I don't know which place is looked at first. I guess, it's RunService. But you'll have to check that.

Regards, Madshi.
0
npatelAuthor Commented:
inthe and madshi,

I have an idea!.

What if my program was converted to a self extracting file that was named the same as the windows desktop exe (I am assuming that it is a ????.exe) . when windows executes the destop, it runs my code which extracts the original desktop exe and runs it.

Bonus of this is that
- my program will be able to have total control of the desktop.
- can be made to secure the access to the desktop.
- allow me to modify the registry before and after the desktop executes.

Will this work? better then a tray exec that changes the registry.

0
MadshiCommented:
That can be achieved even more easy. In win9x you can edit "system.ini\[boot]\shell". Normally you find there "Explorer.exe". You can write your program path in there. Then the desktop isn't started anymore, but instead your program.

Under winNT it's a bit more difficult. Look at this text:

According to MSDN, you can indeed replace the shell on Windows NT. Note from the references to Program Manager that this information was written with reference to WinNT 3.x

Excerpted from MSDN:

Replacing the Shell (Program Manager)
Last reviewed: November 2, 1995
Article ID: Q100328  
The information in this article applies to:
Microsoft Win32 Application Programming Interface (API) included with:


    - Microsoft Windows NT versions 3.1, 3.5, and 3.51



SUMMARY
To replace the current shell, change the following registry key:


   HKEY_LOCAL_MACHINE\
      SOFTWARE\
      Microsoft\
      Windows NT\
      CurrentVersion\
      Winlogon\
      Shell

Note that Program Manager combines the functionality of Program Manager and Task Manager (the Task Manager installed is not actually run). Therefore, you must take this into account. In Windows NT 3.1, if the new shell does not replace the Task Manager functionality, the replacement string should contain both the new shell name and TASKMAN.EXE, separated by commas. In Windows NT 3.5, the new shell should either spawn TASKMAN.EXE or your own task manager, specified in

   HKEY_LOCAL_MACHINE\
      SOFTWARE\
      Microsoft\
      Windows NT\
      CurrentVersion\
      Winlogon\
      Taskman

The value does not exist by default, it must be added. The value type is REG_SZ.
To update the string that is retrieved when you call GetPrivateProfileString(), change the string in the following registry key:


   HKEY_LOCAL_MACHINE\
      SOFTWARE\
      MICROSOFT\
      Windows NT\
      Current Version\
      WOW\
      Boot\
      Shell

The duplicate entry is for compatibility with Windows 3.1.  

Regards, Madshi.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
npatelAuthor Commented:
Your detailed answers has given me enough information to get started.

Your on a roll keep it up!.

thanks inthe for your quick answer.

I gave the points to madshi since it involved a lot more information and helped me with my desktop issue as well as been the first to exec.

Still have to try it out,that's just coding anyways, its the idea and knowledgable experiance that counts.
0
MadshiCommented:
Sorry to Barry...   :-(

Thanx to npatel for the points (and the A grade this time... :-)

Regards, Madshi.

P.S: npatel, if you want to start the startmenu&desktop after your program has launched first, you have to switch back to the old shell settings (shell = explorer.exe), THEN start explorer.exe. Then - after the explorer has started - you can restore your special shell settings.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.