有用的C/C++的Windows操作

有用的C/C++的Windows操作

Windows.h库

示例

#include<stdio.h>
 
#include<windows.h>
 
void main()
 
{
 
         printf("helloworld");
 
         //第一个参数为0,表示依赖的窗口的编号,设为0就是系统弹出的;第二个参数是对话框的内容,第三个是对话框的标题,第四个是对话框的类型,设为0就可
 
         MessageBox(0,"nihao", "helloll", 0);
 
         //c语言下双斜杠代表一个斜杠
 
         //打开文件
 
         //ShellExecute(0,"open", "E:\\1.txt", 0, 0, 1);
 
         //打开文件
 
         //ShellExecute(0,"open", "http://www.baidu.com", 0, 0, 1);
 
         //打开可执行件
 
         //ShellExecute(0,"open", "C:\\Program Files (x86)\\SublimeText3\\sublime_text.exe", 0, 0, 1);
 
         //打开系统自带文件,不需要注明路径
 
         //ShellExecute(0,"open", "notepad", 0, 0, 1);
 
         //将文件内容打印到控制台
 
         //ShellExecute(0,"print", "E:\\1.txt", 0, 0, 1);
 
         //打开文件夹
 
         //ShellExecute(0,"open", "c:\\Document\\", 0, 0, 1);
 
         //ShellExecute(0,"open", "c:\\", 0, 0, 6);
 
         //调用邮件工具
 
         //ShellExecute(0,"open", "mailto", 0, 0, 1);
 
         //想某个地址发邮件
 
         //ShellExecute(0,"open", "mailto:xxx@xxx.com", 0, 0, 1);
 
         getchar();
 
}
posted @ 2024-04-20 02:18  8o1er9t  阅读(6)  评论(0编辑  收藏  举报