/*

   win环境下system("")函数的作用就是把字符串输入进cmd

  例如system("echo for example")就和std::cout << "for,example";的作用相同。

  至于有多少个选项可以试试system("help") 这将会输出所有cmd命令

*/

 

#include "stdafx.h"

#include <Windows.h>

int _tmain(int argc, _TCHAR* argv[])

{

   Beep(900,1000);//系统鸣铃,第一个参数是频率,第二个参数是鸣铃时间长短

   Sleep(1000);

   //MessageBox(0,0,0,0);

 

  

 

  //******不过system(namerelease情况下却提示没有定义

   //system("start");//调出cmd命令窗口

    //system("calc");//调出系统计算器

    //system("mspaint");//调出系统画图软件

    //system("control");//调出系统控制面板

     //system("notepad");//调出系统记事本

    //system("services.msc");//调出服务面板

     //system("SoundRecorder");

     //system("narrator");

 

 

    system("echo for example");//输出for example

return 0;

}

 

 

                        打开一个对话框

 

#include "stdafx.h"

#include <Windows.h>

#include<iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

   cout << "Hellow C++" << endl;

 

//弹出一个对话框函数,第一个参数为副窗口一般写NULL,第二个参数是消息的内容,第三个参数是标题,第四个参数是按钮(常量)

MessageBox(NULL, TEXT("Hellow C++"), TEXT("标题"), MB_OK);

 

system("pause");

return 0;

}





运行如下


Window.h部分函数功能

 

 

 

 

相关文章: