8 messages in net.java.dev.jna.users[jna-users] call to a native Win32 fu...
FromSent OnAttachments
lemmel lemmelJun 3, 2009 8:09 am 
Timothy WallJun 3, 2009 9:02 am 
lemmel lemmelJun 4, 2009 2:10 am 
Timothy WallJun 4, 2009 3:30 am 
lemmel lemmelJun 4, 2009 6:04 am 
lemmel lemmelJun 5, 2009 1:34 am 
lemmel lemmelJun 5, 2009 1:55 am 
lemmelJun 8, 2009 6:26 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:[jna-users] call to a native Win32 function behave randomlyActions...
From:lemmel lemmel (lem_@hotmail.com)
Date:Jun 3, 2009 8:09:44 am
List:net.java.dev.jna.users

Hi, I'm a long user of JNI (several dll, and even used SWIG) and I
wanted test/use JNA (just a non time critical call), but I got stuck at the
start (and so this is a beginner mistake:-) ). But it seems that I don't
performed the call correctly : most of the time the call seems to block at the
call to Native.loadLibrary, some times it blocks at the function call (that one
I want to use), and rarely the call succeeds. Can someone give an help ?It is
easy to built a test case :- take the test code and its dependencies: Shell32-
add in the following methods to the Shell32 class : public int
SHGetSpecialFolderPathA( // documentation available at
http://msdn.microsoft.com/en-us/library/bb762204(VS.85).aspx Pointer
hwndOwner, byte[] lpszPath, int csidl, int fCreate );
int SHGetFolderPathA( // another test ... Pointer hwndOwner,
int nFolder, Pointer hToken, int dwFlags, byte[]
pszPath );- use the following main :public static void main(String[] args)
{ byte buffer[] = new byte[3072]; Shell32 shell32 = Shell32.INSTANCE;
for(int i = 0; i < 3072; i++) buffer[i] = 65; // I already tried with a
buffer filled with 0 if (Platform.isWindows()) { int retour =
shell32.SHGetSpecialFolderPathA(Pointer.NULL, buffer, 16, 0);
System.out.println("value : "+Native.toString(buffer)); }}

_________________________________________________________________ Inédit ! Des Emoticônes Déjantées! Installez les dans votre Messenger ! http://www.ilovemessenger.fr/Emoticones/EmoticonesDejantees.aspx