com.partnersoft.os.windows
Class Win32Lib

java.lang.Object
  extended by com.partnersoft.os.windows.Win32Lib

public class Win32Lib
extends java.lang.Object

Windows API calls.

Author:
Russell Cagle Copyright 2006 Partner Software, Inc.

Nested Class Summary
static class Win32Lib.MSG
           
 
Field Summary
static int COINIT_APARTMENTTHREADED
           
static int COINIT_DISABLE_OLE1DDE
           
static int COINIT_MULTITHREADED
           
static int COINIT_SPEED_OVER_MEMORY
           
static java.lang.String dllName
          Should look for PartnerWin32.dll.
static long PM_NOREMOVE
           
static long PM_REMOVE
           
static long WS_BORDER
           
static long WS_CAPTION
           
static long WS_CHILD
           
static long WS_CHILDWINDOW
           
static long WS_CLIPCHILDREN
           
static long WS_CLIPSIBLINGS
           
static long WS_DISABLED
           
static long WS_DLGFRAME
           
static long WS_GROUP
           
static long WS_HSCROLL
           
static long WS_ICONIC
           
static long WS_MAXIMIZE
           
static long WS_MAXIMIZEBOX
           
static long WS_MINIMIZE
           
static long WS_MINIMIZEBOX
           
static long WS_OVERLAPPED
           
static long WS_OVERLAPPEDWINDOW
           
static long WS_POPUP
           
static long WS_POPUPWINDOW
           
static long WS_SIZEBOX
           
static long WS_SYSMENU
           
static long WS_TABSTOP
           
static long WS_THICKFRAME
           
static long WS_TILED
           
static long WS_TILEDWINDOW
           
static long WS_VISIBLE
           
static long WS_VSCROLL
           
 
Constructor Summary
Win32Lib()
           
 
Method Summary
static boolean checkNativeLibrary()
          Lazily loads the native library and returns success or failure.
static long CoInitializeEx(int coinit)
          Initializes the COM subsystem for this thread.
static long CreateWindow(java.lang.String className, java.lang.String windowName, long style, int x, int y, int width, int height, long parentWindow, long menu, long hinstance, long lparam)
          Creates a native Windows window.
static boolean DestroyWindow(long hwnd)
           
static long DispatchMessage(Win32Lib.MSG msg)
           
static long GetLastError()
          Always seems to return 0.
static boolean GetMessage(Win32Lib.MSG msg, long hwnd, long msgFilterMin, long msgFilterMax)
           
static long GetModuleHandle(java.lang.String moduleName)
           
static long GetProcAddress(long library, java.lang.String procName)
           
static long LoadLibrary(java.lang.String moduleName)
           
static boolean PeekMessage(Win32Lib.MSG msg, long hwnd, long msgFilterMin, long msgFilterMax, long removeMessage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dllName

public static final java.lang.String dllName
Should look for PartnerWin32.dll.

See Also:
Constant Field Values

COINIT_MULTITHREADED

public static final int COINIT_MULTITHREADED
See Also:
Constant Field Values

COINIT_APARTMENTTHREADED

public static final int COINIT_APARTMENTTHREADED
See Also:
Constant Field Values

COINIT_DISABLE_OLE1DDE

public static final int COINIT_DISABLE_OLE1DDE
See Also:
Constant Field Values

COINIT_SPEED_OVER_MEMORY

public static final int COINIT_SPEED_OVER_MEMORY
See Also:
Constant Field Values

PM_REMOVE

public static final long PM_REMOVE
See Also:
Constant Field Values

PM_NOREMOVE

public static final long PM_NOREMOVE
See Also:
Constant Field Values

WS_OVERLAPPED

public static final long WS_OVERLAPPED
See Also:
Constant Field Values

WS_POPUP

public static final long WS_POPUP
See Also:
Constant Field Values

WS_CHILD

public static final long WS_CHILD
See Also:
Constant Field Values

WS_MINIMIZE

public static final long WS_MINIMIZE
See Also:
Constant Field Values

WS_VISIBLE

public static final long WS_VISIBLE
See Also:
Constant Field Values

WS_DISABLED

public static final long WS_DISABLED
See Also:
Constant Field Values

WS_CLIPSIBLINGS

public static final long WS_CLIPSIBLINGS
See Also:
Constant Field Values

WS_CLIPCHILDREN

public static final long WS_CLIPCHILDREN
See Also:
Constant Field Values

WS_MAXIMIZE

public static final long WS_MAXIMIZE
See Also:
Constant Field Values

WS_CAPTION

public static final long WS_CAPTION
See Also:
Constant Field Values

WS_BORDER

public static final long WS_BORDER
See Also:
Constant Field Values

WS_DLGFRAME

public static final long WS_DLGFRAME
See Also:
Constant Field Values

WS_VSCROLL

public static final long WS_VSCROLL
See Also:
Constant Field Values

WS_HSCROLL

public static final long WS_HSCROLL
See Also:
Constant Field Values

WS_SYSMENU

public static final long WS_SYSMENU
See Also:
Constant Field Values

WS_THICKFRAME

public static final long WS_THICKFRAME
See Also:
Constant Field Values

WS_GROUP

public static final long WS_GROUP
See Also:
Constant Field Values

WS_TABSTOP

public static final long WS_TABSTOP
See Also:
Constant Field Values

WS_MINIMIZEBOX

public static final long WS_MINIMIZEBOX
See Also:
Constant Field Values

WS_MAXIMIZEBOX

public static final long WS_MAXIMIZEBOX
See Also:
Constant Field Values

WS_TILED

public static final long WS_TILED
See Also:
Constant Field Values

WS_ICONIC

public static final long WS_ICONIC
See Also:
Constant Field Values

WS_SIZEBOX

public static final long WS_SIZEBOX
See Also:
Constant Field Values

WS_OVERLAPPEDWINDOW

public static final long WS_OVERLAPPEDWINDOW
See Also:
Constant Field Values

WS_TILEDWINDOW

public static final long WS_TILEDWINDOW
See Also:
Constant Field Values

WS_POPUPWINDOW

public static final long WS_POPUPWINDOW
See Also:
Constant Field Values

WS_CHILDWINDOW

public static final long WS_CHILDWINDOW
See Also:
Constant Field Values
Constructor Detail

Win32Lib

public Win32Lib()
Method Detail

CoInitializeEx

public static long CoInitializeEx(int coinit)
Initializes the COM subsystem for this thread. If we do more COM stuff then we might have to be smarter about this, and the single-threaded model could lead to problems.

Returns:
the HRESULT of the call to CoInitialize().

CreateWindow

public static long CreateWindow(java.lang.String className,
                                java.lang.String windowName,
                                long style,
                                int x,
                                int y,
                                int width,
                                int height,
                                long parentWindow,
                                long menu,
                                long hinstance,
                                long lparam)
Creates a native Windows window.

Parameters:
className -
windowName -
style -
x -
y -
width -
height -
parentWindow -
menu -
hinstance -
lparam -
Returns:
the HWND of the native window, or 0 if the call failed.

DestroyWindow

public static boolean DestroyWindow(long hwnd)

DispatchMessage

public static long DispatchMessage(Win32Lib.MSG msg)

GetLastError

public static long GetLastError()
Always seems to return 0. I might take it out.

Returns:
the last error, or possibly always 0.

GetMessage

public static boolean GetMessage(Win32Lib.MSG msg,
                                 long hwnd,
                                 long msgFilterMin,
                                 long msgFilterMax)

GetModuleHandle

public static long GetModuleHandle(java.lang.String moduleName)

GetProcAddress

public static long GetProcAddress(long library,
                                  java.lang.String procName)

LoadLibrary

public static long LoadLibrary(java.lang.String moduleName)

PeekMessage

public static boolean PeekMessage(Win32Lib.MSG msg,
                                  long hwnd,
                                  long msgFilterMin,
                                  long msgFilterMax,
                                  long removeMessage)

checkNativeLibrary

public static boolean checkNativeLibrary()
Lazily loads the native library and returns success or failure. Only tries to load the library once; subsequent calls return the success or failure of the first call.