Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to customize open/save file dialogs?

I have seen some programs use custom open/save file dialogs in that manner they add some extra buttons there.

How can I do this?

Note that I want to use the basic open/save dialogs, so I dont have to re-create them, thus remain the buttons in the OS language. I only want to add some extra buttons there.

like image 245
Rookie Avatar asked Mar 24 '26 23:03

Rookie


2 Answers

Update: As David Heffernan points out below, this answer applies to Windows platforms before Vista. From Vista onwards, you should use the IFileDialogCustomize COM interface instead.

Basically, you have to set the OFN_ENABLETEMPLATE flag in the OPENFILENAME structure you're passing to GetOpenFileName()/GetSaveFileName(). This allows you to specify a custom dialog template in the lpTemplateName member of the same structure. This template will be used to build the dialog box. See Explorer-Style Custom Templates for all the details.

Note that if you add your own controls to the dialog box (buttons in your case), you should also set the OFN_ENABLEHOOK flag and specify a callback function in the lpfnHook member of the OPENFILENAME structure, so you can handle the messages sent by these controls. See Explorer-Style Hook Procedures for more information.

like image 184
Frédéric Hamidi Avatar answered Mar 26 '26 13:03

Frédéric Hamidi


This should help you Customizing common dialog controls

like image 30
CodeWeed Avatar answered Mar 26 '26 13:03

CodeWeed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!