Package com.jinvoke.win32

Provides helper classes that contain J/Invoke declaration of functions for common Win32 DLLs.

See:
          Description

Class Summary
Advapi32  
Gdi32  
Kernel32  
Psapi  
Shell32  
User32  
Version  
WinConstants  
WinInet  
Winmm  
 

Package com.jinvoke.win32 Description

Provides helper classes that contain J/Invoke declaration of functions for common Win32 DLLs. You just need to import the class you need and directly call the stubbed out Java method corresponding to the Win32 API you want to call.

The available APIs are declared in a set of classes, one for each Windows DLL, as shown in the following table.

J/Invoke Win32 Helper Class

DLL Name

Functionality

com.jinvoke.win32.Kernel32

KERNEL32.DLL

Base services

com.jinvoke.win32.Gdi32

GDI32.DLL

Graphics device interface

com.jinvoke.win32.User32

USER32.DLL

User interface

com.jinvoke.win32.Advapi32

ADVAPI32.DLL

Crypto API, event logging

com.jinvoke.win32.Shell32

SHELL32.DLL

Windows shell API

com.jinvoke.win32.Winmm

WINMM.DLL

Multimedia

com.jinvoke.win32.WinInet

WININET.DLL

Internet

The Win32 API uses many constants and structures which are defined in com.jinvoke.win32.WinConstants class and the com.jinvoke.win32.structs package respectively.

For instance, MessageBox is contained in USER32 .DLL and therefore declared in the User32 class. Import this class and you can call MessageBox directly. Thus, the MessageBox Win32 API could be called from Java as shown below:

package jinvoke.tutorial;



import com.jinvoke.win32.User32;

import static com.jinvoke.win32.WinConstants.*;



public class CallingWin32API {

    public static void main(String[] args) {

        User32.MessageBox(0, "This MessageBox is a native Win32 MessageBox", "Caption", MB_ICONINFORMATION|MB_OK);

    }

}