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++ const 成员函数,返回一个 const 指针.但是返回的指针是什么类型的 const? 2022-10-11
- C语言手把手带你掌握带头双向循环链表 2023-04-03
- Easyx实现扫雷游戏 2023-02-06
- ubuntu下C/C++获取剩余内存 2023-09-18
- 我应该为我的项目使用相对包含路径,还是将包含目录放在包含路径上? 2022-10-30
- C++ 数据结构超详细讲解顺序表 2023-03-25
- C语言详解float类型在内存中的存储方式 2023-03-27
- C语言qsort()函数的使用方法详解 2023-04-26
- Qt计时器使用方法详解 2023-05-30
- 详解C语言中sizeof如何在自定义函数中正常工作 2023-04-09
