VC获得控制台HWND GetConsoleHwnd
2024-08-24 21:28:45
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
HWND hwndFound; // This is what is returned to the caller.
char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated
// WindowTitle.
char pszOldWindowTitle[MY_BUFSIZE]; // Contains original
// WindowTitle. // Fetch current window title. GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE); // Format a "unique" NewWindowTitle. wsprintf(pszNewWindowTitle,"%d/%d",
GetTickCount(),
GetCurrentProcessId()); // Change current window title. SetConsoleTitle(pszNewWindowTitle); // Ensure window title has been updated. Sleep(40); // Look for NewWindowTitle. hwndFound=FindWindow(NULL, pszNewWindowTitle); // Restore original window title. SetConsoleTitle(pszOldWindowTitle); return(hwndFound);
}
最新文章
- Python自动化之模板继承和cookie
- [css]我要用css画幅画(八) - Hello Kitty
- 关于js中的时间处理
- 【cpp】Vector
- 人生导师——如何学习C++的Windows方向
- 启动页面设置,icon图标设置
- C#文件读写常用类介绍
- JBPM学习(六):详解流程图
- linux系统中.bashrc的妙用
- HTTP连接池
- Pandas 基础(12) - Stack 和 Unstack
- 48-Python 安装pyautogui失败解决办法
- gist.github.com 被墙无法访问解决办法
- sqlserver数据库导出成insert语句
- Struts2初学 Struts2在Action获取内置对象request,session,application(即ServletContext)
- MySQL Binlog解析(1)
- March 2 2017 Week 9 Thursday
- win10子系统Ubuntu18.04下安装图形界面
- 8. sql 片段
- Python函数(1)
热门文章
- 所有依赖的jar将提取到lib目录
- Mysql Federated Server 示例
- vue开发关于微信授权登录以及路由mode模式(Hash|History)和手机平台(andriod|IOS)不得不说的故事
- [hdu3934] 凸包 旋转卡壳
- ZOJ 3953 Intervals
- [转]如何在 JS 代码中消灭 for 循环
- lambda 表达式+python内置函数
- (转)Ubuntu 16.04 安裝Docker(PS:本文适用amd64位的ubuntu系统)
- margin padding 图
- Scrapy学习篇(三)之创建项目