使应用程序失去焦点?(5分)

  • 主题发起人 主题发起人 qdyoung
  • 开始时间 开始时间
Q

qdyoung

Unregistered / Unconfirmed
GUEST, unregistred user!
象两岸通之类。<br>我试图在WMActiveApp消息处理中用SetActiveWindow恢复失去焦点窗口<br>的焦点,但不知如何由失去焦点窗口的ThreadId得到其Handle。<br><br>使用WMActive不行,其他程序切换过来时,ActiveHandle为0
 
5分的答案: 读SDK
 
可不要不见钱,眼不开啊?老兄现在穷是因为几乎看任何问题都看不完,<br>总是TimeOut,是Server端提示的ASP TimeOut。上传以上文字或一个问题<br>也是费多大劲,有时候还得重新写过(学乖了便备份所写内容)。<br><br>等哪天我上CERNet了(现在是成都169),定上排行榜,我请大伙吃大锅饭.<br><br>没办法,这个站点简直太好,不在这儿提问题往哪儿提呢?<br><br>本人才疏学浅,SDK太大,在线文档找半天找不着。如果只是几个API调用,<br>huizhang 您就开开金口如何?<br><br>各位为我加油吧。<br>
 
&nbsp;I think you should know your window handle ,otherwise , you can get it.<br>&nbsp; if so ,then you can do thing as follows :<br>&nbsp; first : call getwindowthreadId ,so you can get the threadid of your application &nbsp;you want to activate .<br>&nbsp; second : send message WM_ActiveApp &nbsp;,then Activate your application<br>&nbsp; This is my first solution , if you want a better solution ,please <br>give me mord score , Ok !
 
WM_ActiveApp 应为 &nbsp;WM_ACTIVATEAPP
 
笔误太多,敬请原谅。<br>谢谢wuyi
 
you can use 'FindWindow' to get the handle ,<br>&nbsp;then use 'SetAcitveWindow(handle)' to set focus!<br>Good Luck!<br>
 
因该把焦点给下一个程序就可以了!
 
CJ:以下都不行,不能使焦点回到切换过来的程序。<br>SetForegroundWindow(GetWindow(Handle, GW_HWNDPREV)); //失去焦点到未知<br>SetForegroundWindow(GetWindow(Handle, GW_HWNDLAST)); //失去焦点到桌面<br>
 
仅仅用SetActiveWindow或SetFocus是不行的,因为在多线程的情况下<br>你只是设置了当前线程的焦点,你必须查找所有的窗口,例如:<br>你可以用钩子函数来查找所有的消息进行查找想要的窗口,似乎<br>FindWindow()不行!!
 
对此问题,大家还有看法吗?<br>所有参加讨论的大虾都将得到应得的分数(从晓茶腰包里掏 :-) &nbsp;)<br>还请大家畅所欲言。
 
Use ThreadID to get hWnd has been answered is another question.<br>Please search the BBS using ThreadID as a key word.
 
问题解决了吗?
 
接受答案了.
 
后退
顶部