Author Topic: XMPlay Open Dialog  (Read 6943 times)

Irrational86

  • Posts: 960
XMPlay Open Dialog
« on: 1 Aug '03 - 18:23 »
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

  • Administrator
  • Posts: 20400
Re: XMPlay Open Dialog
« Reply #1 on: 3 Aug '03 - 22:07 »
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

  • Posts: 1169
Re: XMPlay Open Dialog
« Reply #2 on: 4 Aug '03 - 11:10 »
I thought you had to pass a handle to a dialog resource in the lpTemplateName field of the structure.

Ian @ un4seen

  • Administrator
  • Posts: 20400
Re: XMPlay Open Dialog
« Reply #3 on: 4 Aug '03 - 15:34 »
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

  • Posts: 960
Re: XMPlay Open Dialog
« Reply #4 on: 4 Aug '03 - 18:46 »
Ok...i got that part done, but what do i do to make the dialog change its current dir??
« Last Edit: 5 Aug '03 - 00:46 by XMinioNX »

Torkell

  • Posts: 1169
Re: XMPlay Open Dialog
« Reply #5 on: 5 Aug '03 - 08:36 »
Do you mean change the initial directory of the dialog or change to another directory on command?

Olego

  • Posts: 557
Open Dialog
« Reply #6 on: 5 Aug '03 - 09:33 »
Quote

Do 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

  • Posts: 1169
Re: Open Dialog
« Reply #7 on: 5 Aug '03 - 12:21 »
Quote

I 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

  • Posts: 960
Re: XMPlay Open Dialog
« Reply #8 on: 5 Aug '03 - 16:52 »
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). ???
« Last Edit: 6 Aug '03 - 07:15 by XMinioNX »

Irrational86

  • Posts: 960
Re: XMPlay Open Dialog
« Reply #9 on: 6 Aug '03 - 21:21 »
Can any one help?? Ian??

Torkell

  • Posts: 1169
Re: XMPlay Open Dialog
« Reply #10 on: 7 Aug '03 - 10:55 »
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

  • Administrator
  • Posts: 20400
Re: XMPlay Open Dialog
« Reply #11 on: 7 Aug '03 - 12:49 »
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

  • Posts: 960
Re: XMPlay Open Dialog
« Reply #12 on: 8 Aug '03 - 00:45 »
Quote

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).
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...