 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Bill Miller Guest
|
Posted: Sun Apr 11, 2004 11:52 am Post subject: Open TOpenPictureDialog in Thumbnail mode (view) |
|
|
Open TOpenPictureDialog in Thumbnail mode (view)
TOpenPictureDialog view constants are defined in CommCtrl.pas but
LVS_THUMBNAILS, LVS_THUMBNAIL or LVS_THUMB are not defined in CommCtrl.pas.
Only LVS_ICON, LVS_REPORT, LVS_SMALLICON and LVS_LIST are defined.
Does anyone know what the constant value for THUMBNAILS view is?
Can anyone get this code to work to display a TOpenPictureDialog with the
listview set to Thumbnail mode when the dialog is displayed?
If the view is actually set to thumbnail mode is additional code needed to
refresh the thumbnails so they are actually visible?
const defined in CommCtrl.pas
{$EXTERNALSYM LVS_ICON}
LVS_ICON = $0000;
{$EXTERNALSYM LVS_REPORT}
LVS_REPORT = $0001;
{$EXTERNALSYM LVS_SMALLICON}
LVS_SMALLICON = $0002;
{$EXTERNALSYM LVS_LIST}
LVS_LIST = $0003;
I am attempting to have an TOpenPictureDialog open in the Thumbnail mode
using this code:
procedure OpenPictureDialog1Show(Sender: TObject);
{ Private declarations }
procedure WMUser(var Message: TMessage); message WM_USER;
procedure TForm1.WMUser(var Message: TMessage);
var
Dlg: HWND;
Ctrl: HWND;
Style: Cardinal;
begin
Dlg := Message.WParam;
Ctrl := FindWindowEx(Dlg, 0, PChar('SHELLDLL_DefView'), nil);
if Ctrl = 0 then
exit;
Ctrl := FindWindowEx(Ctrl, 0, PChar('SysListView32'), nil);
if Ctrl = 0 then
exit;
Style := GetWindowLong(Ctrl, GWL_STYLE);
Style := (Style and not LVS_TYPEMASK) or LVS_ICON; <- This must be changed
to thumbnail constant
SetWindowLong(Ctrl, GWL_STYLE, Style);
end;
procedure TForm1.OpenPictureDialog1Show(Sender: TObject);
var
Dlg: HWND;
begin
Dlg := GetParent((Sender as TOpenPictureDialog).Handle);
PostMessage(Handle, WM_USER, Dlg, 0);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
begin
end;
end;
Regards,
Bill Miller
|
|
| Back to top |
|
 |
Thomas Stutz Guest
|
Posted: Mon Apr 12, 2004 9:12 am Post subject: Re: Open TOpenPictureDialog in Thumbnail mode (view) |
|
|
| Quote: | Open TOpenPictureDialog in Thumbnail mode (view)
|
Hi,
This works for me (tested in XP)
private
{ Private declarations }
procedure WMUser(var msg: TMessage); message WM_USER;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
const
FCIDM_SHVIEW_LARGEICON = 28713;
FCIDM_SHVIEW_SMALLICON = 28714;
FCIDM_SHVIEW_LIST = 28715;
FCIDM_SHVIEW_REPORT = 28716;
FCIDM_SHVIEW_THUMBNAIL = 28717; // XP only
FCIDM_SHVIEW_TILE = 28718; // XP
procedure TForm1.WMUser(var msg: TMessage);
var
Dlg: HWND;
Ctrl: HWND;
begin
Dlg := msg.WParam;
Ctrl := FindWindowEx(Dlg, 0, PChar('SHELLDLL_DefView'), nil);
if Ctrl <> 0 then
begin
SendMessage(Ctrl, WM_COMMAND, FCIDM_SHVIEW_THUMBNAIL, 0 )
end;
end;
procedure TForm1.OpenDialog1Show(Sender: TObject);
var
Dlg: HWND;
begin
Dlg := GetParent((Sender as TOpenDialog).Handle);
PostMessage(Handle, WM_USER, Dlg, 0);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
end;
end;
|
|
| Back to top |
|
 |
Thomas Stutz Guest
|
Posted: Mon Apr 12, 2004 9:12 am Post subject: Re: Open TOpenPictureDialog in Thumbnail mode (view) |
|
|
| Quote: | Open TOpenPictureDialog in Thumbnail mode (view)
|
Hi,
This works for me (tested in XP)
private
{ Private declarations }
procedure WMUser(var msg: TMessage); message WM_USER;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
const
FCIDM_SHVIEW_LARGEICON = 28713;
FCIDM_SHVIEW_SMALLICON = 28714;
FCIDM_SHVIEW_LIST = 28715;
FCIDM_SHVIEW_REPORT = 28716;
FCIDM_SHVIEW_THUMBNAIL = 28717; // XP only
FCIDM_SHVIEW_TILE = 28718; // XP
procedure TForm1.WMUser(var msg: TMessage);
var
Dlg: HWND;
Ctrl: HWND;
begin
Dlg := msg.WParam;
Ctrl := FindWindowEx(Dlg, 0, PChar('SHELLDLL_DefView'), nil);
if Ctrl <> 0 then
begin
SendMessage(Ctrl, WM_COMMAND, FCIDM_SHVIEW_THUMBNAIL, 0 )
end;
end;
procedure TForm1.OpenDialog1Show(Sender: TObject);
var
Dlg: HWND;
begin
Dlg := GetParent((Sender as TOpenDialog).Handle);
PostMessage(Handle, WM_USER, Dlg, 0);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
end;
end;
|
|
| Back to top |
|
 |
Bill Miller Guest
|
Posted: Mon Apr 12, 2004 12:52 pm Post subject: Re: Open TOpenPictureDialog in Thumbnail mode (view) |
|
|
Thomas,
Thanks... It worked for me too.
Regards,
Bill Miller
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|