developers

    Forum Stats

  • 3,874,067 Users
  • 2,266,672 Discussions
  • 7,911,721 Comments

Discussions

JAVA NATIVE ACESS

843829
843829 Member Posts: 49,201
edited Sep 9, 2010 2:13AM in Java Native Interface (JNI)
HI,
I have a big problem with Java Native Access when call a function in dll file.

First, I have files xxx.dll,xxx.h (written by my partner) and document for functions.
Second, I am using JNA (java native access) to call the functions.
But, it has some functions that function's result is pass over memory of window.
In document description, it has tow constant: WM_USER = 0x0400, WM_USER_ENV = (WM_USER + 0)
I have just learn, so i don't know about that.

So, my problem is " i don't know how to get result of function that passed over to memory window )

This is my header file: “MFSIOCTL.h”
-----------------------------------------------------------------------------------------------------------------------------------------------
// Command

#define CMD_VERSION 'V'
#define CMD_SENSOR 'S'
#define CMD_FLICKER 'L'
#define CMD_GETSTATUS 'A'

#define DEST_1 '1' //front door / Card Reader Flicker Lamp
#define DEST_2 '2' //UPPER FRAME IN POSITION(CDM) / Printer Lamp
#define DEST_3 '3' //Receipt Exit Sensor / Cheque Lamp
#define DEST_4 '4' //Cheque Door Sensor / A4 or Cash Lamp
#define DEST_5 '5' //Bill Hopper Sensor - 2006/06/20 added

#define DEST_ALL '0' //Get all Status

//switch status or FLicker Lamp on/off
#define OPEN '0' //Flicker Off
#define CLOSE '1' //Flicker On

//added at 2004/09/17
#define WM_MFS_IO_OFFSET (WM_USER+0x900)
#define WM_MFS_IO_CHG_EVT (WM_MFS_IO_OFFSET + 0)


extern "C" __declspec(dllexport) BOOL __stdcall MFSIO_Open(HWND hWnd,BYTE comport);
extern "C" __declspec(dllexport) BOOL __stdcall MFSIO_Close(void);
extern "C" __declspec(dllexport) BOOL __stdcall MFSIO_GetVersion(LPSTR lpFWVer,LPSTR lpDLLVer);
extern "C" __declspec(dllexport) BOOL __stdcall MFSIO_LED(BYTE LEDNum,BYTE OnOff);
extern "C" __declspec(dllexport) BYTE __stdcall MFSIO_GetStatus(void);
-----------------------------------------------------------------------------------------------------------------------------------------------
And this is window message define:
--- Definition of Window Message
: Message is defined in “MFSIOCTL.h” as bellows.
#define WM_MFS_IO_OFFSET (WM_USER+0x900)
#define WM_MFS_IO_CHG_EVT (WM_MFSS_IO_OFFSET + 0)
MESSAGE WPARAM(Indicator ofDoor or Media) LPARAM(Status of Door or Media)
WM_MFSS_IO_CHG_EVT DEST_1 or OPEN or CLOSE
DEST_2 or
DEST_3 or
DEST_4



Refer to “MFSIOCTL.h”
-----------------------------------------------------------------------------------------------------------------------------------------------
In functions, i don't know that they relative with parameters as "WM_MSF_IO_OFFSET, WM_MFS_IO_CHG_EVT'' and parameters use for what?
How to get value of window message?

Please help me. Thank you.

Edited by: QuocTan on Sep 8, 2010 9:31 PM

Edited by: QuocTan on Sep 8, 2010 9:34 PM

Comments

  • EJP
    EJP Member Posts: 32,924 Gold Crown
    edited Sep 9, 2010 2:13AM
    But, it has some functions that function's result is pass over memory of window.
    I have no idea what that means. Please try again in standard English.
    In document description, it has two constant:
    WM_USER = 0x0400, WM_USER_ENV = (WM_USER + 0)
    These are Windows constants. I don't understand the relevance.
    So, my problem is " i don't know how to get result of function that passed over to memory window)
    *My* problem is that this is about the 4th time I've read this statement and it doesn't make any sense. What is a 'memory window'? What is 'memory of window'?
    #define WM_MFS_IO_OFFSET (WM_USER+0x900)
    #define WM_MFS_IO_CHG_EVT (WM_MFS_IO_OFFSET + 0)
    If these lines are the problem, they have nothing whatsoever to do with JNI or this forum.
    In functions, i don't know that they relative with parameters as "WM_MSF_IO_OFFSET, WM_MFS_IO_CHG_EVT'' and parameters use for what?
    Eh?
    How to get value of window message?
    What?
    Please help me.
    I cannot help either of you until you take the trouble to express yourselves clearly in standard English. Your problem doesn't appear to have anything to do with JNI or JNA. More likely it is an elementary Windows API programming problem, which is irrelevant to this forum and this site.
This discussion has been closed.
developers