GetOpenFileName(XXXX)怎样设置使其每次的打开文件对话框都在中央?

billgate2003 2003-05-25 11:11:29
主要是设置OPENFILENAME。
...全文
98 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
billgate2003 2003-05-28
  • 打赏
  • 举报
回复
能有详细的例子吗?MSDN上没有例子的。
SnowWolfSLF 2003-05-28
  • 打赏
  • 举报
回复
试试将OPENFILENAME里的hwndOwner设置成主窗体。
guoxiny 2003-05-28
  • 打赏
  • 举报
回复
用回调函数应该可以,不过也可以从CFileDialog继承一个子类,然后在这个子类的WM_INITDIALOG消息中,或者在OnInitDone虚函数里面,调用CenterWindow函数。
billgate2003 2003-05-28
  • 打赏
  • 举报
回复
SnowWolfSLF(雪狼) 的测试通过。当初图方便将OPENFILENAME里的hwndOwner设置为NULL,现将它设为如:
ofn.hwndOwner = ::GetActiveWindow();
就正确了。
谢谢大家的帮助。
billgate2003 2003-05-27
  • 打赏
  • 举报
回复
再看看
everandforever 2003-05-26
  • 打赏
  • 举报
回复
You can provide an OFNHookProc hook procedure for an Explorer-style Open dialog box.

UINT_PTR CALLBACK OFNHookProc(
HWND hdlg, // handle to child dialog box
UINT uiMsg, // message identifier
WPARAM wParam, // message parameter
LPARAM lParam // message parameter
);
hdlg : [in] Handle to the child dialog box of the Open or Save As dialog box. Use the GetParent function to get the handle to the Open or Save As dialog box.
lParam
[in] Specifies additional information about the message. The exact meaning depends on the value of the uiMsg parameter.
___________________________________
If the uiMsg parameter indicates the WM_INITDIALOG message, lParam is a pointer to an OPENFILENAME structure containing the values specified when the dialog box was created.
Maybe you can move it to center here.
___________________________________

nuaawenlin 2003-05-26
  • 打赏
  • 举报
回复
FindWindow()获得窗口句柄后再MoveWindow()
luckyboy1979 2003-05-26
  • 打赏
  • 举报
回复
你是不是要这个: CFileDialog openfile(TRUE,NULL,NULL,OFN_HIDEREADONLY,"All Files(*.*)|*.*|VC++ Programs(*.cpp)||",this);
luckyboy1979 2003-05-26
  • 打赏
  • 举报
回复
好像不行。
luckyboy1979 2003-05-26
  • 打赏
  • 举报
回复
MoveWindow可以吗?
allenhai1980 2003-05-26
  • 打赏
  • 举报
回复
mark & Up,
CFileDialog可能用?

16,473

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧