得到桌面上所有打开窗口的标题(方法二)
来源:互联网 发布:c语言怎么定义一个数组 编辑:程序博客网 时间:2024/05/22 09:41
BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lparam)
{
// 方法一:
//BOOL bRval ;
CString text ;
CString m_strTitle ;
LPWSTR lpwstr = NULL ;
lpwstr = new WCHAR[256];
//memset( lpwstr , 0 , 256 ); //用这个不对
//bRval = FALSE;
GetWindowText( hwnd ,lpwstr , 256 );
m_strTitle = (LPCTSTR)lpwstr;
lparam = (LPARAM)lpwstr;
if( -1 != m_strTitle.Find( TEXT("Microsoft Word")) ){
text.Format( TEXT( "word的标题为/"%s/"" ) ,m_strTitle);
AfxMessageBox(text) ;
//return TRUE ;
//bRval = TRUE;
}
return TRUE ; // 必须返回真,否则只检查一个窗口就停止
//return bRval;
/*
// 方法二
CString text;
char lpWinTitle[256];
::GetWindowText(hwnd,(LPWSTR)lpWinTitle ,256-1);
CString m_strTitle;
m_strTitle.Format( TEXT("%s") ,lpWinTitle);
if( m_strTitle.Find( TEXT("Microsoft Word")) != -1 ){
text.Format( TEXT( "word的标题为/"%s/"" ),lpWinTitle);
AfxMessageBox(text) ;
}
return TRUE ;
*/
}
void CshareFileDlg::OnBnClickedButtonShare()
{
LPARAM lparam ;
LPCTSTR lpctstr;
lparam = NULL;
lpctstr = NULL;
lpctstr = new TCHAR[256];
if( EnumWindows( EnumWindowsProc, NULL) ){
lpctstr = (LPCTSTR)lparam;
AfxMessageBox( lpctstr );
} else{
AfxMessageBox( TEXT( " no word had been opened" ) );
}
}
{
// 方法一:
//BOOL bRval ;
CString text ;
CString m_strTitle ;
LPWSTR lpwstr = NULL ;
lpwstr = new WCHAR[256];
//memset( lpwstr , 0 , 256 ); //用这个不对
//bRval = FALSE;
GetWindowText( hwnd ,lpwstr , 256 );
m_strTitle = (LPCTSTR)lpwstr;
lparam = (LPARAM)lpwstr;
if( -1 != m_strTitle.Find( TEXT("Microsoft Word")) ){
text.Format( TEXT( "word的标题为/"%s/"" ) ,m_strTitle);
AfxMessageBox(text) ;
//return TRUE ;
//bRval = TRUE;
}
return TRUE ; // 必须返回真,否则只检查一个窗口就停止
//return bRval;
/*
// 方法二
CString text;
char lpWinTitle[256];
::GetWindowText(hwnd,(LPWSTR)lpWinTitle ,256-1);
CString m_strTitle;
m_strTitle.Format( TEXT("%s") ,lpWinTitle);
if( m_strTitle.Find( TEXT("Microsoft Word")) != -1 ){
text.Format( TEXT( "word的标题为/"%s/"" ),lpWinTitle);
AfxMessageBox(text) ;
}
return TRUE ;
*/
}
void CshareFileDlg::OnBnClickedButtonShare()
{
LPARAM lparam ;
LPCTSTR lpctstr;
lparam = NULL;
lpctstr = NULL;
lpctstr = new TCHAR[256];
if( EnumWindows( EnumWindowsProc, NULL) ){
lpctstr = (LPCTSTR)lparam;
AfxMessageBox( lpctstr );
} else{
AfxMessageBox( TEXT( " no word had been opened" ) );
}
}
- 得到桌面上所有打开窗口的标题(方法二)
- 得到桌面上所有打开窗口的标题
- 桌面上的所有窗口最小化
- 获取所有打开的窗口的标题
- 遍历Windows桌面上所有窗口
- 得到窗口的句柄方法
- 窗口的打开方法
- 得到所有窗口
- 获得当前打开的窗口标题
- 捕捉桌面上的窗口信息
- 飞鸽传书 桌面上常见的窗口:
- 捕捉桌面上的窗口信息
- 枚举当前打开的所有窗口
- 枚举当前打开的所有窗口
- Java反射机制(得到类的所有方法)
- 各种得到窗口句柄的方法
- 得到窗口句柄的几种方法
- 用SendInput发送Win+D使桌面上所有窗口最小化
- VS2005中的JS脚本调试
- 个人试做了C#关于以面向对象的方式操作数据库的插件 希望多给点建议................
- 感恩的心
- Java 位运算符
- C语言switch语句的汇编语言实现
- 得到桌面上所有打开窗口的标题(方法二)
- HOOK全局键盘钩子
- 四核Q8200、双核E5200、单核赛扬450发布
- 思科路由过滤命令详细解说
- Agile Java Development with Spring, Hibernate and Eclipse
- Dns in Action: A Detailed And Practical Guide to Dns Implementation, Configuration, And Administrati
- 在C#应用中,设计自己的配置文件
- Professional .NET Framework 2.0
- Sams Teach Yourself Object Oriented Programming in 21 Day