Need help with this.

Well im new in all this, i need help with this code..

i wanted to do, if the process is open, print something in console.

But when i do that it says something like.

Error: argument of type "const wchar_t * is incompatible with parameter of type "LPCSTR"


Heres a photo of it: http://prntscr.com/4uduas

1
2
3
4
5
6
7
8
9
10
11
12
13
bool isRunning(LPCSTR pName);

if (isRunning(L"iw3mp.exe") = true) {

	Sleep(3000);

printf (" Found iw3mp.exe!\n");

	Sleep(500);	

printf (" Injection successful!\n");

	Sleep(1000);


Thanks in advance.
Last edited on
Line3: The problem is the L in front of "iw3mp.exe". That is what the const wchar_t * 'creates'.
So remove the L

By the way: if (isRunning(L"iw3mp.exe") = true) // Note: = assign -> == compare
It is not necessary to compare with bool since this is what if does itself
Well it worked but now i have some issues, once i run it it does it quick, is not waiting till the process is opened.

http://prntscr.com/4up7u3
You can use a loop to wait until iw3mp starts.

1
2
3
4
5
6
7
8
9
10
// bool isRunning(...)

// let's wait until it starts
for (; !isRunning("iw3mp.exe"); Sleep(3000));

// other staffs
printf("Found iw3mp.exe!\n");
Sleep(500);
printf("Injection successful!\n");
Sleep(1000);
Topic archived. No new replies allowed.