MFC学习笔记-进程间通信

1,WM_COPYDATA,进程间通信
发送方:
1),获取接收方进程的句柄
2),使用SendMessage发送消息,不能用PostMessage

HWND hwnd= ::FindWindow(NULL, m_ProcessName);
COPYDATASTRUCT cds;
//......
SendMessage(hWnd,WM_COPYDATA,NULL,(LPARAM)&cds);

CWnd* pWnd = CWnd::FindWindow(NULL, m_ProcessName);
COPYDATASTRUCT cds;
//.......
pWnd->SendMessage(WM_COPYDATA, NULL, (LPARAM)&cds);

2,HMND和CWND的区别
HWND窗口句柄
CWND是MFC的窗口类

3,editcontrol自动换行
必须设置Vertical Scrollbar = TRUE
必须设置MultiLine = TRUE
必须设置Horizontal Scrollbar = FALSE
必须设置Auto HScroll = FALSE
可选设置Want Return = FALSE
可选设置Auto VScroll = TRUE

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页