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 时出错.
请高手指点改如何修改才能通过编译!!!!

解决方案 »

  1.   

    fatal error C1004: unexpected end of file found 很有可能在你工程的文件 InputMessage.cpp 的设置属性中的预编译选项中选中不包括afx*** 那个头文件
      

  2.   

    源代码如下:
    #include "stdafx.h"
    #include <windows.h>
    dllimport("USER32.DLL")
    int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
    {
    INPUT kbinput[3];
    ZeroMemory( &kbinput, sizeof(INPUT)*3 ); kbinput[0].type = INPUT_KEYBOARD;
    kbinput[0].ki.wVk = VK_LWIN; kbinput[1].type = INPUT_KEYBOARD;
    kbinput[1].ki.wVk = 'D'; kbinput[2].type = INPUT_KEYBOARD;
    kbinput[2].ki.wVk = VK_LWIN;
    kbinput[2].ki.dwFlags = KEYEVENTF_KEYUP; SendInput( 3, kbinput, sizeof(INPUT) );
    return 0;
    }
      

  3.   

    dllimport("USER32.DLL") 
    改为:
    #pragma comment(lib, "user32.lib")
      

  4.   

    还有包含对应的头文件,诸如Input之类的类型在哪定义的都不知道
      

  5.   

    ZeroMemory( kbinput, sizeof(INPUT)*3 ); 
      

  6.   

    问题已解决!
    在头文件中加上:<winable.h>