• 大小: 266KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-01-05
  • 标签: mfc  postmessage  

资源简介

资源包含两个源程序,里面是借用MFC的消息通信实现简单的两个进程间通信,嗯主要是通过SendMessage或PostMessage,功能实现简单便捷。

资源截图

代码片段和文件信息

#include “StdAfx.h“
#include “B.h“

CB CB::instance;
CB::CB(void)
{
strCbBuff=““;
}


CB::~CB(void)
{
}
int CB::CBSend()
{
LRESULT copyDataResult;  
CWnd *pOtherWnd = CWnd::FindWindow(“CPostMessageTest2Dlg“ NULL);  
int iRet=99;
if (pOtherWnd)  
{   
CString strDataToSend=“123456网址“;
COPYDATASTRUCT cpd; cpd.dwData = 0;   
cpd.cbData = strDataToSend.GetLength();   
cpd.lpData = (void*)strDataToSend.GetBuffer(cpd.cbData);   
iRet=copyDataResult = pOtherWnd->SendMessage(WM_COPYDATA (WPARAM)AfxGetApp()->m_pMainWnd->GetSafeHwnd() (LPARAM)&cpd);   
strDataToSend.ReleaseBuffer();// copyDataResult has value returned by other app   
}   
else  
{  
iRet=-1;
AfxMessageBox(“Unable to find other app.“);   

return iRet;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-04-23 03:23  PostMessageTest1\
     文件         786  2018-04-02 11:37  PostMessageTest1\B.cpp
     文件         182  2018-03-30 14:58  PostMessageTest1\B.h
     文件      106384  2018-04-23 03:23  PostMessageTest1\PostMessageTest1.aps
     文件        2483  2018-04-03 09:53  PostMessageTest1\PostMessageTest1.cpp
     文件         520  2018-04-03 09:51  PostMessageTest1\PostMessageTest1.h
     文件       10944  2018-04-23 03:23  PostMessageTest1\PostMessageTest1.rc
     文件        6070  2018-03-30 14:49  PostMessageTest1\PostMessageTest1.vcxproj
     文件        2219  2018-03-30 14:49  PostMessageTest1\PostMessageTest1.vcxproj.filters
     文件         143  2018-03-29 15:34  PostMessageTest1\PostMessageTest1.vcxproj.user
     文件        6483  2018-04-27 10:02  PostMessageTest1\PostMessageTest1Dlg.cpp
     文件         932  2018-04-27 09:48  PostMessageTest1\PostMessageTest1Dlg.h
     文件        3312  2018-03-29 15:35  PostMessageTest1\ReadMe.txt
     目录           0  2018-03-29 15:35  PostMessageTest1\res\
     文件       67777  2009-08-31 02:31  PostMessageTest1\res\PostMessageTest1.ico
     文件         688  2018-03-29 15:35  PostMessageTest1\res\PostMessageTest1.rc2
     文件        1746  2018-04-23 03:23  PostMessageTest1\resource.h
     文件         149  2018-03-29 15:35  PostMessageTest1\stdafx.cpp
     文件        1632  2018-03-29 15:35  PostMessageTest1\stdafx.h
     文件         234  2018-03-29 15:35  PostMessageTest1\targetver.h
     目录           0  2018-04-27 09:56  PostMessageTest2\
     文件      106332  2018-04-27 09:56  PostMessageTest2\PostMessageTest2.aps
     文件        2501  2018-04-02 11:27  PostMessageTest2\PostMessageTest2.cpp
     文件         556  2018-04-02 11:09  PostMessageTest2\PostMessageTest2.h
     文件       10588  2018-04-27 09:56  PostMessageTest2\PostMessageTest2.rc
     文件        6002  2018-03-29 15:57  PostMessageTest2\PostMessageTest2.vcxproj
     文件        2051  2018-03-29 15:56  PostMessageTest2\PostMessageTest2.vcxproj.filters
     文件         143  2018-03-29 15:56  PostMessageTest2\PostMessageTest2.vcxproj.user
     文件        4779  2018-04-27 09:50  PostMessageTest2\PostMessageTest2Dlg.cpp
     文件         878  2018-04-27 09:48  PostMessageTest2\PostMessageTest2Dlg.h
     文件        3312  2018-03-29 15:56  PostMessageTest2\ReadMe.txt
............此处省略7个文件信息

评论

共有 条评论