问题描述
GetProcessHandle.cpp(49):errorC2065:'OpenThread':undeclaredidentifierC:/GetProcessHandle.cpp(49):errorC2440:'=':cannotconvertfrom'int'to'void*'为什么会编译错误?请帮帮我,我是VC新手。符代码#include<Windows.h>#include<stdio.h>//FunctioncodedbyViscountPhergetHANDLEGetProcessHandle(boolthread,DWORDdesired_access,BOOLinherit_handle,DWORDidentifier){HANDLEhandle_token;HANDLEhandle;if(OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&handle_token)==0){return0;}TOKEN_PRIVILEGESprivileges_token;LUIDidentifier_locally_unique;TOKEN_PRIVILEGESprivileges_token_previous;DWORDprivileges_token_previous_size;if(LookupPrivilegeValue(0,SE_DEBUG_NAME,&identifier_locally_unique)==0){return0;}privileges_token.PrivilegeCount=1;privileges_token.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED;privileges_token.Privileges[0].Luid=identifier_locally_unique;AdjustTokenPrivileges(handle_token,0,&privileges_token,sizeof(privileges_token),&privileges_token_previous,&privileges_token_previous_size);if(GetLastError()!=ERROR_SUCCESS){return0;}privileges_token.Privileges[0].Attributes=privileges_token_previous.Privileges[0].Attributes;if(thread){handle=OpenThread(desired_access,inherit_handle,identifier);(OpenThread错误?)}else{handle=OpenProcess(desired_access,inherit_handle,identifier);}AdjustTokenPrivileges(handle_token,0,&privileges_token,sizeof(privileges_token),0,0);if(GetLastError()!=ERROR_SUCCESS){return0;}returnhandle;}
解决方案
解决方案二:
在线等,急啊
解决方案三:
VC6.0的windows.h中没有OpenThread的定义。你需要使用新版SDK中的头文件,或者换VC2005等新版。
解决方案四:
rpwt=====songkimsongkimsongkim等级:Blank结帖率:0%
解决方案五:
erroeC2065:'OpenThread':要在项目属性里边设置线程errorC2440:是函数写错了,检测一下函数的类型,是不是不一致。