枫林牧歌 2014-07-18 06:55
浏览 1073

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\手柄按钮\shoubing\caozonggan.c(48) : error C2039: 'CreateDevice' : is not a member of 'IDirectInput8A'
d:\program files\microsoft directx sdk 9.0\include\dinput.h(2625) : see declaration of 'IDirectInput8A'
Error executing cl.exe.

CaoZongGan.obj - 1 error(s), 0 warning(s)

请问大牛们这个程序该怎么修改啊?我这刚开始就出现了错误,纠结中!~~~~~~~
更多 0

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器