JNative v1.3 project : see http://jnative.sf.net


org.xvolks.jnative.util
Class User32

java.lang.Object
  extended by org.xvolks.jnative.util.User32

public class User32
extends java.lang.Object

User32 this is the class wrapper to User32.dll.
When a developper needs a function of this DLL (s)he should add it here. $Id: User32.java,v 1.14 2006/11/15 11:17:27 mdenty Exp $; This software is released under the LGPL.


Field Summary
static java.lang.String DLL_NAME
           
 
Constructor Summary
User32()
           
 
Method Summary
static int CreateWindowEx(int dwExStyle, LONG lpClassName, java.lang.String lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, int hWndParent, int hMenu, int hInstance, int lParam)
           
static int createWindowEx(int dwExStyle, java.lang.String lpClassName, java.lang.String lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, int hWndParent, int hMenu, int hInstance, int lParam)
          HWND CreateWindowEx( DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, -3 for HWND_MESSAGE (Message only windows) HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam );
static int CreateWindowEx(int dwExStyle, java.lang.String lpClassName, java.lang.String lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, int hWndParent, int hMenu, int hInstance, int lParam)
          HWND CreateWindowEx( DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, -3 for HWND_MESSAGE (Message only windows) HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam );
static LRESULT defWindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
           
static void dispatchMessage(MSG msg)
           
static boolean EnumWindows(Callback lpEnumFunc, int lParam)
           EnumWindows Function The EnumWindows function enumerates all top-level windows on the screen by passing the handle to each window, in turn, to an application-defined callback function.
static HWND findWindow(java.lang.String className, java.lang.String windowName)
          HWND FindWindow( LPCTSTR lpClassName, LPCTSTR lpWindowName );
static int getMessage(MSG msg, HWND hwnd, int minMSG, int maxMSG)
           
static java.lang.String GetWindowText(HWND hwnd)
           
static LONG LoadIcon(LONG hInstance, int ressource)
           
static LONG LoadIcon(LONG hInstance, java.lang.String lpIconName)
           HICON LoadIcon( HINSTANCE hInstance, LPCTSTR lpIconName ); Parameters hInstance [in] Handle to an instance of the module whose executable file contains the icon to be loaded.
static int messageBox(int parentHandle, java.lang.String message, java.lang.String caption, int buttons)
           
static LONG RegisterClass(WNDCLASS lpWndClass)
           RegisterClass Function The RegisterClass function registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function.
static LRESULT SendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
           SendMessage Function The SendMessage function sends the specified message to a window or windows.
static int SetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong)
          LONG SetWindowLong( HWND hWnd, int nIndex, LONG dwNewLong );
static boolean setWindowPos(HWND hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags)
          BOOL SetWindowPos( HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags );
static boolean showWindow(HWND hwnd, int nCmdShow)
           
static void translateMessage(MSG msg)
           
static void updateWindow(HWND hwnd)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DLL_NAME

public static final java.lang.String DLL_NAME
See Also:
Constant Field Values
Constructor Detail

User32

public User32()
Method Detail

findWindow

public static HWND findWindow(java.lang.String className,
                              java.lang.String windowName)
                       throws NativeException,
                              java.lang.IllegalAccessException
HWND FindWindow( LPCTSTR lpClassName, LPCTSTR lpWindowName );

Throws:
NativeException
java.lang.IllegalAccessException

defWindowProc

public static LRESULT defWindowProc(HWND hwnd,
                                    UINT msg,
                                    WPARAM wparam,
                                    LPARAM lparam)
                             throws NativeException,
                                    java.lang.IllegalAccessException
Throws:
NativeException
java.lang.IllegalAccessException

updateWindow

public static void updateWindow(HWND hwnd)
                         throws NativeException,
                                java.lang.IllegalAccessException
Throws:
NativeException
java.lang.IllegalAccessException

dispatchMessage

public static void dispatchMessage(MSG msg)
                            throws NativeException,
                                   java.lang.IllegalAccessException
Throws:
NativeException
java.lang.IllegalAccessException

translateMessage

public static void translateMessage(MSG msg)
                             throws NativeException,
                                    java.lang.IllegalAccessException
Throws:
NativeException
java.lang.IllegalAccessException

getMessage

public static int getMessage(MSG msg,
                             HWND hwnd,
                             int minMSG,
                             int maxMSG)
                      throws NativeException,
                             java.lang.IllegalAccessException
Throws:
NativeException
java.lang.IllegalAccessException

showWindow

public static boolean showWindow(HWND hwnd,
                                 int nCmdShow)
                          throws NativeException,
                                 java.lang.IllegalAccessException
Throws:
NativeException
java.lang.IllegalAccessException

CreateWindowEx

public static final int CreateWindowEx(int dwExStyle,
                                       java.lang.String lpClassName,
                                       java.lang.String lpWindowName,
                                       int dwStyle,
                                       int x,
                                       int y,
                                       int nWidth,
                                       int nHeight,
                                       int hWndParent,
                                       int hMenu,
                                       int hInstance,
                                       int lParam)
                                throws NativeException,
                                       java.lang.IllegalAccessException
HWND CreateWindowEx( DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, -3 for HWND_MESSAGE (Message only windows) HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam );

Throws:
NativeException
java.lang.IllegalAccessException

createWindowEx

public static final int createWindowEx(int dwExStyle,
                                       java.lang.String lpClassName,
                                       java.lang.String lpWindowName,
                                       int dwStyle,
                                       int x,
                                       int y,
                                       int nWidth,
                                       int nHeight,
                                       int hWndParent,
                                       int hMenu,
                                       int hInstance,
                                       int lParam)
                                throws NativeException,
                                       java.lang.IllegalAccessException
HWND CreateWindowEx( DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, -3 for HWND_MESSAGE (Message only windows) HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam );

Throws:
NativeException
java.lang.IllegalAccessException

CreateWindowEx

public static final int CreateWindowEx(int dwExStyle,
                                       LONG lpClassName,
                                       java.lang.String lpWindowName,
                                       int dwStyle,
                                       int x,
                                       int y,
                                       int nWidth,
                                       int nHeight,
                                       int hWndParent,
                                       int hMenu,
                                       int hInstance,
                                       int lParam)
                                throws NativeException,
                                       java.lang.IllegalAccessException
Throws:
NativeException
java.lang.IllegalAccessException

messageBox

public static final int messageBox(int parentHandle,
                                   java.lang.String message,
                                   java.lang.String caption,
                                   int buttons)
                            throws NativeException,
                                   java.lang.IllegalAccessException
Throws:
NativeException
java.lang.IllegalAccessException

EnumWindows

public static boolean EnumWindows(Callback lpEnumFunc,
                                  int lParam)
                           throws NativeException,
                                  java.lang.IllegalAccessException
  EnumWindows Function
 
         The EnumWindows function enumerates all top-level windows on the screen by passing the handle to each window, in turn, to an application-defined callback function. EnumWindows continues until the last top-level window is enumerated or the callback function returns FALSE.
 
         Syntax
 
         BOOL EnumWindows(
 
         WNDENUMPROC lpEnumFunc,
         LPARAM lParam
         );
 
         Parameters
 
         lpEnumFunc
         [in] Pointer to an application-defined callback function. For more information, see EnumWindowsProc.
         lParam
         [in] Specifies an application-defined value to be passed to the callback function.
 
         Return Value
 
         If the function succeeds, the return value is nonzero.
 
         If the function fails, the return value is zero. To get extended error information, call GetLastError.
 
         If EnumWindowsProc returns zero, the return value is also zero. In this case, the callback function should call SetLastError to obtain a meaningful error code to be returned to the caller of EnumWindows.
 
 
         Remarks
 
         The EnumWindows function does not enumerate child windows, with the exception of a few top-level windows owned by the system that have the WS_CHILD style.
 
         This function is more reliable than calling the GetWindow function in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed.
 
 
lpEnumFunc must be the address returned by JNative.createCallback()

Throws:
NativeException
java.lang.IllegalAccessException

GetWindowText

public static java.lang.String GetWindowText(HWND hwnd)
                                      throws NativeException,
                                             java.lang.IllegalAccessException
Throws:
NativeException
java.lang.IllegalAccessException

setWindowPos

public static boolean setWindowPos(HWND hwnd,
                                   int hWndInsertAfter,
                                   int x,
                                   int y,
                                   int cx,
                                   int cy,
                                   int wFlags)
                            throws NativeException,
                                   java.lang.IllegalAccessException
BOOL SetWindowPos( HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags );

Parameters:
hwnd - HWND
hWndInsertAfter - int
x - int Specifies the new position of the left side of the window.
y - int Specifies the new position of the top of the window.
cx - int Specifies the new width of the window.
cy - int Specifies the new height of the window.
wFlags - int Specifies sizing and positioning options.
Returns:
HWND
Throws:
NativeException
java.lang.IllegalAccessException

SetWindowLong

public static int SetWindowLong(HWND hwnd,
                                int nIndex,
                                LONG dwNewLong)
                         throws NativeException,
                                java.lang.IllegalAccessException
LONG SetWindowLong( HWND hWnd, int nIndex, LONG dwNewLong );

Throws:
NativeException
java.lang.IllegalAccessException

RegisterClass

public static LONG RegisterClass(WNDCLASS lpWndClass)
                          throws NativeException,
                                 java.lang.IllegalAccessException
 RegisterClass Function

The RegisterClass function registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function.

The RegisterClass function has been superseded by the RegisterClassEx function. You can still use RegisterClass, however, if you do not need to set the class small icon.

Syntax

    ATOM RegisterClass(      

        CONST WNDCLASS *lpWndClass
    );

Parameters

    lpWndClass
        [in] Pointer to a WNDCLASS structure. You must fill the structure with the appropriate class attributes before passing it to the function. 

Return Value

    If the function succeeds, the return value is a class atom that uniquely identifies the class being registered. This atom can only be used by the CreateWindow, CreateWindowEx, GetClassInfo, GetClassInfoEx, FindWindow, FindWindowEx, and UnregisterClass functions and the IActiveIMMap::FilterClientWindows method.

    If the function fails, the return value is zero. To get extended error information, call GetLastError. 
 

Returns:
Throws:
java.lang.IllegalAccessException
NativeException

LoadIcon

public static LONG LoadIcon(LONG hInstance,
                            java.lang.String lpIconName)
                     throws NativeException,
                            java.lang.IllegalAccessException
    HICON LoadIcon(      

            HINSTANCE hInstance,
            LPCTSTR lpIconName
        );

    Parameters

        hInstance
            [in] Handle to an instance of the module whose executable file contains the icon to be loaded. This parameter must be NULL when a standard icon is being loaded. 
        lpIconName
            [in] 

            Pointer to a null-terminated string that contains the name of the icon resource to be loaded. Alternatively, this parameter can contain the resource identifier in the low-order word and zero in the high-order word. Use the MAKEINTRESOURCE macro to create this value.

            To use one of the predefined icons, set the hInstance parameter to NULL and the lpIconName parameter to one of the following values.

            IDI_APPLICATION
                Default application icon.
            IDI_ASTERISK
                Same as IDI_INFORMATION.
            IDI_ERROR
                Hand-shaped icon.
            IDI_EXCLAMATION
                Same as IDI_WARNING.
            IDI_HAND
                Same as IDI_ERROR. 
            IDI_INFORMATION
                Asterisk icon.
            IDI_QUESTION
                Question mark icon.
            IDI_WARNING
                Exclamation point icon.
            IDI_WINLOGO
                Windows logo icon. Windows XP: Default application icon.
            IDI_SHIELD
                Security Shield icon. 

    Return Value

        If the function succeeds, the return value is a handle to the newly loaded icon.

        If the function fails, the return value is NULL. To get extended error information, call GetLastError.

        

Throws:
java.lang.IllegalAccessException
NativeException

LoadIcon

public static LONG LoadIcon(LONG hInstance,
                            int ressource)
                     throws NativeException,
                            java.lang.IllegalAccessException
Throws:
NativeException
java.lang.IllegalAccessException

SendMessage

public static LRESULT SendMessage(HWND hWnd,
                                  UINT Msg,
                                  WPARAM wParam,
                                  LPARAM lParam)
                           throws NativeException,
                                  java.lang.IllegalAccessException
 SendMessage Function

The SendMessage function sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message.

To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread's message queue and return immediately, use the PostMessage or PostThreadMessage function.

Syntax

    LRESULT SendMessage(      

        HWND hWnd,
        UINT Msg,
        WPARAM wParam,
        LPARAM lParam
    );

Parameters

    hWnd
        [in] Handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows.
    Msg
        [in] Specifies the message to be sent.
    wParam
        [in] Specifies additional message-specific information.
    lParam
        [in] Specifies additional message-specific information.

Return Value

    The return value specifies the result of the message processing; it depends on the message sent.
    

Throws:
java.lang.IllegalAccessException
NativeException

JNative v1.3 project : see http://jnative.sf.net