首页WIN7问题求将以下C代码转成VB代码

求将以下C代码转成VB代码

时间2022-11-10 01:00:17发布分享专员分类WIN7问题浏览50

Private Type RECT

Left As Long

Top As Long

Right As Long

Bottom As Long

End Type

Private Type PGUITHREADINFO

cbSize As Long

flags As Long

求将以下C代码转成VB代码

hWndActive As Long

hwndFocus As Long

hwndCapture As Long

hwndMenuOwner As Long

hwndMoveSize As Long

hwndCaret As Long

rcCaret As RECT

End Type

Private Declare Function AttachThreadInput Lib "user32" (ByVal idAttach As Long, ByVal idAttachTo As Long, ByVal fAttach As Long) As Long

Private Declare Function GetForegroundWindow Lib "user32" () As Long

Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long

Private Declare Function GetGUIThreadInfo Lib "user32" (ByVal idThread As Long, ByRef pgui As PGUITHREADINFO) As Long

Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long

Function GetKeyFocusWnd() As Long

Dim hwnd As Long

Dim dwTargetThreadID As Long

Dim dwCurrentThreadID As Long

Dim bRetVal As Boolean

Dim sThreadInfo As PGUITHREADINFO

hwnd = GetForegroundWindow

dwTargetThreadID = GetWindowThreadProcessId(hwnd, vbNull)

dwCurrentThreadID = GetCurrentThreadId

bRetVal = AttachThreadInput(dwCurrentThreadID, dwTargetThreadID, True)

sThreadInfo.cbSize = Len(sThreadInfo)

bRetVal = GetGUIThreadInfo(dwTargetThreadID, sThreadInfo)

Dim hTargetWnd As Long

hTargetWnd = hwnd

If sThreadInfo.hwndFocus Then

hTargetWnd = sThreadInfo.hwndFocus

ElseIf sThreadInfo.hWndActive Then

hTargetWnd = sThreadInfo.hWndActive

End If

AttachThreadInput dwCurrentThreadID, dwTargetThreadID, False

GetKeyFocusWnd = hTargetWnd

End Function

爱资源吧版权声明:以上文中内容来自网络,如有侵权请联系删除,谢谢。

Arrayattachthreadinput
如何获取其它进程的鼠标头标(GetCursor只能获取本进程的光标指针) 高中数学如何学好技巧?老唐数学常青精品课:只需一招,轻松搞定