| mekkatorqu (242) | |
|
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 Thanks! | |
|
|
|
| modoran (1245) | |
|
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. Reference: Taking a Snapshot and Viewing Processes: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686701(v=vs.85).aspx OpenProcess: http://msdn.microsoft.com/en-us/library/windows/desktop/ms684320(v=vs.85).aspx TerminateProcess http://msdn.microsoft.com/en-us/library/windows/desktop/ms686714(v=vs.85).aspx QueryFullProcessImageName: http://msdn.microsoft.com/en-us/library/windows/desktop/ms684919(v=vs.85).aspx | |
|
|
|
| mekkatorqu (242) | |
| I will probably will be able the second thing since u posted msdn articles, but how do I do first thing? | |
|
|
|
| modoran (1245) | |
|
You open the registry key, write desired value and finally close the key. Simple enough, no ? RegOpenKeyEx: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724897(v=vs.85).aspx RegSetValueEx: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724923(v=vs.85).aspx RegCloseKey: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724837(v=vs.85).aspx | |
|
|
|
| mekkatorqu (242) | |
| thanks! - never used registry keys | |
|
|
|