Advertisement
darkLoki

User32 Interface

Sep 17th, 2013
2,996
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.91 KB | None | 0 0
  1. import com.sun.jna.Native;
  2. import com.sun.jna.Pointer;
  3. import com.sun.jna.Structure;
  4. import com.sun.jna.platform.win32.WinDef.RECT;
  5. import com.sun.jna.ptr.ByteByReference;
  6. import com.sun.jna.ptr.IntByReference;
  7. import com.sun.jna.win32.StdCallLibrary.StdCallCallback;
  8. import com.sun.jna.win32.W32APIOptions;
  9.  
  10. public interface User32 extends W32APIOptions {  
  11.     User32 INSTANCE = (User32) Native.loadLibrary("user32", User32.class, DEFAULT_OPTIONS);  
  12.     Pointer GetDC(Pointer hWnd);  
  13.     int ReleaseDC(Pointer hWnd, Pointer hDC);  
  14.     int FLASHW_STOP = 0;  
  15.     int FLASHW_CAPTION = 1;  
  16.     int FLASHW_TRAY = 2;  
  17.     int FLASHW_ALL = (FLASHW_CAPTION | FLASHW_TRAY);  
  18.     int FLASHW_TIMER = 4;  
  19.     int FLASHW_TIMERNOFG = 12;  
  20.     public static class FLASHWINFO extends Structure {  
  21.         public int cbSize;  
  22.         public Pointer hWnd;  
  23.         public int dwFlags;  
  24.         public int uCount;  
  25.         public int dwTimeout;  
  26.     }  
  27.     int IMAGE_BITMAP = 0;  
  28.     int IMAGE_ICON = 1;  
  29.     int IMAGE_CURSOR = 2;  
  30.     int IMAGE_ENHMETAFILE = 3;  
  31.     int LR_DEFAULTCOLOR = 0x0000;  
  32.     int LR_MONOCHROME = 0x0001;  
  33.     int LR_COLOR = 0x0002;  
  34.     int LR_COPYRETURNORG = 0x0004;  
  35.     int LR_COPYDELETEORG = 0x0008;  
  36.     int LR_LOADFROMFILE = 0x0010;  
  37.     int LR_LOADTRANSPARENT = 0x0020;  
  38.     int LR_DEFAULTSIZE = 0x0040;  
  39.     int LR_VGACOLOR = 0x0080;  
  40.     int LR_LOADMAP3DCOLORS = 0x1000;  
  41.     int LR_CREATEDIBSECTION = 0x2000;  
  42.     int LR_COPYFROMRESOURCE = 0x4000;  
  43.     int LR_SHARED = 0x8000;  
  44.     Pointer FindWindowA(String winClass, String title);  
  45.     int GetClassName(Pointer hWnd, byte[] lpClassName, int nMaxCount);  
  46.     public static class GUITHREADINFO extends Structure {  
  47.         public int cbSize = size();  
  48.         public int flags;  
  49.         Pointer hwndActive;  
  50.         Pointer hwndFocus;  
  51.         Pointer hwndCapture;  
  52.         Pointer hwndMenuOwner;  
  53.         Pointer hwndMoveSize;  
  54.         Pointer hwndCaret;  
  55.         RECT rcCaret;  
  56.     }  
  57.     boolean GetGUIThreadInfo(int idThread, GUITHREADINFO lpgui);  
  58.     public static class WINDOWINFO extends Structure {  
  59.         public int cbSize = size();  
  60.         public RECT rcWindow;  
  61.         public RECT rcClient;  
  62.         public int dwStyle;  
  63.         public int dwExStyle;  
  64.         public int dwWindowStatus;  
  65.         public int cxWindowBorders;  
  66.         public int cyWindowBorders;  
  67.         public short atomWindowType;  
  68.         public short wCreatorVersion;  
  69.     }  
  70.     boolean GetWindowInfo(Pointer hWnd, WINDOWINFO pwi);  
  71.     boolean GetWindowRect(Pointer hWnd, RECT rect);  
  72.     int GetWindowText(Pointer hWnd, byte[] lpString, int nMaxCount);  
  73.     int GetWindowTextLength(Pointer hWnd);  
  74.     int GetWindowModuleFileName(Pointer hWnd, byte[] lpszFileName, int cchFileNameMax);  
  75.     int GetWindowThreadProcessId(Pointer hWnd, IntByReference lpdwProcessId);  
  76.     interface WNDENUMPROC extends StdCallCallback {  
  77.         /**
  78.          * Return whether to continue enumeration.
  79.          */  
  80.         boolean callback(Pointer hWnd, Pointer data);  
  81.     }  
  82.     boolean EnumWindows(WNDENUMPROC lpEnumFunc, Pointer data);  
  83.     boolean EnumThreadWindows(int dwThreadId, WNDENUMPROC lpEnumFunc, Pointer data);  
  84.     boolean FlashWindowEx(FLASHWINFO info);  
  85.     Pointer LoadIcon(Pointer hInstance, String iconName);  
  86.     Pointer LoadImage(Pointer hinst, // handle to instance  
  87.             String name, // image to load  
  88.             int type, // image type  
  89.             int xDesired, // desired width  
  90.             int yDesired, // desired height  
  91.             int load // load options  
  92.             );  
  93.     boolean DestroyIcon(Pointer hicon);  
  94.     int GWL_EXSTYLE = -20;  
  95.     int GWL_STYLE = -16;  
  96.     int GWL_WNDPROC = -4;  
  97.     int GWL_HINSTANCE = -6;  
  98.     int GWL_ID = -12;  
  99.     int GWL_USERDATA = -21;  
  100.     int DWL_DLGPROC = 4;  
  101.     int DWL_MSGRESULT = 0;  
  102.     int DWL_USER = 8;  
  103.     int WS_EX_COMPOSITED = 0x20000000;  
  104.     int WS_EX_LAYERED = 0x80000;  
  105.     int WS_EX_TRANSPARENT = 32;  
  106.     int GetWindowLong(Pointer hWnd, int nIndex);  
  107.     int SetWindowLong(Pointer hWnd, int nIndex, int dwNewLong);  
  108.     int LWA_COLORKEY = 1;  
  109.     int LWA_ALPHA = 2;  
  110.     int ULW_COLORKEY = 1;  
  111.     int ULW_ALPHA = 2;  
  112.     int ULW_OPAQUE = 4;  
  113.     boolean SetLayeredWindowAttributes(Pointer hwnd, int crKey,  
  114.             byte bAlpha, int dwFlags);  
  115.     boolean GetLayeredWindowAttributes(Pointer hwnd,  
  116.             IntByReference pcrKey,  
  117.             ByteByReference pbAlpha,  
  118.             IntByReference pdwFlags);  
  119.     /**
  120.      * Defines the x- and y-coordinates of a point.
  121.      */  
  122.     public static class POINT extends Structure {  
  123.         public int x, y;  
  124.     }  
  125.     /**
  126.      * Specifies the width and height of a rectangle.
  127.      */  
  128.     public static class SIZE extends Structure {  
  129.         public int cx, cy;  
  130.     }  
  131.     int AC_SRC_OVER = 0x00;  
  132.     int AC_SRC_ALPHA = 0x01;  
  133.     int AC_SRC_NO_PREMULT_ALPHA = 0x01;  
  134.     int AC_SRC_NO_ALPHA = 0x02;  
  135.     public static class BLENDFUNCTION extends Structure {  
  136.         public byte BlendOp = AC_SRC_OVER; // only valid value  
  137.         public byte BlendFlags = 0; // only valid value  
  138.         public byte SourceConstantAlpha;  
  139.         public byte AlphaFormat;  
  140.     }  
  141.     boolean UpdateLayeredWindow(Pointer hwnd, Pointer hdcDst,  
  142.             POINT pptDst, SIZE psize,  
  143.             Pointer hdcSrc, POINT pptSrc, int crKey,  
  144.             BLENDFUNCTION pblend, int dwFlags);  
  145.     int SetWindowRgn(Pointer hWnd, Pointer hRgn, boolean bRedraw);  
  146.     int VK_SHIFT = 16;  
  147.     int VK_LSHIFT = 0xA0;  
  148.     int VK_RSHIFT = 0xA1;  
  149.     int VK_CONTROL = 17;  
  150.     int VK_LCONTROL = 0xA2;  
  151.     int VK_RCONTROL = 0xA3;  
  152.     int VK_MENU = 18;  
  153.     int VK_LMENU = 0xA4;  
  154.     int VK_RMENU = 0xA5;  
  155.     boolean GetKeyboardState(byte[] state);  
  156.     short GetAsyncKeyState(int vKey);  
  157. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement