我想在控制台程序中使用Messagebox函数,我该怎么做呢?

解决方案 »

  1.   

    自己包含头文件,链接相应的lib,具体请查看MSDN的相关函数说明。
      

  2.   

    //Helloworld! #include<windows.h> int WINAPI(HINSTANCE hInstance,HINSTANCE hPrevInstance,PSTR szCmdLine,int iCmdShow) {   MessageBox(NULL,TEXT("Hello world!"),TEXT("HelloMsg"),0);   return 0; } 
      

  3.   

    任何地方: AfxMessageBox("here is a bug! oy!");
    任何地方:        ::MessageBox(NULL, "abc!", _T("attention"), MB_OKCANCEL ) == IDOK )
    窗口类下: MessageBox("Unable to ...");
      

  4.   

    #include <iostream>
    #include<windows.h>using namespace std;int main(void)
    {
    ::MessageBox(NULL, "你好,楼主。", ("标题"),MB_OKCANCEL);
    return 0;
    }
      

  5.   

    Function Information:
    Header Declared in   Winuser.h, include Windows.h 
    Import library       User32.lib 
      

  6.   

    #include <Windows.h>
    #pragma comment(lib,"User32")
      

  7.   

    六楼的大哥,你的这句好象是.net上的吧
    using namespace std;
    我看这样也行啊
    #include <iostream>
    #include<windows.h>int main(void)
    {
        ::MessageBox(NULL, "你好,楼主。", ("标题"),MB_OKCANCEL);
        return 0;
    }
      

  8.   

    Console 工程向导中选 支持MFC(大概是这么说,最后一步)
      

  9.   

    4楼的大哥,你看看你的代码是否有问题呢?
    任何地方: AfxMessageBox( "here   is   a   bug!   oy! ");
    任何地方: ::MessageBox(NULL,   "abc! ",   _T( "attention "),   MB_OKCANCEL   )   ==   IDOK   )
    窗口类下: MessageBox( "Unable   to   ... "); 
    具体该怎么用,我还不懂呢?
    你教教我怎么使用你的代码!好吗?