XMPlay Open Dialog

Started by Irrational86,

Irrational86

Hi Ian, how is it that you can make a custom Open Dialog? How do you modify the original dialog to include other controls? Maybe a piece of source code, or a doc on how to do it would be just fine.

Ian @ un4seen

You need to specify a callback function in the "lpfnHook" member in the OPENFILENAME structure when you call GetOpenFileName, and then create the extra contols in that callback/hook function when it receives the WM_INITDIALOG message... I'm sure there must be Delphi classes that'll simplify the process for you though :)

Torkell

I thought you had to pass a handle to a dialog resource in the lpTemplateName field of the structure.

Ian @ un4seen

Yep, you could use a template instead of creating the extra controls by hand. Either way, you'll still need to implement a callback/hook function to initialize your controls and process notifications from them :)

Irrational86

#4
Ok...i got that part done, but what do i do to make the dialog change its current dir??

Torkell

Do you mean change the initial directory of the dialog or change to another directory on command?

Olego

QuoteDo you mean change the initial directory of the dialog or change to another directory on command?
Because to change the initial directory, you only have to set the OPENFILENAME::lpstrInitialDir parameter.  (And Ian likes to GetCurrentDirectory(MAX_PATH, currentDirectory); which makes life simple. :))

I don't understand what "on command" means.
~Olego~

Torkell

QuoteI don't understand what "on command" means.
~Olego~
i.e. I pass a dialog template which adds a button. Click on the button at get taken to C:\.

Irrational86

#8
What i mean is, after the dialog is open, how do i change to a specific Directory using code? I know about the InitialDir thing, but i want to change it after the dialog has been opened (While its open). ???


Torkell

You could try finding the handle of the edit control and posting messages to it (feeding it the path and the return key to make it change dir).

Ian @ un4seen

Boggy has the idea. The edit control has the id 0x480. Send the BN_CLICKED notification (for the "OK" button) to the parent window to make the change.

Irrational86

QuoteYou could try finding the handle of the edit control and posting messages to it (feeding it the path and the return key to make it change dir).
Heh, i thought of this already, but i also thought there was a cleaner way, so i waited for a response from Ian on how he does it on XMPlay...