Board index » delphi » Setting 'View' property of TOpenDialog

Setting 'View' property of TOpenDialog

Hi all,

I want to be able to default the 'View' property of a TOpenDialog to
'Details'.  I want to make it easier for my users to select a file, where
the date and time modified provide more information to the user than the
actual file name.
I read a (fairly old) post elsewhere that suggested calling
  SendMessage(dlgSelectFile.Handle,WM_COMMAND,40964,lparam(0));
but this has had no effect (tried calling from OnShow event and also just
before .Execute).

I understand that this is the correct function to call but have no idea how
to determine that the last two parameters are correct.  Can anyone tell me
1 - is 40964 the correct value?
2 - How can I determine the correct value to pass in
3 - Is there any other way

While I'm at it, it would be really cool if I could automatically display
the files in Descending Modified Date order - should be possible using a
slightly different SendMessage call!!

Any help will be greatly appreciated,

Niamh

PS I'm using D6 and W2k
--
Niamh Walsh
Software Developer
Data Connections Ltd.
sm32...@eircom.net

 

Re:Setting 'View' property of TOpenDialog


Just in case anybody else was interested, I found the following answer to my
question :-
      This functionality is included in the TJvOpenDialog in JVCL
      (http://jvcl.sourceforge.net), but if this is all you need, add this
code to
      the OnFolderChange event of the dialog:

      procedure TForm1.OpenDialog1FolderChange(Sender: TObject);
      var H,H2:THandle;
      begin
        H := FindWindowEx(GetParent(OpenDialog1.Handle), 0,
      PChar('SHELLDLL_DefView'), nil);
        H2 := FindWindowEx(H, 0, PChar('SysListView32'), nil);
        if (H <> 0) and (H2 <> 0) then
        begin
          SendMessage(H, WM_COMMAND, $702C, 0);
          Windows.SetFocus(H2);
          PostMessage(H2, WM_KEYDOWN, VK_SPACE, 0);
        end;
      end;

      --
      Regards,

      Peter Thornqvist
      (JVCL Tech Coordinator)
      http://jvcl.sourceforge.net

Quote
"Niamh Walsh" <sm32...@eircom.net> wrote in message

news:p8oza.14725$pK2.20851@news.indigo.ie...
Quote
> Hi all,

> I want to be able to default the 'View' property of a TOpenDialog to
> 'Details'.  I want to make it easier for my users to select a file, where
> the date and time modified provide more information to the user than the
> actual file name.
> I read a (fairly old) post elsewhere that suggested calling
>   SendMessage(dlgSelectFile.Handle,WM_COMMAND,40964,lparam(0));
> but this has had no effect (tried calling from OnShow event and also just
> before .Execute).

> I understand that this is the correct function to call but have no idea
how
> to determine that the last two parameters are correct.  Can anyone tell me
> 1 - is 40964 the correct value?
> 2 - How can I determine the correct value to pass in
> 3 - Is there any other way

> While I'm at it, it would be really cool if I could automatically display
> the files in Descending Modified Date order - should be possible using a
> slightly different SendMessage call!!

> Any help will be greatly appreciated,

> Niamh

> PS I'm using D6 and W2k
> --
> Niamh Walsh
> Software Developer
> Data Connections Ltd.
> sm32...@eircom.net

Other Threads