To andy_lau: 能不能把按钮的标题改成别的呢? 如构造时是true则为打开, 如别存,为保存, 能不能改为别的?
OPENFILENAME The OPENFILENAME structure contains information that the GetOpenFileName and GetSaveFileName functions use to initialize an Open or Save As common dialog box. After the user closes the dialog box, the system returns information about the user's selection in this structure. typedef struct tagOFN { // ofn DWORD lStructSize; HWND hwndOwner; HINSTANCE hInstance; LPCTSTR lpstrFilter; LPTSTR lpstrCustomFilter; DWORD nMaxCustFilter; DWORD nFilterIndex; LPTSTR lpstrFile; DWORD nMaxFile; LPTSTR lpstrFileTitle; DWORD nMaxFileTitle; LPCTSTR lpstrInitialDir; LPCTSTR lpstrTitle; DWORD Flags; WORD nFileOffset; WORD nFileExtension; LPCTSTR lpstrDefExt; DWORD lCustData; LPOFNHOOKPROC lpfnHook; LPCTSTR lpTemplateName; } OPENFILENAME;
SetWindowText(...);
SetDlgItemText( int nID, LPCTSTR lpszString );
CFileDialog dlg(TRUE,"mdb","*.mdb",OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,szFilter);
dlg.m_ofn.lpstrTitle="备份数据库";
if(dlg.DoModal()==IDCANCEL)
return;
能不能把按钮的标题改成别的呢? 如构造时是true则为打开, 如别存,为保存, 能不能改为别的?
The OPENFILENAME structure contains information that the GetOpenFileName and GetSaveFileName functions use to initialize an Open or Save As common dialog box. After the user closes the dialog box, the system returns information about the user's selection in this structure. typedef struct tagOFN { // ofn
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
LPCTSTR lpstrFilter;
LPTSTR lpstrCustomFilter;
DWORD nMaxCustFilter;
DWORD nFilterIndex;
LPTSTR lpstrFile;
DWORD nMaxFile;
LPTSTR lpstrFileTitle;
DWORD nMaxFileTitle;
LPCTSTR lpstrInitialDir;
LPCTSTR lpstrTitle;
DWORD Flags;
WORD nFileOffset;
WORD nFileExtension;
LPCTSTR lpstrDefExt;
DWORD lCustData;
LPOFNHOOKPROC lpfnHook;
LPCTSTR lpTemplateName;
} OPENFILENAME;
至少有三种方法
1.SetWindowHookEx得到新窗口产生的消息并对其子类化或者用FindWindow!
2.新模式窗口产生后主窗口后收到WM_active消息这时可用FindWindow
3.在新模式窗口产生之前SetTimer然后响应wm_timer并Findwindow具体可看这一贴:
http://expert.csdn.net/Expert/topicview.asp?id=1187389
2.重载OnInitDialog()
3.在OnInitDialog()加入SetControlText(IDOK,"test");
SetControlText(IDCANCEL,"cancel1");