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

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

在用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 动态资料交换》电子版图书在哪里下载?

相关文章
|
9天前
|
云安全 监控 安全
|
14天前
|
机器学习/深度学习 人工智能 自然语言处理
Z-Image:冲击体验上限的下一代图像生成模型
通义实验室推出全新文生图模型Z-Image,以6B参数实现“快、稳、轻、准”突破。Turbo版本仅需8步亚秒级生成,支持16GB显存设备,中英双语理解与文字渲染尤为出色,真实感和美学表现媲美国际顶尖模型,被誉为“最值得关注的开源生图模型之一”。
1558 8
|
8天前
|
人工智能 安全 前端开发
AgentScope Java v1.0 发布,让 Java 开发者轻松构建企业级 Agentic 应用
AgentScope 重磅发布 Java 版本,拥抱企业开发主流技术栈。
515 12
|
20天前
|
人工智能 前端开发 算法
大厂CIO独家分享:AI如何重塑开发者未来十年
在 AI 时代,若你还在紧盯代码量、执着于全栈工程师的招聘,或者仅凭技术贡献率来评判价值,执着于业务提效的比例而忽略产研价值,你很可能已经被所谓的“常识”困住了脚步。
1193 88
大厂CIO独家分享:AI如何重塑开发者未来十年