I have function implementation of DDE client using Win Api in C#. Everything works fine in case that I call DdeInitializeW
and DdeConnect
in single thread.
Specifically, these are wrapper definitions:
[DllImport("user32.dll")]
protected static extern int DdeInitializeW(ref int id, DDECallback cb, int afcmd, int ulres);
[DllImport("user32.dll")]
static extern IntPtr DdeConnect(
int idInst, // instance identifier
IntPtr hszService, // handle to service name string
IntPtr hszTopic, // handle to topic name string
IntPtr pCC // context data
);
If I called DdeInitializeW
and DdeConnect
in different threads, DdeConnect
return null pointer.
Also, if I called both of them (established DDE connection) in one thread, I can't use this DDE channel in another thread (i'm getting INVALIDPARAMETER
DDE error).
As I said, everything works without problems in single thread.