C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 16th, 2004, 11:05 AM
c++newbie c++newbie is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 3 c++newbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RegOpenKeyEx problem

im having a little problem that i cant figure out, this piece of code
add's the exe (that is being executed) to bootup (dont know how
to call it in english) could somebody please show me how i can set a path to the exe that should be added to bootup instead of
the curent exe that is being executed (since my "instaler" puts
the files in another directory).
help very apreciated !


HKEY hkey;
char *szBuf;
TCHAR buff[255];
DWORD bufflLen = 255;
LPTSTR dirBuff = buff;

GetCurrentDirectory(buffLen, dirBuff);
buffLen = strlen(dirBuff);
if(buffLen > 3)
szBuf = strcat(dirBuff, "\\myprogram.exe");
else
szBuf = strcat(dirBuff, "myprogram.exe");

RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\Currentversion\\Run", 0, KEY_SET_VALUE, &hkey);
RegSetValueEx (hkey, "myprogram", 0, REG_SZ (LPBYTE) szBuf, strlen(szBuf) + 1);
RegCloseKey(hkey);

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > RegOpenKeyEx problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT