5
52253831
Unregistered / Unconfirmed
GUEST, unregistred user!
C++实在是高深莫测,我是没法学了。
啥也别说了,翻译下一成为delphi语言
int main()
{
HWND wd=::FindWindow("Shell_TrayWnd",NULL);
if (wd==NULL)
{
// MessageBox("Error1"
return 0;
}
HWND wtd=FindWindowEx(wd,NULL,"TrayNotifyWnd",NULL);
if (wtd==NULL)
{
// MessageBox("Error2"
return 0;
}
HWND hdt=FindWindowEx(wtd,NULL,"SysPager",NULL);
if(hdt==NULL)
{
// MessageBox("Errortttt"
return 0;
}
HWND wd1=FindWindowEx(hdt,NULL,"ToolbarWindow32",NULL);
if (wd1==NULL)
{
// MessageBox("Error3"
return 0;
}
DWORD pid;
pid=0;
GetWindowThreadProcessId(wd1,&pid);
if (pid==NULL)
{
// MessageBox("Error4"
return 0;
}
HANDLE hd=OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_ALL_ACCESS,true,pid);
if (hd==NULL)
{
// MessageBox("Error6"
return 0;
}
int num=::SendMessage(wd1,TB_BUTTONCOUNT ,NULL,NULL);
int i;
unsigned long n;
TBBUTTON p,*pp;
CString x;
wchar_t name[256];
unsigned long whd,proid;
CString temp;
TBBUTTON *sp;
sp= (TBBUTTON *)0x20f00;
for(i=0;i<num;i++)
{
::SendMessage(wd1,TB_GETBUTTON,i,(LPARAM)sp);
pp=&p;
ReadProcessMemory(hd,sp,pp,sizeof(p),&n);
name[0]=0;
if (p.iString!=0xffffffff)
{
try
{
ReadProcessMemory(hd,(void *)p.iString,name,255,&n);
name[n]=0;
}
catch(...)
{}
}
temp=name;
try
{
whd=0;
ReadProcessMemory(hd,(void *)p.dwData,&whd,4,&n);
}
catch(...)
{}
proid=0;
GetWindowThreadProcessId((HWND)whd,&proid);
x.Format("位置=%d 名称=%s 窗口句柄=%08x 进程ID=%08x /n",i,(LPCTSTR )temp,whd,proid);
cout <<x;
}
return 0;
}
啥也别说了,翻译下一成为delphi语言
int main()
{
HWND wd=::FindWindow("Shell_TrayWnd",NULL);
if (wd==NULL)
{
// MessageBox("Error1"
return 0;
}
HWND wtd=FindWindowEx(wd,NULL,"TrayNotifyWnd",NULL);
if (wtd==NULL)
{
// MessageBox("Error2"
return 0;
}
HWND hdt=FindWindowEx(wtd,NULL,"SysPager",NULL);
if(hdt==NULL)
{
// MessageBox("Errortttt"
return 0;
}
HWND wd1=FindWindowEx(hdt,NULL,"ToolbarWindow32",NULL);
if (wd1==NULL)
{
// MessageBox("Error3"
return 0;
}
DWORD pid;
pid=0;
GetWindowThreadProcessId(wd1,&pid);
if (pid==NULL)
{
// MessageBox("Error4"
return 0;
}
HANDLE hd=OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_ALL_ACCESS,true,pid);
if (hd==NULL)
{
// MessageBox("Error6"
return 0;
}
int num=::SendMessage(wd1,TB_BUTTONCOUNT ,NULL,NULL);
int i;
unsigned long n;
TBBUTTON p,*pp;
CString x;
wchar_t name[256];
unsigned long whd,proid;
CString temp;
TBBUTTON *sp;
sp= (TBBUTTON *)0x20f00;
for(i=0;i<num;i++)
{
::SendMessage(wd1,TB_GETBUTTON,i,(LPARAM)sp);
pp=&p;
ReadProcessMemory(hd,sp,pp,sizeof(p),&n);
name[0]=0;
if (p.iString!=0xffffffff)
{
try
{
ReadProcessMemory(hd,(void *)p.iString,name,255,&n);
name[n]=0;
}
catch(...)
{}
}
temp=name;
try
{
whd=0;
ReadProcessMemory(hd,(void *)p.dwData,&whd,4,&n);
}
catch(...)
{}
proid=0;
GetWindowThreadProcessId((HWND)whd,&proid);
x.Format("位置=%d 名称=%s 窗口句柄=%08x 进程ID=%08x /n",i,(LPCTSTR )temp,whd,proid);
cout <<x;
}
return 0;
}