/*------------------------------------------------------------------
APP.cpp -- Testing MessageBox function. Muais, 2014 QQ:848506517 --------------------------------------------------------------------*/ #include <windows.h> int WINAPI WinMain( HINSTANCE hInstance, // handle to current instance HINSTANCE hPrevInstance, // handle to previous instance LPSTR lpCmdLine, // command line int nCmdShow // show state ) { MessageBox(NULL,NULL,NULL,MB_RTLREADING|MB_OK); return 0; }
MessageBox
第一个参数是父窗口的句柄,
第二个参数是要显示的消息,
第三个参数是弹出框的标题,
第四个参数是弹出框口的类型,这里有一个叫做MB_TOPMOST的东西可以让弹出窗口置顶。
MessageBox函数的返回值是ID*,*取决于用户是点击了OK、NO,Cancel....这些,如:
if (IDCANCEL==MessageBox(NULL,NULL,NULL,MB_OKCANCEL)) { //To-do, Add your code here }
更详细的内容去看MSDN吧。