|
配合GTV,写了一个小的程序,可以显示/隐藏窗口
其实不仅能隐藏GTV,别的窗口也行
普通使用方法:
解压后放到任意文件夹
直接运行exe,所有可见GTV窗口隐藏,所有隐藏窗口可见
运行show all.bat,显示所有GTV窗口
运行hide all.bat,隐藏所有GTV窗口
高级使用方法:
Usage: showhide [Function=0] [Window title=GTV.exe] [Class name=ConsoleWindowClass]
Function:
0: Hide
1: Show
2: Invert
代码很短,贴出来吧
#include <stdio.h>
#include <windows.h>
int function=2; //0=hide 1=show 2=invert
char title[1024]="GTV.exe";
char classname[1024]="ConsoleWindowClass";
int windowfound=0;
BOOL CALLBACK EnumProc(HWND hwnd, LPARAM lp)
{
//if ((GetWindowLong(hwnd,GWL_STYLE) & WS_VISIBLE)) {
char buf[1024];
char buf2[1024];
GetWindowText(hwnd,buf,1024);
GetClassName(hwnd,buf2,1024);
if (strstr(buf,(char*)title)!=NULL){
if (strstr(buf2,(char*)classname)!=NULL){
if (function==0){
//hide
ShowWindow(hwnd,SW_HIDE);
printf("HIDE: ");
}
else if (function==1){
//show
ShowWindow(hwnd,SW_SHOW);
printf("SHOW: ");
}
else if (function==2){
if ((GetWindowLong(hwnd,GWL_STYLE) & WS_VISIBLE)){
//hide
ShowWindow(hwnd,SW_HIDE);
printf("HIDE: ");
}
else{
//show
ShowWindow(hwnd,SW_SHOW);
printf("SHOW: ");
}
}
printf("HWND=%d Title=%s Class=%s\n",hwnd,buf,buf2);
windowfound++;
}
}
//}
return TRUE;
}
void main( int argc, char *argv[], char *envp[] )
{
//usage
printf("Usage: showhide [Function=2] [Window title=GTV.exe] [Class name=ConsoleWindowClass]\n");
printf(" Function:\n");
printf(" 0: Hide\n");
printf(" 1: Show\n");
printf(" 2: Invert\n");
if (argc==2){
function=atoi(argv[1]);
}
else if (argc==3){
function=atoi(argv[1]);
strcpy(title,argv[2]);
}
else if (argc==4){
function=atoi(argv[1]);
strcpy(title,argv[2]);
strcpy(classname,argv[3]);
}
EnumWindows(EnumProc,NULL);
printf("Total Windows Found=%d\n",windowfound);
}
[ 本帖最后由 JUST 于 2008-11-25 13:58 编辑 ] |
|