Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PropertySheetExtension and TImage/Icons

Posted on 1999-07-10
5
Medium Priority
?
199 Views
Last Modified: 2010-07-27
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
0
Comment
Question by:volkerloges
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 1

Author Comment

by:volkerloges
ID: 1387643
Edited text of question.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1387644
Try ExtractIcon(hwndDlg, fn, 0)
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 200 total points
ID: 1387645
This should work (assuming that fn contains the file):

uses shellapi;

var icon: HICON;

  icon := ExtractIcon(hwndDlg, fn, 0{=index});
  DrawIcon(hwndDlg, 10, 10, icon);


or in 1 line:

  DrawIcon(hwndDlg, 10, 10, ExtractIcon(hwndDlg, fn, 0));



0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1387646
Hello?
0
 
LVL 1

Author Comment

by:volkerloges
ID: 1387647
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.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question