Hi,
I want to implement a DDE server in VC++ and then use it from a
Java application to provide real time data to excel or any other DDE
client .
For this a dll was created with 3 different functions in VC++
for
1.. Ddeml initialization - for initializing the ddeml dll
2.. CallDdePostAdvise - Function to call the DdePostAdvise method - to
notify the clients that data have been changed
3.. DdeCallBack method - callback method of the server
Now I access these functions from Java application using JNI. in the order
First Ddeml initialization to initialize the ddeml library and
register the application.
Then whenever there is any change in data that is being
provided to clients I call CallDdePostAdvise method so that it calls
DdePostAdvise method of ddeml library.
Now if a client tries to connect to the dde server and calls DdeConnect
method after all initializations have been done then the method should
return a valid conversation handle .But in practice the DdeConnect method
never returns owing to a bug in the Dde. Which states that when
DdeConnect method calls SendMessage method, the SendMessage method puts a
message in the message queue of the target thread and block the calling
thread . Now if the target thread doesn't have a message loop it will
never get processed and the DdeConnect method will never return.
Please follow the link for detail about the bug.
http://support.microsoft.com/default...b;EN-US;136218
The current solution to this problem is to put a message loop in the target
thread i.e. in the Dde Server
But according to requirement VC++ function is to return to Java
after initialization is done and then call the DdePostAdvise method using
JNI whenever required. So it is not possible to keep a message loop running
in VC++ code.
Can anyone help me out or suggest any alternative to follow.
Thanks and Regards
Vijay