一个编译错误问题! 超级编译错误难题!!  楼主跪求答案!!!
====================================================
问题如下:
编译错误!
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;
}

解决方案 »

  1.   

    dllimport("USER32.DLL") 这个语句注释掉
      

  2.   

    在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_)
      

  3.   

    // 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; 
      

  4.   

    谢谢大家,问题已解决!
    加上头文件:<winable.h>