65,208
社区成员
发帖
与我相关
我的任务
分享void CComboDlg::OnButton1()
{
// TODO: Add your control notification handler code here
dd1->SethWnd(this->m_hWnd);
dd1->ShowWindow(SW_SHOW);
}
void CComboDlg::OnButton2()
{
// TODO: Add your control notification handler code here
dd2->SethWnd(this->m_hWnd);
dd2->ShowWindow(SW_SHOW);
}
void CComboDlg::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
dd1->DestroyWindow();
dd2->DestroyWindow();
}
void CComboDlg::OnRefresh(WPARAM wParam, LPARAM lParam)
{
int n=(int)wParam;
while(this->m_comb.GetCount()>0)
m_comb.DeleteString(0);
if(n==1)
{
this->m_comb.AddString("1");
this->m_comb.AddString("2");
this->m_comb.AddString("3");
this->m_comb.AddString("4");
}
else
{
this->m_comb.AddString("a");
this->m_comb.AddString("b");
this->m_comb.AddString("c");
this->m_comb.AddString("d");
this->m_comb.AddString("e");
}
}
BOOL CComboDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 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
// TODO: Add extra initialization here
dd1 =new Dlg1(this);
dd2 =new Dlg2(this);
dd1->Create(IDD_DIALOG1);
dd2->Create(IDD_DIALOG2);
return TRUE; // return TRUE unless you set the focus to a control
}
----------------------------------------------------
void Dlg1::OnButton1()
{
// TODO: Add your control notification handler code here
::SendMessage(hWnd,WM_REFRESH,(WPARAM)1,0);
}
void Dlg1::SethWnd(HWND hWnd)
{
this->hWnd=hWnd;
}
-------------------------------------------------------
void Dlg2::OnButton1()
{
// TODO: Add your control notification handler code here
::PostMessage(hWnd,WM_REFRESH,(WPARAM)2,0);
}
void Dlg2::SethWnd(HWND hWnd)
{
this->hWnd=hWnd;
}