谁能帮我做一个简单的C++程序

来源:百度知道 编辑:UC知道 时间:2024/06/15 13:51:20
我这个程序就是用MessageBox这个API弹出一个对话框就行了
请写出源码 不要说方法 我自己研究你的源码
请问二楼 能不能隐藏CMD的窗口

#include <windows.h>
int main()
{
::MessageBox(NULL, "love依依", "17", MB_OK);

return 0;

}

----------------------------------------------------

可以啊 vc6下用int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)就可以了

修改如下:

#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
::MessageBox(NULL, "love依依", "17", MB_OK);

return 0;

}

编译方式就换成windows ,compile后点击工程---设置---连接----在工程选项中的参数subsystem:console改为subsystem:windows就可以了~

MessageBox("hello");弹出一个对话框,且对话框的内容为“hello”

win32 application {a simple application }就可以了