Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run an Application on windows start up in win32 API using visual c++

I have a Window (win32 API) Application in visual c++. I am not using MFC. I have to run my application on windows start up. I am using windows 7 and visual studio 2008. Can any one help me out in achieving the above task? Thanks in advance.

like image 876
Ravi shankar Avatar asked Nov 12 '09 15:11

Ravi shankar


1 Answers

Here's some example code:

HKEY hkey = NULL;
RegCreateKey(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", &hkey);
RegSetValueEx(hkey, L"myapp", 0, REG_SZ , (BYTE*)path, (wcslen(path)+1)*2);
like image 199
mxcl Avatar answered Nov 02 '22 23:11

mxcl