4 messages in net.java.dev.jna.usersRE : Re: [jna-users] Troubles with sw...
FromSent OnAttachments
jean-michel TApr 29, 2008 12:17 pm 
Timothy WallApr 29, 2008 12:30 pm 
jean-michel TApr 29, 2008 12:53 pm 
jean-michel TApr 30, 2008 5: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 : Re: [jna-users] Troubles with swing applications?Actions...
From:jean-michel T (jmto@yahoo.fr)
Date:Apr 30, 2008 5:15:20 am
List:net.java.dev.jna.users

I achieved to reproduce my error on a sandbox. I have then in my code:

libWrapper = LibCommWrapper.INSTANCE libWrapper.initialize_dll(); new LoginFrame().displayView(); int value = libWrapper.authenticateUser_dll(new String(password).getBytes());

The LoginFrame class is a simple frame that does'nt do anything but uses the
class WindowsUtils (in the jar jna-examples) to create round borders with the
method :

WindowUtils.setWindowMask(this, getArea(getSize()));

If i run this code i get the authentication error with an int having value of 10
as a result (while the initialization was ok).

If i run this following almost same version which does not call the frame using
JNA

libWrapper = LibCommWrapper.INSTANCE // libWrapper.initialize_dll(); new LoginFrame().displayView(); int value = libWrapper.authenticateUser_dll(new String(password).getBytes());

.. then it appears that the authentication succeeds and I got a 0 as an answer.

Doing the same test with a simple frame created in Matisse and not using jna
will work in both cases

Could it be related to the examples jar?

Jean-Michel

Timothy Wall <twal@dev.java.net> a écrit : Are the two modules using the
same version of JNA?

You can check the version of jna.jar by doing

java -jar jna.jar

Hello.

I have something really strange happening with a dll. I use it to connect to a smart card prototype and unlock it with a function called :

authenticate_user

The method returns 0 in case of succes and 10 if an authentication failed (for any reason I guess).

Now here is what is really strange.

First I created a project which uses JNA, loads the dll, initialize it (another method from the api) and then tries to connect to the card. It works really well, i get a 0 as a return and can see ma card unlocked.

Next step was to create a swing application where i could enter my unlock code. It's part of another bigger application and uses JNA to have round shaped gui ' s. There with the exactly same code I have a 10 as a return for my function.

I did many tests and I thik this problem only happens when i start using the swing frames, as if I call my method just before it keeps working well.

Another point is that if i use a really simple gui (created with matisse on netbeans) and which does'nt use jna, it seems that i don't have the same problem.

I wonder if :

1) Using jna for the gui and to call my lib at the same time could cause some trouble in the data i send to my card?

2)There are some known problems of that type in making jna work with a swing application.

By advance, thank you for your answers.

Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. Téléchargez la version beta.