查看单个帖子
旧 2009-05-05, 12:22 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】how can i set filetype in odadlge

how can i set filetype in odadlgext ?
how can i set filetype in odadlgext ?
hi guys.
i want to access the setting about filetype extension in odadlgext.dll.
(such as set default to some filetype).but it seem have only 4 method.
could somebody suggest me the way to set selection filetype as i want?
thanks a lot
there is a source code for this dialog. tweak it as you wish.
source is at \extensions\win\extdialog\
vladimir
filedlgext.cpp
code:
bool dlgext_export createopenwithpreviewdlg(cabstractpreview *pview, hwnd hparent, lpctstr lpszfilename,
lpctstr lpszfilter, dword dwflags, openwithpreviewdlg **pdlg)
{
afx_manage_state(afxgetstaticmodulestate());
cwnd wparent;
*pdlg = null;

_savedhinstance = afxgetresourcehandle();
//wparent.attach(hparent);
try
{
//afxsetresourcehandle(_savedhinstance);
cpreviewfiledlg *pnew = new cpreviewfiledlg(pview, true, nullfff">, lpszfilename, dwflags, lpszfilter);
*pdlg = static_cast<openwithpreviewdlg *>(pnew);
}
catch (...)
{
return false;
}
return true;
}
red nullfff"> is pointer to default extension.
sergey slezkin
thanks a lot slezkin.
i try to put some path file(cstring) in red position that you have suggested.
it just show only file type in "file name" in combo box.
but i need to set the selecting of "files of type" to any index file types as i want.
for example in this attached picture if i want to select "web source.."
how can i apply the code?
attached images (26.1 kb, 7 views)

sorry, my previous post was incorrect.
but:
extdialog is available with sources.
cpreviewfiledlg is derived from mfc cfiledialog.
from cfiledialog constructor description:
the lpszfilter parameter is used to determine the type of filename a file must have to be displayed in the file list box. the first string in the string pair describes the filter; the second string indicates the file extension to use. multiple extensions may be specified using ??as the delimiter. the string ends with two 憒?characters, followed by a null character. you can also use a cstring object for this parameter.
but note that cpreviewfiledlg is able to show preview only from dwg and dxf not from "web resources" :-)
sergey slezkin
hi slezkin...
maybe that was my fault. i didn't make my question clearly.
caz,my point is to keep some registry value of the file that i had ever opened in lastest time.
so when i'll open next time,i don't have to select file type list again.
for example, my method to set index of file type in easy cfiledialog.
please see the code as the follow.
code:
cfiledialog dlg(true, 0, 0, ofn_hidereadonly | ofn_overwriteprompt,
_t("dwg files(*.dwg)|*.dwg|dxf files(*.dxf)|*.dxf||"));
dlg.m_ofn.nfilterindex = 2 ;
so.. i got index type of file to opening in dxf format.
then i can keep that to registry and bra bra...
the question is.. how can i apply these method to cpreviewfiledlg?
caz i'm not sure that i can access to variable "m_ofn" or not.
and if i can't.
can you make some patch to use anyfunction to set that with out changing
cstring in lpszfilter? caz i want to keep ordering the file type.
in case if there are more file types. thanks
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)