4

please help.

PROCESSENTRY32 entry; if (!strcmp(entry.szExeFile, process))

Error on entry: Argument of type WCHAR* is incompatible with parametr of type const char*

Please dont hate me, I am beginer.

Thanks for helping ;)

Dortík
  • 167
  • 1
  • 7

1 Answers1

2

You defined UNICODE in code somewhere or in project settings.

So PROCESSENTRY32 is unicode version, but you use ASCII version of strcmp

The solution is to use another function

#include <wchar.h>
...
if (!wcscmp(entry.szExeFile, process))

or Windows-only ( WinApi function )

#include <windows.h>
...
if (!lstrcmpW(entry.szExeFile, process))

Note that process variable must be wchar_t* or LPWSTR type.

For example:

#include <windows.h>
....

    wchar_t process[] = L"browser.exe"
    ...
    if (!lstrcmpW(entry.szExeFile, process))
Solid Coder
  • 149
  • 9
  • No problem, dont fear to ask. Note that L specificator before string-literal is meaning that string is encoded in unicode. – Solid Coder Jul 02 '16 at 16:29