在“另存为”对话框前面显示弹出消息
在Windows应用程序中,打开“另存为”对话框后,是否可以在“另存为”对话框前面显示弹出消息?我所得到的只是对话框关闭后弹出窗口显示。
我需要编辑一个用 C++ 编写的旧应用程序(我不是作者),但无法管理此任务。这是代码的一部分:
/* ---- 调用以显示保存文件对话框 ---- */
ofn.hwndOwner = hwnd;
ofn.lpstrFile = lpstrFileName;
ofn.lpstrTitle = lpstrTitleName;
res = GetSaveFileNameW( &ofn );
/* ---- fix file extension ---- */
MessageBox(NULL, "Test", "Testing", MB_OK);
谢谢,
伊利亚
In Windows application, is it possible to show a popup message in front of SaveAs dialog after SaveAs dialog is being opened? All I managed to get is that popup shows after dialog is closed.
I need to edit an old application written in C++ (I am not author) but can't manage this task. This is part of code:
/* ---- called to display the save file dialog ---- */
ofn.hwndOwner = hwnd;
ofn.lpstrFile = lpstrFileName;
ofn.lpstrTitle = lpstrTitleName;
res = GetSaveFileNameW( &ofn );
/* ---- fix file extension ---- */
MessageBox(NULL, "Test", "Testing", MB_OK);
Thanks,
Ilija
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果我理解正确,您想在关闭对话框之前检查一些内容(例如文件扩展名)并在不关闭的情况下显示消息。如果是这样,请查看 OPENFILENAME 结构。在这种情况下,您的代码将类似于
MyHookProc
的代码将如下所示:希望它会对您有所帮助。
If I understand you correct, you want check some stuff (for example, file extension) before closing dialog and show message withou closing. If it's so please look at OFN_ENABLEHOOK flag in OPENFILENAME Structure. In this case your code will look something like
Code for
MyHookProc
will look like this:Hope it will be helpful for you.
你可以,但这将是一个很大的黑客。您必须创建 FileDialog 并以无模式而不是模式和隐藏方式打开它。所以窗口就在那里,但你看不到它。当您单击“弹出窗口”时,您可以取消隐藏窗口对话框。
You can but it would be quite a hack. You would have to create the FileDialog and open it modeless rather than modal, and hidden. So the window is there but you can't see it. When you click your "popup" you can then could unhide the windows dialog.
听起来您想扩展保存文件对话框的 GUI。您可以使用自己的对话框资源模板来扩展 GUI,并指定
OFN_ENABLETEMPLATE
。这是许多应用程序显示文档预览/元数据的方式。It sounds like you want to extend the GUI of a save file dialog box. You can extend the GUI by using your own dialog resource template, and specify
OFN_ENABLETEMPLATE
. This is how many apps show previews / metadata of documents.