非 “超级”之 高手不能解决的问题!!!

skyair624 2008-05-25 08:59:27
一个编译错误问题! 超级编译错误难题!! 楼主跪求答案!!!
====================================================
问题如下:
编译错误!
C:\Documents and Settings\Administrator\桌面\InputMessage\InputMessage.cpp(34) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
C:\Documents and Settings\Administrator\桌面\InputMessage\InputMessage.cpp(34) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.

源代码================================================
#include "stdafx.h"
#include <windows.h>
dllimport("USER32.DLL")
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
INPUT kbinput;
ZeroMemory( &kbinput, sizeof(INPUT) );

kbinput.type = INPUT_KEYBOARD;
kbinput.ki.wVk = VK_LWIN;

SendInput( 3, kbinput, sizeof(INPUT) );
return 0;
}


...全文
160 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
skyair624 2012-05-16
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 的回复:]

这是非“超级”之高手不能遇到的问题,我在另一帖子里回复了。
[/Quote]

哥们很搞,这么多年了,多谢你
cnzdgs 2008-05-26
  • 打赏
  • 举报
回复
// stdafx.h
#pragma once
#define _WIN32_WINNT 0x0500
#include <windows.h>
// ……

// InputMessage.cpp
#include "stdafx.h"
#pragma comment(lib, "user32.lib")
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
INPUT kbinput;
ZeroMemory( &kbinput, sizeof(INPUT) );
kbinput.type = INPUT_KEYBOARD;
kbinput.ki.wVk = VK_LWIN;
SendInput( 3, &kbinput, sizeof(INPUT) );
return 0;
}
vocanicy 2008-05-26
  • 打赏
  • 举报
回复
在stdafx.h中的#include <windows.h>前面加一句#define _WIN32_WINNT 0x0500

因为只有WIN98以后版本的操作系统才支持这个函数



#include "stdafx.h"

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
INPUT kbinput;
ZeroMemory( &kbinput, sizeof(INPUT) );

kbinput.type = INPUT_KEYBOARD;
kbinput.ki.wVk = VK_LWIN;

SendInput(3, &kbinput, sizeof(INPUT) );
return 0;
}




// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers

#define _WIN32_WINNT 0x0500

#include <windows.h>


// TODO: reference additional headers your program requires here

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
jameshooo 2008-05-26
  • 打赏
  • 举报
回复
你需要的是合适的头文件
gulunhua 2008-05-26
  • 打赏
  • 举报
回复
先帮你顶啊!
stivenjia 2008-05-26
  • 打赏
  • 举报
回复
#pragma comment(lib,"user32")
skyair624 2008-05-26
  • 打赏
  • 举报
回复
注释掉了还要加什么语句呢??
编译不过!!!
wxk566 2008-05-26
  • 打赏
  • 举报
回复
test...
skyair624 2008-05-26
  • 打赏
  • 举报
回复
谢谢大家,问题已解决!
加上头文件:<winable.h>
jameshooo 2008-05-26
  • 打赏
  • 举报
回复
dllimport("USER32.DLL") 这个语句注释掉
cnzdgs 2008-05-25
  • 打赏
  • 举报
回复
这是非“超级”之高手不能遇到的问题,我在另一帖子里回复了。
  • 打赏
  • 举报
回复
INPUT 是啥东西?

15,466

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧