引用 10 楼 aimn147 的回复:
失误,上面的图片贴瞎了。再贴一遍,你给的资源代码生成的对话框:
引用 8 楼 sebastianlin 的回复:這個是 IDD_INSERTOBJECT的 dialog template
IDD_INSERTOBJECT DIALOG DISCARDABLE 6, 18, 293, 150
STYLE DS_MODALFRAME | WS_POPU……
無言了,給了你 IDD_INSERTOBJECT的 dialog template 也有 ID
幫你把 OLEDLG 門戶大開,如果你還不知如何下一步,....孔仲尼云舉一偶而不以三偶反.....
你用了原本的 dialog template 當然還是原來 OLDDLG 的模樣
在最上加了 TAB CONTROL 不就是再把 IDC_IO_CREATEFROMFILE ,IDC_IO_CREATENEW
2 個 RADIO 藏起來,再把 MESSAGE 引導至TAB CONTROL不就可以? .......
IDD_INSERTDLG DIALOGEX 0, 0, 400, 200
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Insert Object"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
CONTROL "",IDC_TAB1,"SysTabControl32",0x0,2,4,397,185
CONTROL "Create &New",IDC_IO_CREATENEW,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,76,44,73,10
CONTROL "Create from &File",IDC_IO_CREATEFROMFILE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,76,62,73,10
CONTROL "Create &Control",IDC_IO_INSERTCONTROL,"Button",BS_AUTORADIOBUTTON,76,80,72,10
LTEXT "Object &Type:",IDC_IO_OBJECTTYPETEXT,151,32,110,8
LISTBOX IDC_IO_OBJECTTYPELIST,152,43,132,78,LBS_SORT | LBS_USETABSTOPS | WS_VSCROLL | WS_GROUP | WS_TABSTOP
LTEXT "Fil&e:",IDC_IO_FILETEXT,152,50,20,8
LTEXT "",IDC_IO_FILETYPE,190,50,80,8
EDITTEXT IDC_IO_FILEDISPLAY,152,60,132,12,ES_AUTOHSCROLL
PUSHBUTTON "&Browse...",IDC_IO_FILE,152,76,48,14
CONTROL "&Link",IDC_IO_LINKFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,78,40,10
LISTBOX IDC_IO_CONTROLTYPELIST,152,43,132,66,LBS_SORT | LBS_USETABSTOPS | NOT WS_VISIBLE | WS_DISABLED | WS_VSCROLL | WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Add Control...",IDC_IO_ADDCONTROL,152,104,66,14
DEFPUSHBUTTON "OK",IDOK,291,32,66,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,291,49,66,14
PUSHBUTTON "&Help",IDC_OLEUIHELP,291,66,66,14
CONTROL "&Display As Icon",IDC_IO_DISPLAYASICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,292,88,66,10
CONTROL "",IDC_IO_ICONDISPLAY,"OLE2UIiconbox",0x0,291,105,66,46
PUSHBUTTON "Change &Icon...",IDC_IO_CHANGEICON,291,156,66,14
GROUPBOX "Result",IDC_STATIC,76,122,210,47,WS_GROUP
CONTROL "",IDC_IO_RESULTIMAGE,"OLE2UIresimage",0x0,80,132,42,34
LTEXT "<< result text goes here >>",IDC_IO_RESULTTEXT,126,132,156,32,SS_NOPREFIX | SS_NOTIFY | NOT WS_GROUP
END
BOOL CALLBACK AfxDlgProc(HWND hWnd, UINT message, WPARAM, LPARAM);
UINT CALLBACK CInsertDialog::MyHookProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_INITDIALOG)
{
return (UINT)AfxDlgProc(hWnd, message, wParam, lParam);
}
else if (message == WM_COMMAND && LOWORD(wParam) == IDC_OLEUIHELP)
{
CInsertDialog* pDlg = DYNAMIC_DOWNCAST(CInsertDialog, CWnd::FromHandlePermanent(hWnd));
// just translate the message into the AFX standard help command.
pDlg->SendMessage(WM_COMMAND, ID_HELP, 0);
return TRUE;
}
else if( message == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom == IDC_TAB1 && ((LPNMHDR)lParam)->code == TCN_SELCHANGE )
{
LRESULT rlt;
CInsertDialog* pDlg = DYNAMIC_DOWNCAST(CInsertDialog, CWnd::FromHandlePermanent(hWnd));
pDlg->OnTcnSelchangeTab1((NMHDR*)lParam,&rlt);
return rlt;
}
return 0;
}
BOOL CInsertDialog::OnInitDialog()
{
COleInsertDialog::OnInitDialog();
// TODO: Add extra initialization here
CString strCreateNew,strCreateFile;
CTabCtrl* pTab=(CTabCtrl*)GetDlgItem(IDC_TAB1);
CButton* pCreateNew=(CButton*)GetDlgItem(IDC_IO_CREATENEW);
CButton* pCreateFile=(CButton*)GetDlgItem(IDC_IO_CREATEFROMFILE);
pCreateNew->GetWindowText(strCreateNew);
pCreateFile->GetWindowText(strCreateFile);
//pCreateNew->ShowWindow(SW_HIDE);
//pCreateFile->ShowWindow(SW_HIDE);
pTab->InsertItem(0,strCreateNew);
pTab->InsertItem(1,strCreateFile);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CInsertDialog::OnTcnSelchangeTab1(NMHDR *pNMHDR, LRESULT *pResult)
{
// TODO: Add your control notification handler code here
CTabCtrl* pTab=(CTabCtrl*)GetDlgItem(IDC_TAB1);
int cur=pTab->GetCurSel();
if( cur == 0 )
{
}
else if( cur == 1 )
{
}
*pResult = 0;
}
如果提示如此你還不了解,你 WIN32/OLE 的基礎建議再多加強些