Computing.Net > Forums > Programming > C++ WinAPI Startup

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

C++ WinAPI Startup

Reply to Message Icon

Name: BatchFreak
Date: April 13, 2009 at 20:32:35 Pacific
OS: Linux i686
CPU/Ram: 1.8ghz/ 512 mb
Product: Dell / OPTIPLEX
Subcategory: C/C++
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: April 14, 2009 at 08:22:47 Pacific
Reply:

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


0

Response Number 2
Name: BatchFreak
Date: April 14, 2009 at 08:25:08 Pacific
Reply:

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.


0

Response Number 3
Name: Razor2.3
Date: April 14, 2009 at 08:32:18 Pacific
Reply:

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.


0

Response Number 4
Name: BatchFreak
Date: April 14, 2009 at 08:36:44 Pacific
Reply:

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.


0

Response Number 5
Name: Razor2.3
Date: April 14, 2009 at 08:44:24 Pacific
Reply:

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.


0

Related Posts

See More



Response Number 6
Name: BatchFreak
Date: April 14, 2009 at 10:10:29 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Map Network Drive Back to... Lose Internet connection



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C++ WinAPI Startup

C++ Application StartUp www.computing.net/answers/programming/c-application-startup-/4662.html

Please Help :) www.computing.net/answers/programming/please-help-/8675.html

Dialog Problems in WINAPI C++ www.computing.net/answers/programming/dialog-problems-in-winapi-c/568.html