What is confusing in MFC DDE development?

xiaoxiao2021-03-06  15

In developing DDE with MFC (DDEML), encounter a confusing problem, some commands provided by DDEML, run normal in the clock function or button event, but running in the thread, the following error:

"A parameter failed to be validated by the ddeml."

Below is two code:

// Clock Void Yd :: TimerProc (long hwnd, long nidevent, long uLapse, long lptimerfunc) {cstring strdata; static aaaa = 0; if (aaa.g_connection) {strdata.format ("T% D", AAAA ); AAA.G_Connection-> Advise ("AAA", (CHAR *) (const char *) strdata);}}

// Thread Uint Yd :: YFDDE (LPVOID PPARAM) {cstring strdata; static aaaa = 0;

While (1) {if (aaa.g_connection) {stradata.format ("% D", AAAA ); AAA.G_Connection-> Advise ("AAA", (CHAR *) STRDATA);

Sleep (3000);}}} Return 0;

The thread and the clock code are exactly the same, but the result is different, it is difficult to have special restrictions on DDLML? This is the reason for MSDN:

The application used a data handle initialized with a different item name handle Than Was Required by The Transaction.

.....................

The Application Used A Client-Side Conversation Handle with a Server-Side Function Or Vice Versa.

The Application Used A Freed Data Handle or String Handle.

More Than One Instance of the Application Used The Same Object.

I haven't figured out what it means.

By the way, who knows that Houjie teacher's "Windows DDE Dynamic Information Exchange" electronic version of the book is downloaded?

转载请注明原文地址:https://www.9cbs.com/read-48028.html

New Post(0)