SendMessageTimeout WIN64 [英] SendMessageTimeout WIN64
问题描述
我有一个程序,我试图使用SendMessageTimeout将文件名发送到另一个应用程序。 当我运行这个inw WIN32它运行正常,但是当我在WIN64中编译它时,数据在SendMessageTimeout函数期间以某种方式被破坏。
基本上,我这样做:
I have a program where I am trying to send a filename to another application using SendMessageTimeout. When I run this inw WIN32 it runs fine, but when I compile it in WIN64 the data somehow gets destroyed during the SendMessageTimeout function. Basically, I do this:
COPYDATASTRUCT cds;
COPYDATASTRUCT cds;
PDWORD_PTR结果;
PDWORD_PTR result;
char * file =" file.dat";
char *file="file.dat";
cds.dwData = 1;
cds.dwData = 1;
cds.cbData = strlen(file)+1;
cds.cbData = strlen(file)+1;
cds.lpData = file;
cds.lpData = file;
status = SendMessageTimeout(hWnd,WM_COPYDATA,0,(LPARAM)& cds,SMTO_NORMAL,2000,result) ;
status = SendMessageTimeout (hWnd, WM_COPYDATA, 0, (LPARAM) &cds, SMTO_NORMAL, 2000, result);
如果我在WIN32中运行它可以正常工作。 如果我在WIN64中运行它,接收程序将获得一个空字符串,当我从SendMessgeTimeout返回时,cds.lpData已设置为全零(空值)。
If I run this in WIN32 it works fine. If I run it in WIN64 the receiving program gets an empty string, and when I return from SendMessgeTimeout the cds.lpData has been set to all zeros (nulls).
如果我将SendMessageTimeout更改为SendMessage,那么它可以正常工作,但我不想这样做,因为如果接收程序没有运行,那么它将挂起。  有什么想法吗?
If I change SendMessageTimeout to SendMessage then it works fine, but I don't want to do that because if the receiving program isn't running then it will hang. Any ideas?
感谢您的帮助。
Jim
推荐答案
您好,
欢迎光临。
Hello,
Welcome here.
根据您的描述,我将把这个帖子移到更合适的论坛:Windows桌面SDK 。
Based on your description, I will move this thread to a more appropriate forum: Windows Desktop SDK.
感谢您的理解。
问候,
Thanks for your understanding.
Regards,
这篇关于SendMessageTimeout WIN64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!