Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to load program run at start up 2

Status
Not open for further replies.

aidanz

Programmer
Sep 15, 2003
1
NZ
Hi,

Could you show me how to load a Visual C++ program run at start up, example Webshots or Norton Antivirus

Thanks,

aidanz
 
put the path in:

XX:\Documents and Settings\YourUserName\Start Menu\Programs\Startup

where XX is disk where windows is installed.

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
>> Could you show me how to load a Visual C++ program run at start up

Depends on how you define startup. On Windows NT and greater systems, NT Services will be started before any user logs onto the machine. Putting a file in a users startup folder will not accomplish the same result.

-pete
 
Hey u asked it in VC++........
so i think u want to programmatically load your prog in StartUp
one trick is what palbano suggested to U.
Other is, You can add your application file (.EXE with args) in registry key.
The key is HKCU/SoftWare/Microsoft/Windows/Current Version/Run.
Add your app path in this key.
So that your app will run every time a user logs on.
If u want the app to run for all users including the default one, then add the Registry key to HKEY_LOCAL_MACHINE (HKLM) instead of HKEY_CURRENT_USER.

I think this would be a beeter approch.
 
>bosonsbo
good answer

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
This code help u to run ur program at the start up.... ;)
void RunAtStartUp()
{
HKEY Regentry ;
char szBuffer[MAX_PATH];
DWORD dispos;

GetModuleFileName(NULL,szBuffer,MAX_PATH);
RegCreateKeyEx (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0,NULL,REG_OPTION_NON_VOLATILE,

KEY_CREATE_SUB_KEY | KEY_ALL_ACCESS, NULL, &Regentry, &dispos) ;
RegSetValueEx ( Regentry, "Run_at_startup", 0, REG_SZ, ( const BYTE* ) (LPCTSTR ) szBuffer, sizeof(szBuffer)) ;
RegCloseKey ( Regentry );
}

ravindraj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top