[译]窗口隐藏
By robot-v1.0
本文链接 https://www.kyfws.com/applications/window-unhidder-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 2 分钟阅读 - 974 个词 阅读量 0[译]窗口隐藏
原文地址:https://www.codeproject.com/Articles/13062/Window-Unhidder
原文作者:JJimenezShaw
译文由本站 robot-v1.0 翻译
前言
A utility to list and hide/unhide all application windows.
列出和隐藏/取消隐藏所有应用程序窗口的实用程序.
介绍(Introduction)
该程序允许用户隐藏-取消隐藏系统上正在运行的任何窗口.它还提供有关程序活动的有趣信息.许多程序使用隐藏的窗口,有时可能会导致问题.使用WindowUnhidder,您可以隐藏-取消隐藏,启用/禁用任何窗口,以及获取有关进程,标题,类,父窗口,执行路径等的信息.(This program allows the user to hide-unhide any window that is running on the system. It also gives interesting information about programs' activities. Many programs use hidden windows, that sometimes may cause problems. With WindowUnhidder, you can hide-unhide, enable/disable any window, and get information about process, title, class, parent window, exec path, etc.)
背景(Background)
该程序的首要目标是查找并取消隐藏某些窗口.完成后,我发现显示我可以获得的所有信息可能会很有用.(The first aim of this program was to find and unhide some windows. Once done, I saw that it could be useful to show all info I can get.)
使用代码(Using the code)
该程序可以使用了.大部分代码在类中(The program is ready for use. Most part of the code is in the class) CWindowUnhidderDlg
.我知道可以实现更多的类,但是一开始它只是一个小应用程序,因此没有必要.(. I know that some more classes could be implemented, but at the beginning it was a little app, and it was not necessary.)
搜索窗口的部分代码如下所示:(The part of the code where windows are searched for is shown here:)
//
// search windows:
char title[512], titlepadre[512], clase[100];
HWND mWnd = NULL;
HWND mWndPad = NULL;
HWND mWndSys = NULL;
mWnd = ::FindWindowEx(NULL,mWnd,NULL,NULL);
int ii=0;
while ( mWnd )
{
::GetWindowText(mWnd, title, 256);
::GetClassName(mWnd, clase, 100);
CString vis = ::IsWindowVisible(mWnd)?'1':'0';
CString ena = ::IsWindowEnabled(mWnd)?'1':'0';
CString Cadena = "";
mWndPad = mWnd;
CString TitPad = "";
memset(titlepadre,0,512);
do
{
mWndPad = ::GetParent(mWndPad);
if (mWndPad)
if(m_ParentHandler.GetCheck()!=0)
sprintf(titlepadre,"#%X",mWndPad);
else
::GetWindowText(mWndPad, titlepadre, 256);
TitPad = titlepadre;
TitPad.TrimRight();
Cadena = CString(mWndPad?CString((TitPad=="")?
"[no title]":TitPad):"[Desktop]") +
CString(" :: ") + Cadena;
}
while (mWndPad);
CString Tit = title;
if(Tit=="")Tit="[no title]";
DWORD wd=0;
GetWindowThreadProcessId(mWnd,&wd);
stringstream ss,ssw;
ss << wd;
CString proc;
bool full = m_FullPath.GetCheck() != 0;
proc = GetProcessName(wd,full);
int col=0;
ssw << "#" << uppercase << hex << (int)mWnd;
m_List.AddItem(ii,col++,ssw.str());
m_List.AddItem(ii,col++,ss.str());
m_List.AddItem(ii,col++,proc);
m_List.AddItem(ii,col++,vis);
m_List.AddItem(ii,col++,ena);
m_List.AddItem(ii,col++,Tit);
m_List.AddItem(ii,col++,clase);
m_List.AddItem(ii,col++,Cadena);
m_List.SetItemData(ii,DWORD(mWnd));
ii++;
mWnd = ::GetNextWindow(mWnd,GW_HWNDNEXT);
}
//
兴趣点(Points of Interest)
有趣的是,有些程序如何使用隐藏的窗口.我发现了一个有趣的技巧:尝试使用"“类隐藏窗口(可以对列进行排序)(It is interesting to see how some programs use hidden windows. I found a funny trick: try to hide the windows (you can sort the columns) with the class “) Progman
" 要么 “(” or “) Shell_TrayWnd
" …您将看到台式机发生了什么!(”… you will see what happens with the desktop!)
历史(History)
感谢Hugo Gonzalez Castro的帮助.(Thanks to Hugo Gonzalez Castro for his help.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC6 Windows MFC Visual-Studio Dev 新闻 翻译