最后10分,请帮帮忙,关于窗口遍历
尝试用热键来隐藏或者复原当前所有可见的程序窗口,隐藏没问题,可是无法复原,各位帮我看看下面的代码,哪里出了问题?
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "LMDCustomComponent"
#pragma link "LMDGlobalHotKey"
#pragma resource "*.dfm"
bool it=true;
char buf[256];
struct WINLIST
{
HANDLE hWnd;
char cWinBuf[256];
};
struct WINLIST ListTemp[256];
int WinCount;
BOOL CALLBACK MyEnumProc(HWND hwnd,LPARAM lParam)
{
GetClassName(hwnd,buf,256);
if ((strcmp(buf,"Shell_TrayWnd")!=0)&&IsWindowVisible(hwnd)&&(strcmp(buf,"Progman")!=0))
{
ListTemp[WinCount].hWnd=hwnd;
strcpy(ListTemp[WinCount].cWinBuf,buf);
ShowWindow(hwnd,SW_HIDE);
WinCount++;
}
return true;
}
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::LMDGlobalHotKey1KeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (it)
{
WinCount=0;
EnumWindows((FARPROC)MyEnumProc,0);
it=false;
}
else
{
for (int i;i<WinCount;i++)
{
ShowWindow(ListTemp[i].hWnd,SW_SHOW);
}
it=true;
}
}
//---------------------------------------------------------------------------