问题描述
- DirectX 9.0 Summer 2004 SDK和VC++6.0编程时总是出现问题,怎么办???
-
#define DIRECTINPUT_VERSION 0x0800 //声明DirectX Input的版本是8.0
#ifndef _WIN32_DCOM
#define _WIN32_DCOM
#endif
#define pr printf#pragma once
#define INITGUID //确保INITGUID已被定义
#define INTERFACE IDirectInput8A
#include
#include
#include
#include#pragma comment(lib,"dxguid.lib")
#pragma comment(lib,"DxErr9.lib")
#pragma comment(lib,"dinput8.lib")int main()
{
HRESULT hresult;LPDIRECTINPUT8 lpdi; //DirectInput接口对象指针
LPDIRECTINPUTDEVICE8 Joystick=NULL; //定义指向游戏操纵杆的指针//创建DirectInput接口对象
hresult=DirectInput8Create(
GetModuleHandle(NULL), //应用程序句柄
DIRECTINPUT_VERSION, //DirectInput版本号
&IID_IDirectInput8, //强制类型转换,否则该参数不匹配(#define REFIID const struct GUID const)即一个指向一个常量的指针常量 &
(VOID*)&lpdi,NULL);
if(hresult!=DI_OK)
{pr("创建DirectInput对象失败!n"); return 1;}
else
pr("创建DirectInput对象成功!n");//创建DirectInput设备,
hresult=lpdi->CreateDevice(GUID_Joystick,&Joystick,NULL);
}e:chengxushili手柄按钮shoubingcaozonggan.c(48) : error C2039: 'CreateDevice' : is not a member of 'IDirectInput8A'
d:program filesmicrosoft directx sdk 9.0includedinput.h(2625) : see declaration of 'IDirectInput8A'
Error executing cl.exe.CaoZongGan.obj - 1 error(s), 0 warning(s)
请问大牛们这个程序该怎么修改啊?我这刚开始就出现了错误,纠结中!~~~~~~~
更多 0