[email protected] Posted January 29, 2007 Share Posted January 29, 2007 Hey all, I've made a few little C++ functions to check if SA's process is running, this does not only do a check on its window, but it also does a check if the program "gta_sa.exe" is running, by using Wbem/WMI. I don't know for which versions of Windows it works, it works for Window XP, I think it will work Windows 2000 as well, and maybe it works for Windows 98/Me, but I can't check that. By the way, with a few modification, this can be made to work for VC and III! findsa.cpp findsa.h How to use it: First, call InitializeWbem to initialize all the COM-objects (this takes quite long, 1 or 2 seconds). After that, you can call getGTASAPID and findGTASAProcess as often as you want. After you're finished, call UninitializeWbem to release the COM-objects. Here's a simple program demonstrating its usage: #include "findsa.h"#include <stdio.h>int main(){if(InitializeWbem()){ printf("Wbem succesfully initialized\n");}else{ printf("Wbem could not be initialized\n");}for (;{ HANDLE hProc = findGTASAProcess(); printf("Result of findGTASAProcess call: %u\n", hProc); CloseHandle(hProc); if(getchar() == 'x') break;}UninitializeWbem();return 0;} (Press x and then Enter to quit) You may use it freely in all of your programs, and if you'd credit me, that'd be great! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now