我只是想知道Google Input Tool for Windows是如何运行的..在拖动小谷歌弹出窗口(提供语言建议)时,记事本不会失去焦点......
我尝试了相同风格的窗口,
现在的问题是,当我点击并拖动我的窗口时,记事本/任何应用程序失去了焦点,当前焦点在我的小弹出窗口。
但Google Input Tool
,在拖动时,记事本不会失去焦点..
在这里,我想实现我的浮动弹出窗口必须没有焦点..当我触摸弹出窗口时,目标应用程序不应该失去焦点..
使用什么窗口VB6 API实现此目的..
非常感谢您观看....: - )
答案 0 :(得分:2)
这是Windows API代码(将其放在模块中)
Option Explicit
Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" _
(ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long ) As Long
Public Function SetTopMostWindow(hwnd As Long, Topmost As Boolean) _
As Long
If Topmost = True Then 'Make the window topmost
SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, _
0, FLAGS)
Else
SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, _
0, 0,FLAGS)
SetTopMostWindow = False
End If
End Function
在使用中,这会将Form1设置为最顶层:
SetTopMostWindow Form1.hwnd, True
(从谷歌搜索 vb6窗口最上面的第一个结果,http://support.microsoft.com/kb/184297)