MFC DDE开发中令人迷惑的问题?

在用MFC(ddeml)开发DDE中,遇到一个令人迷惑的问题, ddeml提供的一些命令,在时钟函数里或按钮事件里运行正常,可是在线程里运行就出现如下错误:

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

下面是两段代码:

//时钟
void YD::TimerProc(long hwnd,long nIDEvent,long uElapse,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);
 }
}

//线程
UINT YD::YFDDE(LPVOID pParam)
{
    CString strData;
 static AAAA=0;

  while(1)
  {
 if (AAA.G_connection )
 {
  strData.Format("%d", AAAA++);
        AAA.G_connection->Advise("aaa",(char *)(const char *)strData);

  Sleep(3000);       
 } 
  
  }
  return 0;
}

线程和时钟的代码完全一样,可是运行结果不一样,难到ddlml有特殊的限制?这是MSDN说明的理由:

The application used a data handle initialized with a different item name handle than was required by the transaction.

 

 

 

The application used a data handle that was initialized with a different clipboard data format 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.

我也没有弄明白什么意思。

对了,有谁知道侯捷老师的《Windows DDE 动态资料交换》电子版图书在哪里下载?

 

你可能感兴趣的:(MFC DDE开发中令人迷惑的问题?)