Start Program on Startup & Get Program Handle

how do I make program to start on start up except putting it into that folder, like you can click on checkbox and it will start when you start PC everytime untill u uncheck it?

also how do I get handle to program (not window) so I can force to turn it off? like when u go to task manager and processes, u have for example "chrome.exe", I want to make my program end all "chrome.exe" every time someone runs it, how to do that? or minimize it etc, simply get it's handle to HWND so I will be able to SendMessage() to it

1. Add your program path to the following registry key: Software\Microsoft\Windows\CurrentVersion\Run
Use HKCU or HKLM if you want autostart for current user or for all users.

2. Make a snapshot of all processes, iterate through them, compare image file name with your desired name, get a handle to the process and terminate it.


Taking a Snapshot and Viewing Processes:



I will probably will be able the second thing since u posted msdn articles, but how do I do first thing?
thanks! - never used registry keys
Topic archived. No new replies allowed.