By the way, with a few modification, this can be made to work for VC and III!
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:
printf("Wbem succesfully initialized\n");
printf("Wbem could not be initialized\n");
HANDLE hProc = findGTASAProcess();
printf("Result of findGTASAProcess call: %u\n", hProc);
if(getchar() == 'x') break;
(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!