如何取得所有可见窗口的句柄啊???(100分)

  • 主题发起人 主题发起人 youdu
  • 开始时间 开始时间
Y

youdu

Unregistered / Unconfirmed
GUEST, unregistred user!
[:(][:(][:(]<br><br>如何取得所有可见窗口的句柄啊??<br>不是所有窗口的句柄!要可见窗口的句柄!!!
 
取得所有窗口的句柄然后用IsWindowVisible判断一下不就行了 :)
 
用HWND FindWindow(<br><br>&nbsp; &nbsp; LPCTSTR lpClassName, // pointer to class name<br>&nbsp; &nbsp; LPCTSTR lpWindowName // pointer to window name<br>&nbsp; &nbsp;);函数判断一下就可以了。
 
http://www.delphibbs.com/delphibbs/dispq.asp?lid=705082
 
把分结了吧,以下是代码<br>procedure TfrmGetWindowText.btnGetTextClick(Sender: TObject);<br>var<br>&nbsp; hCurrentWindow: HWnd;<br>&nbsp; szText: array[0..254] of char;<br>begin<br>&nbsp; hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST);<br>&nbsp; while hCurrentWindow &lt;&gt; 0 do<br>&nbsp; begin<br>&nbsp; &nbsp; if iswindowvisible(hCurrentWindow) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; if GetWindowText(hCurrentWindow, @szText, 255)&gt;0 then<br>&nbsp; &nbsp; &nbsp; &nbsp; memowindowstext.Lines.Add(StrPas(@szText));<br>&nbsp; &nbsp; end; &nbsp; &nbsp; <br>&nbsp; &nbsp; hCurrentWindow:=GetWindow(hCurrentWindow, GW_HWNDNEXT);<br>&nbsp; end;<br>end;<br>
 
我给一个可以在DOS下执行的版本,刚刚写出来的,保证你测试通过:<br><br>program a;<br>{$apptype console}<br>uses windows,sysutils;<br>var<br>&nbsp;hCurrentWindow: HWnd;<br>&nbsp;szText: array[0..254] of char;<br>begin<br>&nbsp;hCurrentWindow := GetWindow(GetTopWindow(GetDeskTopWindow), GW_HWNDFIRST);<br>&nbsp;while hCurrentWindow &lt;&gt; 0 do<br>&nbsp;begin<br>&nbsp; &nbsp;if iswindowvisible(hCurrentWindow) then<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp;if GetWindowText(hCurrentWindow, @szText, 255)&gt;0 then<br>&nbsp; &nbsp; &nbsp; &nbsp;writeln(StrPas(@szText));<br>&nbsp; &nbsp;end; &nbsp; &nbsp; <br>&nbsp; &nbsp;hCurrentWindow:=GetWindow(hCurrentWindow, GW_HWNDNEXT);<br>&nbsp;end;<br>end.<br>
 
我发现不能结束这个帖子吖!!!!<br>那个配分的不见了!!!!!!!!!!!!!!!!!!!!!<br>
 
楼主:现在好象不仅仅你结不了,很多人都不行了!<br>可能论坛的问题!等吧!<br>我还有很多分数都收不了 呢!<br>
 
好想把分数给收回来!哈哈!![:D][:D][:D][:D]
 
用不用教一下你呀? :~ ( <br><br>&nbsp; &nbsp;接受答案,并为[ &nbsp; ]加上 100 点积分;//在此处填上我的名字,并点上前面的单选框<br>然后按下方的“发出”按钮<br><br>
 
接受答案了.
 
后退
顶部