Link to home
Start Free TrialLog in
Avatar of volkerloges
volkerlogesFlag for Germany

asked on

PropertySheetExtension and TImage/Icons

I have figured out how to add this Property Sheet Extension.
But how could I provide the Data into a Icon inside of such
a page. I could use a resource-Editor like workshop. If I
know the Icon-Index I would like to display how should I
set it or could an TImage used for this?

Example:

function PropExtDlgProc(hwndDlg: HWnd; Msg: UINT; wParam: wParam; lParam: LPARAM) : Bool; far; stdcall;
var SHFileInfo : TSHFileInfo;
     fn : String;
begin
  if Msg = WM_INITDIALOG then begin
    with TStringList.Create do
      try
        SetText(PChar(PPropSheetPage(lParam)^.lParam));
        fn := Strings[0];
      finally
        Free;
      end;
{ don't work:
    SHGetFileInfo(PChar(fn), 0, SHFileInfo, SizeOf(SHFileInfo), SHGFI_LARGEICON or SHGFI_ICON);
    Image1.Picture.Icon.Handle := SHFileInfo.hIcon;

    PPropSheetPage(lParam)^.lParam := 0;
    SetWindowLong (hwndDlg, DWL_MSGRESULT, 0);
    Result := TRUE;
  end
  else Result := FALSE;
end;

Any ideas?

Volker
Avatar of volkerloges
volkerloges
Flag of Germany image

ASKER

Edited text of question.
Avatar of Epsylon
Epsylon

Try ExtractIcon(hwndDlg, fn, 0)
ASKER CERTIFIED SOLUTION
Avatar of Epsylon
Epsylon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello?
That is ok if the Icon is contained in the resource for this dialog.
But this won't work if the icon is get thru this SHGetFileInfo procedure.
That means I have the Icon get thru SHGetFileInfo, but how could this Icon
displayed inside of this property sheet?
With other words: The Icon is NOT contained inside of the resource file
created for the property-sheet dialog but should be displayed inside of this
dialog because the correct icon depends on the filename(s) selected for
this propertys sheet dialog.

PS: I was working far away without an email connection.