[CAutoLoader : Auto launching an app on Windows Startup ] |
Environment: Win 95/98 VC6 SP4
This article describes a class called "CAutoLoader" , it doesn't describe
several companion classes that exist within source code + example project.
These are described in Amir Israeli Web Site
This clss allows your module (library/application/service) be loaded on windows startup.
It does the job by installing an entry with the path to the app within the registry
"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\"
It installs your app path under a unique value name under the proper key:
that will determine the functionality : Run, RunService etc ...
Unique value name will be created by a contatenation of non-null strings describing
" lpszCompany + lpszApplication + lpszModule + lpszVersion" ,The function uses an already
existing function for string concatenation (in CPath) so the value is at directory form
(with \\ between parts).
How to use?
The best method to use that class is to instantiate an object
within the InitInstance() :
Here is the code that does that:
BOOL CDemoAutoLoaderApp::InitInstance() //start init instance { // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. //Here construction of "CAutoLoader" object CAutoLoader m_autoLoader(_T("run"),_T("Amir Israeli"),_T("DemoAutoLoader"),_T("Main"),_T("1.0")); // continue with InitInstance() ... // ...The code :