kbByte(0 To 255) As Byte End Type #If VBA7 Then Private Declare PtrSafe Function GetCursorPos Lib "user32 " (lpPoint As POINTAPI) As Long Private Declare PtrSafe Function GetKeyState Lib "user32" (ByVal nVirtKey Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer Private Declare Function GetActiveWindow Lib "user32 " () As Long Private Declare Function GetKeyboardState Lib "user32" (kbArray As KeyboardBytes) As Long
" () As Long Private Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hWnd As LongLong) As Long Private Declare PtrSafe Function EmptyClipboard Lib "user32" () As Long Private Declare PtrSafe Function CountClipboardFormats Lib "user32" () As Long Private Declare PtrSafe Function lstrcpy Lib " (ByVal wFormat As Long) As LongPtr Private Declare PtrSafe Function SetClipboardData Lib "user32" lpString2 As Any) As Long Private Declare Function GetClipboardData Lib "user32" (ByVal wFormat As
GetDC+0x6d 0006f350 77d28ea0 00000000 00440b6b 000f084a user32! GetDC+0x14f 0006f3a4 77d28eec 0185a660 00000116 00010bcd user32! DefFrameProcW+0xb3 0006f548 0042e3dc 000f084a 000a0acc 00000313 user32! GetDC+0x6d 0006f758 77d28ea0 00000000 00440b6b 000f084a user32! GetDC+0x14f 0006f7ac 77d28eec 0185a660 00000313 00000000 user32!
子菜单的标题部分是显示在父菜单上的选项 Public Caption As String Private Declare PtrSafe Function SetMenuDefaultItem Lib "User32 uItem As Long, ByVal fByPos As Long) As Long Private Declare PtrSafe Function CreatePopupMenu Lib "User32 " () As Long Private Declare PtrSafe Function DestroyMenu Lib "User32" (ByVal hMenu As Long) As Long Private Declare PtrSafe Function AppendMenu Lib "User32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal " (lpPoint As POINTL) As Long Private Declare PtrSafe Function GetDesktopWindow Lib "User32" () As Long
"() As LongPtr Private Declare PtrSafe Function OpenClipboard Lib "user32"(ByVal hwnd As LongPtr) As LongPtr Private Declare PtrSafe Function EmptyClipboard Lib "user32" ()As LongPtr Private Declare Any, _ ByVal lpString2 As Any) As LongPtr Private Declare PtrSafe Function SetClipboardData Lib "user32 " () AsLong Private Declare Function OpenClipboard Lib "user32" (ByValhwnd As Long) As Long Private Declare Function EmptyClipboard Lib "user32" () AsLong Private Declare Function lstrcpy Lib "kernel32
Public Declare Function RegisterClass Lib "user32" Alias "RegisterClassA" (Class As WndClass) As Long Public Declare Function UnregisterClass Lib "user32" Alias "UnregisterClassA" (ByVal lpClassName As " (lpMsg As msg) As Long Public Declare Function DispatchMessage Lib "user32" Alias "DispatchMessageA As Long) As Long Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance " (ByVal nExitCode As Long) Public Declare Function DestroyWindow Lib "user32" (ByVal hWnd As Long) As
WinDef.HWND; import com.sun.jna.win32.StdCallLibrary; public class Show_QQ_Window { public interface User32 extends StdCallLibrary { User32 INSTANCE = (User32) Native.loadLibrary("user32", User32.class winClass, String title); } public static void main(String[] args) throws AWTException { final User32 user32 = User32.INSTANCE; //获取当前菜单栏名为"Criyson"的聊天窗口,并将其置顶 HWND hWnd = user32.FindWindowA(null
20 21 22 23 24 25 26 27 28 private delegate bool WndEnumProc(IntPtr hWnd, int lParam); [DllImport("user32 ")] private static extern bool EnumWindows(WndEnumProc lpEnumFunc, int lParam); [DllImport("user32") ] private static extern IntPtr GetParent(IntPtr hWnd); [DllImport("user32")] private static extern bool IsWindowVisible(IntPtr hWnd); [DllImport("user32")] private static extern int GetWindowText(IntPtr (IntPtr hWnd, StringBuilder lpString, int nMaxCount); [DllImport("user32")] private static extern bool
= ReleaseDC(hDstWin, hDstDC) ENDIF PROCEDURE declare DECLARE INTEGER GetActiveWindow IN user32 DECLARE INTEGER GetCursorPos IN user32 STRING @lpPoint DECLARE INTEGER GetWindowDC IN user32 INTEGER hwnd DECLARE INTEGER GetDC IN user32 INTEGER hwnd DECLARE INTEGER GetFocus IN user32 DECLARE INTEGER ReleaseDC IN user32; INTEGER hWindow, INTEGER hdc DECLARE INTEGER ScreenToClient IN user32
As Long) As Long Public Declare PtrSafe Function SetWindowLong _ Lib "user32 As String) As Long #Else Public Declare Function GetWindowLong _ Lib "user32 nIndex As Long) As Long Public Declare Function SetWindowLong _ Lib "user32 dwNewLong As Long) As Long Public Declare Function DrawMenuBar _ Lib"user32 ByVal hWnd As Long) As Long Public Declare Function FindWindowA _ Lib"user32
=========================================Option ExplicitPrivate Declare Function SetWindowText Lib "user32 (ByVal hwnd As Long, ByVal lpString As String) As LongPrivate Declare Function CallWindowProc Lib "user32 Long, ByVal wParam As Long, ByVal lParam As Long) As LongPrivate Declare Function GetWindowLong Lib "user32 GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As LongPrivate Declare Function SetWindowLong Lib "user32
Const WS_THICKFRAME = &H40000 #If VBA7 Then Public Declare PtrSafe Function GetWindowLong _ Lib "user32 hWnd As Long, ByVal nIndex As Long) As Long Public Declare PtrSafe Function SetWindowLong _ Lib "user32 Long, _ ByVal dwNewLong As Long) As Long Public Declare PtrSafe Function DrawMenuBar _ Lib "user32 " (ByVal hWnd As Long) As Long Public Declare PtrSafe Function FindWindowA _ Lib "user32" (ByVal _ ByVal lpWindowName As String) As Long #Else Public Declare Function GetWindowLong _ Lib "user32
Right As Long Bottom As Long End Type Private Declare PtrSafe Function _ GetActiveWindow& Lib "user32 " () Private Declare PtrSafe Sub GetWindowRect Lib _ "user32" (ByVal hwnd&, lpRect As RECT) Private Declare PtrSafe Function _ GetDesktopWindow& Lib "user32" () '剪贴板操作 Private Declare PtrSafe Function _ OpenClipboard& Lib "user32" (ByVal hwnd&) Private Declare PtrSafe Function _ CloseClipboard& Lib "user32" () Private Declare PtrSafe Function SetClipboardData& _ Lib "user32" (ByVal wFormat&, ByVal
desktop ) // get desktop locked status func ScreenIsLocked() bool { // load user32.dll only once user32 := win.MustLoadLibrary("user32.dll") openDesktop := win.MustGetProcAddress(user32, "OpenDesktopW ") closeDesktop := win.MustGetProcAddress(user32, "CloseDesktop") switchDesktop := win.MustGetProcAddress (user32, "SwitchDesktop") var lpdzDesktopPtr uintptr = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr
lpClassName As String, ByVal lpWindowName As String) As IntPtr Private Declare Function FindWindowEx Lib "user32 wParam As Integer, ByVal lParam As String) As Integer 'Private Declare Function CheckDlgButton Lib "user32 ByVal nMaxCount As Integer) As Integer 'Private Declare Function GetWindowThreadProcessId Lib "user32 ByVal lpdwProcessId As Long) As Integer Private Declare Auto Function GetWindowTextLength Lib "user32 As StringBuilder, ByVal cch As Integer) As Integer 'Private Declare Function MapVirtualKey Lib "user32
那么 OpenClipboard 在BOF中则是: DECLSPEC_IMPORT WINUSERAPI BOOL WINAPI USER32$OpenClipboard (HWND); 剩下的就好说了 DECLSPEC_IMPORT HWND WINAPI KERNEL32$GetConsoleWindow(void); DECLSPEC_IMPORT WINUSERAPI BOOL WINAPI USER32 $OpenClipboard(HWND); DECLSPEC_IMPORT WINUSERAPI HANDLE WINAPI USER32$GetClipboardData(UINT); DECLSPEC_IMPORT (); USER32$OpenClipboard(owner); owner = USER32$GetClipboardData(CF_TEXT); BeaconPrintf( CALLBACK_OUTPUT, "%s\n", (char *)owner);; USER32$CloseClipboard(); } 然后编译: x86_64-w64-mingw32-gcc
Long Top As Long Right As Long Bottom As LongEnd TypePrivate Declare Function SendMessage Lib "user32 wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Declare Function SetWindowText Lib "user32 (ByVal hwnd As Long, ByVal lpString As String) As LongPrivate Declare Function CallWindowProc Lib "user32 Long, ByVal wParam As Long, ByVal lParam As Long) As LongPrivate Declare Function GetWindowLong Lib "user32 GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As LongPrivate Declare Function SetWindowLong Lib "user32
dwFileAttributes,; STRING @psfi, LONG cbFileInfo, LONG uFlags DECLARE INTEGER SendMessage IN user32 INTEGER hWindow, INTEGER Msg,; INTEGER wParam, INTEGER lParam DECLARE INTEGER SendMessage IN user32 ; INTEGER hWindow, INTEGER nIndex, INTEGER dwNewLong DECLARE INTEGER GetWindowLong IN user32; INTEGER hWindow, INTEGER nIndex DECLARE INTEGER GetWindowDC IN user32 INTEGER hWindow DECLARE INTEGER SystemParametersInfo IN user32; INTEGER uiAction, INTEGER uiParam,; STRING @pvParam,
代码如下: Declare Function OpenClipboard _ Lib "user32" _ (ByVal hwnd As Long) As Long Declare Function CloseClipboard _ Lib "user32" () As Long Declare Function GetClipboardData _ Lib "user32" _ (ByVal wFormat As Long) As Long Declare Function EmptyClipboard _ Lib "user32" () As Long Declare
__fnCOPYDATA 77d12974 77d583ac USER32!__fnCOPYGLOBALDATA ... 77d12a5c 77d3f5cb USER32! __ClientFreeLibrary 77d12a60 77d3a3fc USER32!__ClientGetCharsetInfo 77d12a64 77d58a7c USER32! __ClientGetDDEFlags 77d12a68 77d58bd5 USER32!__ClientGetDDEHookData 77d12a6c 77d4f715 USER32! __ClientGetMessageMPH 77d12a74 77d3aa6d USER32!__ClientLoadImage 77d12a78 77d3dc84 USER32! __ClientLoadLibrary和USER32!