Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am making a program to monitor my system and upload logs to an ftp server everyday at 1200, I have it all down pat except how to make it auto run if say: the power goes off? It will be on a windows vista AND a windows xp pc, I could do the thing with the startup folder, but I hate bloating that up, in fact I hate bloat quite a bit. Can anyone tell me how to use the following code snippet to run my program on bootup?
It is C++ and as you can see is not any where near being finished. I have the proper headers included
LONG WINAPI RegCreateKeyEx( HKEY_LOCAL_MACHINE,Software\Microsoft\Windows\CurrentVersion\Run , 0, NULL, REG_OPTION_NON_VOLATILE 0x00000000L, KEY_ALL_ACCESS (0xF003F), NULL, REG_CREATED_NEW_KEY 0x00000001L ); LONG WINAPI RegSetValueEx( HKEY_LOCAL_MACHINE, __in_opt LPCTSTR lpValueName, 0, __in DWORD dwType, __in_opt const BYTE *lpData, __in DWORD cbData ); RegCloseKey();I only Batch if possible, 2000 more lines of code, oh well.

You could try using the Task Scheduler; that's what it's there for, after all. MSDN even has an example.

heh,i cant get winapi working, and you point me to something longer? -_-'
I only Batch if possible, 2000 more lines of code, oh well.

Yes, because you need to learn the C++ style, which is incomparably different to batch script style. If it weren't for ulterior motives, I wouldn't have any motivation at all.
Add that to the fact that I provided a working example, and you can have it working by the end of the day.

sure: If i wasn't trying to keep this short and sweet -_- thats like 100 lines of code instead of three needed with the WinApi,
ps. I havent used batch in like two years or so, its just my name on CN
I only Batch if possible, 2000 more lines of code, oh well.

Bah, two-thirds of it is error checking, and like, one-sixth of it is comments. It also acquires permissions, so it should work on UAC enabled Vista.
Also, I saw your previous piece of "c++" code.

lol i know that was horrible right? That was my first piece of code in C++, i never said i had been doing C++ for the past few years lol, i just said i hadnt used batch in that long :p
and this one will only have to run once, I am pretty sure i can click on the UAC popup one or *six* times :p
I only Batch if possible, 2000 more lines of code, oh well.

![]() |
Map Network Drive Back to...
|
Lose Internet connection
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |