你如何“ 发现CHECKPTC改变" ?
重复一遍 下位机发现CHECKPTC改变时(在接受线程中吧?)必须 发这个消息 给 主程序。 WM_PTC_CHANGED ( #define WM_PTC_CHANGED (WM_APP + 10002 )) 即 SendMessage(WM_PTC_CHANGED,CHECKPTC,0);
[quote=引用 17 楼 Seventaxi 的回复:] [quote=引用 15 楼 xianglitian 的回复:] [quote=引用 3 楼 Seventaxi 的回复:] 就是我得到bool 值为1.我可以将状态设置为选中,bool值为0,状态设置不选中。消息函数用哪个,该怎么写呢
[quote=引用 3 楼 Seventaxi 的回复:] 就是我得到bool 值为1.我可以将状态设置为选中,bool值为0,状态设置不选中。消息函数用哪个,该怎么写呢
然后传递CHECKPTC值给处理函数,((CETBDlg*)GetParent())->CHECKPTC = 1; 要发自定义消息 否则 :OnBnChangedCheckPtc() 不会 运行, 因为这是 消息 处理函数。
[quote=引用 15 楼 xianglitian 的回复:] [quote=引用 3 楼 Seventaxi 的回复:] 就是我得到bool 值为1.我可以将状态设置为选中,bool值为0,状态设置不选中。消息函数用哪个,该怎么写呢
[quote=引用 9 楼 Seventaxi 的回复:] [quote=引用 8 楼 schlafenhamster 的回复:] 不明白 , 你说 清楚些 ! “想由自己传入一个值或者是模拟界面点击来响应事件”
[quote=引用 8 楼 schlafenhamster 的回复:] 不明白 , 你说 清楚些 ! “想由自己传入一个值或者是模拟界面点击来响应事件”
不明白 , 你说 清楚些 ! “想由自己传入一个值或者是模拟界面点击来响应事件”
m_BTarchive.SetCheck(1);
参考 BOOL CShowdirDlg::GetTypes2(string &str) { str="";// ID=1002 -> 1006 char tmp[20];// long enough for ".doc.docx." for (UINT n=IDC_CHECK1;n<=IDC_CHECK5; n++) { if(((CButton*)GetDlgItem(n))->GetCheck() == 1) { tmp[0]=0; GetDlgItem(n)->GetWindowText(tmp,19);// "doc/docx" char *at=strchr(tmp,'/'); if(at) *at='.';// '/' changed to '.' str +='.'; // seperator '.doc.docx.' str += tmp; // } } if(str.compare("")==0) return FALSE;// no one checked str += '.';// seperater //afxDump << str.c_str() << "\n"; return TRUE; }
BOOL CShowdirDlg::GetTypes2(string &str) { str="";// ID=1002 -> 1006 char tmp[20];// long enough for ".doc.docx." for (UINT n=IDC_CHECK1;n<=IDC_CHECK5; n++) { if(((CButton*)GetDlgItem(n))->GetCheck() == 1) { tmp[0]=0; GetDlgItem(n)->GetWindowText(tmp,19);// "doc/docx" char *at=strchr(tmp,'/'); if(at) *at='.';// '/' changed to '.' str +='.'; // seperator '.doc.docx.' str += tmp; // } } if(str.compare("")==0) return FALSE;// no one checked str += '.';// seperater //afxDump << str.c_str() << "\n"; return TRUE; }
GetCheck m_Button::GetCheck()
"你的意思是自己自定义一个消息和消息处理函数来处理是吗?" 对 会写 吗? 1 。h //}}AFX_MSG afx_msg LRESULT OnSnapExit(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnUserMsg(WPARAM wParam, LPARAM lParam); 2. cpp //}}AFX_MSG_MAP ON_MESSAGE(WM_SNP_EXIT,OnSnapExit) ON_MESSAGE(WM_USER_MESSAGE,OnUserMsg) 3 响应 LRESULT CMainFrame::OnUserMsg(WPARAM wParam, LPARAM lParam) { // pane text m_wndStatusBar.SetPaneText((int)wParam,(char*)lParam); return 0; }
15,979
社区成员
115,897
社区内容
加载中
试试用AI创作助手写篇文章吧