copydata-窗口间消息
来源:互联网 发布:网络教育好考吗 编辑:程序博客网 时间:2024/05/16 05:53
::::PART1::::
BOOL CPart1Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
CString str;
mymsg = RegisterWindowMessage(str);
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CPart1Dlg::OnButtonTransfer()
{
// TODO: Add your control notification handler code here
//CreateProcess(L"//part2.exe",text,NULL,NULL,FALSE,CREATE_NEW_CONSOLE,NULL,NULL,NULL,&proinfo);
}
void CPart1Dlg::OnButton2()
{
HWND hwnd = ::FindWindow(NULL,L"part2");//正在执行文件的窗口名字
COPYDATASTRUCT copydata;
copydata.cbData = 20;
copydata.dwData = 0;
copydata.lpData = L"//123.txt";
if (hwnd)
{
::SendMessage(hwnd,WM_COPYDATA,0,(LPARAM)©data);
}
else
{
MessageBox(L"No Find");
}
}
::::PART2::::
BOOL CPart2Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
CString str;
mymsg = RegisterWindowMessage(str);
// TODO: Add extra initialization here
//GetCmdLine = GetCommandLine();
//m_editval = GetCmdLine;
return TRUE; // return TRUE unless you set the focus to a control
}
LRESULT CPart2Dlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
if (message == WM_COPYDATA)
{
COPYDATASTRUCT* receivedata = (COPYDATASTRUCT*) lParam;
TCHAR* buf = (TCHAR*)receivedata->lpData;
MessageBox(buf);
char str[20];
memset(str,0,20);
CString text;
CFile file;
if(file.Open(buf,CFile::modeRead))
{
while (file.Read(str,19)>0)
{
text += str;
memset(str,0,20);
}
}
else
{
return 0;
}
m_editval = text;
UpdateData(FALSE);
file.Close();
}
return CDialog::WindowProc(message, wParam, lParam);
}
- copydata-窗口间消息
- C# copydata消息处理
- c# 进程间通讯 COPYDATA
- COPYDATA,WM_COPYDATA,进程间传数据
- MFC copydata实现两个进程间信息传递。
- 窗口间的消息传递
- C#窗口间传递消息
- 窗口消息
- 窗口消息
- 窗口消息
- 窗口消息
- windows 消息机制、窗口过程与线程间消息传递
- windows 消息机制、窗口过程与线程间消息传递
- Mdi子窗口间消息通信
- Mdi子窗口间消息通信
- 进程间消息通信实现窗口控制
- 子主窗口间消息发送
- 窗口消息机制
- ACE的陷阱
- C++只能允许类创建一个对象的做法
- 操作系统学习笔记(7)--打印内存地址
- spring2.5配置文件 注解
- java.io.Serializable序列化
- copydata-窗口间消息
- 什么是物联网(Internet of Things)
- iframe用法精析
- Jquery应用
- shell条件测试
- 开发人员需要牢记的HTML 5安全问题
- 静态库 动态库
- 【职场感悟】精确表达,不要说“大概应该maybe也许”
- ACE中的设计模式应用场景