我正在编写一个生成模拟用户输入的程序,并创建了一个类来执行此操作。当我尝试使用 gcc 在 code::blocks 中构建它时,它会抛出一个错误,提示“错误:'INPUT'没有命名类型”。有人可以解释为什么我会收到此错误。下面是发生错误的头文件
#ifndef INPUTSIMULATOR_H
#define INPUTSIMULATOR_H
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#include <Winuser.h>
enum type{KEYBOARD,MOUSE};
enum button{LEFT,RIGHT,MIDDLE};
class inputSimulator
{
public:
inputSimulator(type _inputType);
virtual ~inputSimulator();
int generateKeyEvent (int vk);
int generateMouseButtonDown(button eventType);
int generateMouseButtonUp(button eventType);
int generateMouseMovement(int dy, int dx);
protected:
private:
INPUT input; //error occurs here
type inputType;
};
#endif
编辑:我发现了相同问题的另一个实例,但没有解决方案。https://stackoverflow.com/questions/7222529/input-structure-in-simulating-actions-in-winapi