我要自定义一个open对话框,除了common filedialog,添加了一些control,同时使用了hook,在hook proc中有 WM_INITDIALOG的定义,那么请问添加的control在什么地方定义,比如说我要BOOL fdex_mfc_dlg::OnInitDialog()
{
CFileDialog::OnInitDialog(); CListBox* pLB = (CListBox*)GetDlgItem(IDC_ENV);
pLB->InsertString(-1, "Current Project");
pLB->InsertString(-1, "Current scenes");
pLB->InsertString(-1, "Projects");
pLB->InsertString(-1, "Default");
pLB->InsertString(-1, "Home");
pLB->SetTopIndex(0); return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}好像不起作用了!主要是hook proc是全局函数,该如何使用使用mfc类
{
CFileDialog::OnInitDialog(); CListBox* pLB = (CListBox*)GetDlgItem(IDC_ENV);
pLB->InsertString(-1, "Current Project");
pLB->InsertString(-1, "Current scenes");
pLB->InsertString(-1, "Projects");
pLB->InsertString(-1, "Default");
pLB->InsertString(-1, "Home");
pLB->SetTopIndex(0); return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}好像不起作用了!主要是hook proc是全局函数,该如何使用使用mfc类
BOOL CMyOpenDlg::OnInitDialog()
{
CFileDialog::OnInitDialog();
PostMessage(MYWM_POSTINIT,0,0);
return TRUE;
}
然后在MYWM_POSTINIT的处理函数中操作文件对话框上的控件。因为使用了PostMessage,所以这个消息在之前消息队列中所有消息得到处理之后才会被处理,这时候文件对话框已经初始化完毕了。
BOOL CMyOpenDlg::OnInitDialog(),
还好问题解决了,谢谢各位