7 messages in net.java.dev.jna.usersProblem accessing Wintab32.dll
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:Problem accessing Wintab32.dllActions...
From:Michele Croci (mcr@gmail.com)
Date:Oct 29, 2007 8:05:22 am
List:net.java.dev.jna.users

Hi all,

I'm trying to read some data from a tabletPC accessing wintab32.dll

At the moment I can recognize when there is some data coming from the tablet PC but I'm not able to get the right values for this data!

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 my Java-class:

public interface Wintab32 extends W32API {

public Wintab32 INSTANCE = (Wintab32) Native.loadLibrary("wintab32", Wintab32.class);

int HWND_BROADCAST = 0xffff;

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

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

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

public static class Logcontexta extends Structure { ... }

public static class Packet extends Structure { ... }

public static class Orientation extends Structure{ ... }

public static class Rotation extends Structure{ ... }

}

}

I call the class in this way:

Wintab32 lib = Wintab32.INSTANCE; HDC hdc = new HDC();

public void open() { HWND hwnd = new HWND(); hwnd.setPointer(new IntByReference(Wintab32.HWND_BROADCAST ).getPointer(0)); int packetmode = 0;

Logcontexta lg = new Logcontexta(); lib.WTInfoA(3, 0, lg); lg.lcName = "Rule Digitizing"; lg.lcPktMode= packetmode; lg.lcPktData = 0x180; lg.lcMoveMask = 0; lg.lcBtnUpMask = lg.lcBtnDnMask;

hdc=lib.WTOpenA(hwnd, lg, true); }

public void close() { boolean ret = lib.WTClose(hdc); }

public long[] getPackets(){ if (hdc == null) return null;

long[] val = new long[4]; int max=1; Packet p = new Packet(); p.pkContext=hdc; int number = lib.WTPacketsGet(hdc ,max,p); if (number>0){ val[0] = p.pkX; val[1] = p.pkY;

return val; }

return null; }

I get alway ' 0 ' for x and y values. Maybe the problem is in the definition of my custom structures. Here the conversion I have made:

DWORD -> int UINT -> int LONG -> long BOOL -> int

Are they right?

Thank you for your attention.

-- Michele