Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#17 How can I get msg that send by DLL?

open
nobody
Java side (9)
5
2010-10-21
2010-10-21
ever
No

Dear Thubb:
I from China, so sorry for my worse English, I need your help.
I use Jnative to call dll, however, the dll communicate with msg, just like this in C++ Code:
--------------------------------------------------------------------------------------------
UINT nReplyMsg = RegisterWindowMessage("SCDemo Reply Message");
BEGIN_MESSAGE_MAP(CSCDemoDlg, CDialog)
ON_REGISTERED_MESSAGE(nReplyMsg, OnReply)
END_MESSAGE_MAP()
--------------------------------------------------------------------------------------------
Method OnReply() can be called by msg, and my java code can't work, just like this:
--------------------------------------------------------------------------------------------
nReplyMsg = User32.RegisterWindowMessage("SCDemo Reply Message");
JNative n = null;
final MSG msg = new MSG();
try {
nReplyMsg = User32.RegisterWindowMessage("SCDemo Reply Message");
hwnd = User32.GetForegroundWindow();
n = new JNative("SCStock.dll", "SCInit");
n.setRetVal(Type.INT);
Pointer pointer = new SC_InitAsk().getInitAskData();
n.setParameter(0, pointer);
n.setParameter(1, pointer.getSize());
n.invoke();

while (true) {
int message = User32.GetMessage(msg, hwnd, nReplyMsg, nReplyMsg);
System.out.println("msg.size = " + msg.getSizeOf());
}
--------------------------------------------------------------------------------------------

I must have mistake the usage of "MSG" class and "User32.GetMessage", please help me , and hope you write back,
thank you very much!!!!!!

Discussion