1、windows.hMessageBox 弹框 #include stdio.h#include windows.hint main(){//说明:n表示弹框点击按钮的返回的数字。第四个参数表示弹框样式(0~6)int n = MessageBox(0,内容,标题,6);return 0;}WinEx...

1、windows.h
-
MessageBox 弹框
#include <stdio.h> #include <windows.h> int main() { //说明:n表示弹框点击按钮的返回的数字。第四个参数表示弹框样式(0~6) int n = MessageBox(0,"内容","标题",6); return 0; }
-
WinExec / ShellExecute 执行、打开
#include <stdio.h> #include <windows.h> int main() { //打开Xshell软件 WinExec("D:\\java\\Xshell\\Xshell.exe",1); ShellExecute(0,"open","D:\\java\\Xshell\\Xshell.exe",0,0,1); //打开百度 ShellExecute(0,"open","http://www.baidu.com",0,0,1); return 0; }
-
FindWindow 查找窗口
#include <stdio.h> #include <windows.h> int main() { HWND h;//定义一个窗口句柄变量,用以存储找到的窗口句柄 h = FindWindow(NULL,"a.txt - 记事本");//获得窗口名为"a.txt - 记事本"的窗口句柄 SendMessage(h,WM_CLOSE,0,0);//调用SendMessage函数,发送一个WM_CLOSE(关闭)消息给wnd窗口句柄。 return 0; }
-
GetCursorPos 获取鼠标坐标
#include <stdio.h> #include <windows.h> int main() { POINT curpos;//一个可以存储点坐标的结构体变量 while (true) { GetCursorPos(&curpos);//获取鼠标位置 printf("%d,%d\n", curpos.x, curpos.y);//打印坐标 Sleep(1000);//睡眠1s } return 0; }
织梦狗教程
本文标题为:C语言标准库总结,用作平时不断总结...


基础教程推荐
猜你喜欢
- C++实现ETW进行进程变动监控详解 2023-05-15
- C++实战之二进制数据处理与封装 2023-05-29
- centos 7 vscode cmake 编译c++工程 2023-09-17
- C语言编程C++旋转字符操作串示例详解 2022-11-20
- [C语言]二叉搜索树 2023-09-07
- C语言实现宾馆管理系统课程设计 2023-03-13
- 带你深度走入C语言取整以及4种函数 2022-09-17
- C语言 详解字符串基础 2023-03-27
- 全面了解C语言 static 关键字 2023-03-26
- [c语言-函数]不定量参数 2023-09-08