7 messages in net.java.dev.jna.usersRe: [jna-users] Problem accessing Win...
FromSent OnAttachments
Michele CrociOct 29, 2007 8:05 am 
Timothy WallOct 29, 2007 11:54 am 
Michele CrociOct 30, 2007 4:08 am 
Timothy WallOct 30, 2007 6:50 am 
Michele CrociOct 30, 2007 8:50 am 
Michele CrociOct 31, 2007 10:05 am 
Michele CrociOct 31, 2007 10:15 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Problem accessing Wintab32.dllActions...
From:Timothy Wall (twal@dev.java.net)
Date:Oct 30, 2007 6:50:00 am
List:net.java.dev.jna.users

On Oct 30, 2007, at 7:09 AM, Michele Croci wrote:

I'm sorry for disturbing you again but I'm still not able to get the correct data. Can you check if the method declarations in the Java-interface are correct?

Here the specification of (one part of) the dll:

HCTX WINAPI WTOpenA(HWND hWnd, LPLOGCONTEXTA lpLogCtx, BOOL fEnable)

BOOL WINAPI WTClose(HCTX hCtx)

UINT WINAPI WTInfoA(UINT wCategory, UINT nIndex, LPVOID lpOutput)

int WINAPI WTPacketsGet(HCTX hCtx, int cMaxPkts, LPVOID lpPkts)

Here (one part of) my Java-interface:

public interface Wintab32 extends W32API {

HDC WTOpenA(HWND hwnd, Logcontexta s, boolean b);

As a matter of style, I'd recommend dropping the "A" suffix (assuming there's a "W" version available) and using the W32API default options when loading your library.

I'd also recommend naming your structures exactly as they are named in the C headers (e.g. LOGCONTEXT vs Logcontext).

boolean WTClose(HDC hDC);

int WTInfoA(int category, int index, Logcontexta s);

int WTPacketsGet(HDC hdc, int max, Packet[] p);

}

}

WTOpenA, WTInfoA and WTClose seems to work correctly, but WTPacketsGet doesn't.

You don't provide the C definition of Packet, nor the Java definition.

* make sure your structures are declared within the library interface definition * from http://www.sonycsl.co.jp/projects/ar/restricted/wintabl.html, I see Packet[] is a block of memory of size "max*sizeof(PACKET)", so I would guess that your structure definition for PACKET is off.

Given this: typedef struct tagPACKET {

HCTX pkContext; // Pointer/PointerType UINT pkStatus; // int LONG pkTime; // int WTPKT pkChanged; // int (32-bit field) UINT pkSerialNumber; // int UINT pkCursor; // int DWORD pkButtons; //int DWORD pkX; //int DWORD pkY; //int DWORD pkZ; //int UINT pkNormalPressure; //int UINT pkTangentPressure; //int ORIENTATION pkOrientation; // inline structure { int,int,int }

ROTATION pkRotation; /* 1.1 */ // structure definition missing

} PACKET;

Your docs probably have a complete description of the ROTATION structure.