Declaring the Parameter as Type Object

The following shows how to declare WinHelp by declaring dwData as type Object:

  /** @dll.import("USER32") */
  static native boolean WinHelp(int hwnd, String szHelpFile, 
                                int cmd, Object dwData);

When WinHelp is invoked, J/Direct will use the run-time type to determine how to translate dwData. The following table describes how the types are translated.

Type Translated as
java.lang.Integer 4-byte integer
java.lang.Boolean 4-byte BOOL
java.lang.Char CHAR (or WCHAR if the unicode or ole modifiers are in effect)
java.lang.Short 2-byte SHORT
java.lang.Float 4-byte FLOAT
java.lang.String LPCSTR (or LPCWSTR if the unicode or ole modifier is in effect)
java.lang.StringBuffer LPSTR (or LPWSTR if the unicode or ole modifier is in effect)
byte[] BYTE*
char[] CHAR* (or WCHAR* if the unicode or ole modifier is in effect)
short[] SHORT*
int[] INT*
long[] __int64
float[] float*
double[] double*
@dll.struct pointer to structure