Sil*_*ght 2 c++ winapi windows-7 visual-studio-2013
这是我在stdafx.h中的代码:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#define _WIN32_WINNT 0x0502
#include "winsock2.h"
#include "windows.h"
#include "stdio.h"
#include "Iphlpapi.h"
#include <psapi.h>
#include "Ntsecapi.h"
#include "txdtc.h"
#include "xolehlp.h"
#include <iostream>
#include <tchar.h>
// TODO: reference additional headers your program requires here
Run Code Online (Sandbox Code Playgroud)
如你所见,我已经包含了"windows.h"
这是主要代码:
#include "stdafx.h"
...
if (hThread && dwRpcssPid == GetProcessIdOfThread(hThread))
...
Run Code Online (Sandbox Code Playgroud)
我的错误是:
'GetProcessIdOfThread':找不到标识符
IntelliSense:标识符"GetProcessIdOfThread"未定义
我该如何解决这些错误?
该_WIN32_WINNT值不适用于小于0x0600AKA的值_WIN32_WINNT_VISTA.如果您以这种方式更改代码,您将获得它的工作:
//#define _WIN32_WINNT 0x0502
#define _WIN32_WINNT 0x0600
Run Code Online (Sandbox Code Playgroud)
该功能从Vista开始,以Vista +为目标,你应该分别定义这个值.
要使用当前SDK定位最新版本的API,您只需包含SDKDDKVer.h,然后为您定义这些值/
//#define _WIN32_WINNT 0x0502
#include <SDKDDKVer.h>
Run Code Online (Sandbox Code Playgroud)
也可以看看: