我新建了一个Window Application并加入一个cpp文件
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lPcmdLine,
   int nShowCmd)

MessageBox(NULL,"WRONG","DD",MB_OK);//WRONG
return 1;

为什么MessageBox用不起来.大家可以试一下!很简单的

解决方案 »

  1.   

    主窗口尚未建立,不能用MessageBox
      

  2.   


    #include <windows.h>int APIENTRY WinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPSTR     lpCmdLine,
                         int       nCmdShow)
    {
      // TODO: Place code here. MessageBox(NULL,"WRONG","DD",MB_OK);//WRONG

    return 0;
    }
      

  3.   

    unresolved external symbol __imp__MessageBoxA@16
      

  4.   

    因为你直接使用MessageBox,编译器以为你调用的是CWnd或者CWindow的MessageBox()而你的代码并非MFC程序
      

  5.   

    #include "stdafx.h"#include <windows.h>int APIENTRY WinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPSTR     lpCmdLine,
                         int       nCmdShow)
    {
    // TODO: Place code here.

    MessageBox(NULL,"WRONG","DD",MB_OK);//WRONG

    return 0;
    }