C++ Processentry32
C++ Processentry32
请帮忙。
PROCESSENTRY32 entry;
if (!strcmp(entry.szExeFile, process))
输入错误:WCHAR* 类型的参数与 const char* 类型的参数不兼容
请不要讨厌我,我是新手
感谢您的帮助 ;)
您在某处或项目设置中的代码中定义了 UNICODE。
所以PROCESSENTRY32是unicode版本,但是你用的是ASCII版本的strcmp
解决方法是使用另一个函数
#include <wchar.h>
...
if (!wcscmp(entry.szExeFile, process))
或Windows-仅限(WinApi函数)
#include <windows.h>
...
if (!lstrcmpW(entry.szExeFile, process))
注意process变量必须是wchar_t*或LPWSTR类型。
例如:
#include <windows.h>
....
wchar_t process[] = L"browser.exe"
...
if (!lstrcmpW(entry.szExeFile, process))
请帮忙。
PROCESSENTRY32 entry;
if (!strcmp(entry.szExeFile, process))
输入错误:WCHAR* 类型的参数与 const char* 类型的参数不兼容
请不要讨厌我,我是新手
感谢您的帮助 ;)
您在某处或项目设置中的代码中定义了 UNICODE。
所以PROCESSENTRY32是unicode版本,但是你用的是ASCII版本的strcmp
解决方法是使用另一个函数
#include <wchar.h>
...
if (!wcscmp(entry.szExeFile, process))
或Windows-仅限(WinApi函数)
#include <windows.h>
...
if (!lstrcmpW(entry.szExeFile, process))
注意process变量必须是wchar_t*或LPWSTR类型。
例如:
#include <windows.h>
....
wchar_t process[] = L"browser.exe"
...
if (!lstrcmpW(entry.szExeFile, process))