关于窗口的handle的问题(100分)

  • 主题发起人 主题发起人 aerobull
  • 开始时间 开始时间
A

aerobull

Unregistered / Unconfirmed
GUEST, unregistred user!
请看下面的程序<br>var<br>&nbsp; &nbsp; i:integer;<br>&nbsp; &nbsp; focushld,windowhld:hwnd;<br>&nbsp; &nbsp; threadld: dword;<br>&nbsp; &nbsp; ch: byte;<br>begin<br>&nbsp; Application.Minimize;<br>&nbsp; windowhld:=GetForegroundWindow;<br>&nbsp; threadld:=GetWindowThreadProcessId(Windowhld,nil);<br>&nbsp; Application.Title:=inttostr(threadld);<br>&nbsp; AttachThreadInput(GetCurrentThreadId,threadld,True);<br>&nbsp; Focushld:=getfocus;<br>&nbsp; Application.Title:=Inttostr(Focushld);<br>&nbsp; AttachThreadInput(GetCurrentThreadId,threadld,False);<br>&nbsp; i := 1;<br><br>Focushld有时为零,我想上面的程序有可能错了。
 
各位,请出手啊。
 
 Application.Minimize;<br>&nbsp; windowhld:=GetForegroundWindow;<br>&nbsp; threadld:=GetWindowThreadProcessId(windowhld,nil);<br>&nbsp; Application.Title:=inttostr(threadld);<br>&nbsp; AttachThreadInput(GetCurrentThreadId,threadld,True);<br>&nbsp; Focushld:=getfocus;<br>&nbsp; Application.Title:=Inttostr(Focushld);<br>&nbsp; 把第三个参数改为true就可以了//AttachThreadInput(GetCurrentThreadId,threadld,true);<br>&nbsp; i := 1;<br>其实就是让它为与本线程处于连接状态!
 
接受答案了.
 
后退
顶部