ExtractAssociatedIcon

ExtractAssociatedIcon

Post by Jason Wallac » Sat, 24 Jan 1998 04:00:00



  Yeah, I posted this just a while ago....

function LoadSmallIcon(const FileName: AnsiString; ID: integer): hicon;
var
  S                                                : array[0..255] of char;
  IconHandle                                       : hIcon;
  Index                                            : Word;
begin
  StrPLCopy(S, FileName, SizeOf(S)-1);
  IconHandle := ExtractIcon(hInstance, S, Id);
  if IconHandle < 2 then begin
    Index := Id;
    IconHandle := ExtractAssociatedIcon(hInstance, S, Index);
  end;
  Result := CopyImage(IconHandle,
                      IMAGE_ICON,
                      GetSystemMetrics(SM_CXSMICON),
                      GetSystemMetrics(SM_CYSMICON),
                      0);
end;

--
Jason Wallace
SL Software

--
"We are Microsoft.  Resistance is Futile.  You will be Assimiliated."


>Hi,
>I am using ExtractAssociatedIcon and it works fine for 32x32 icons.
>Does anyone know if there is a way to extract 16x16 associated icon?

>Thank you all,
>Tomas Fischer.

>PS.
>I am also a VB programmer and have subscription to VB mailing list with
>over 4000 people, and I notice that in Delphi newsgroup we all love or like
>Borland but in Visual Basic list 90% of the people have nothing nice to say
>about Microsoft :))

>Please do not start any huge discussion about this PS, I think that "Future
>of Delphi" is enough.
>Thanks again.

 
 
 

ExtractAssociatedIcon

Post by Tomas Fische » Sun, 25 Jan 1998 04:00:00


Hi,
I am using ExtractAssociatedIcon and it works fine for 32x32 icons.
Does anyone know if there is a way to extract 16x16 associated icon?

Thank you all,
Tomas Fischer.

PS.
I am also a VB programmer and have subscription to VB mailing list with
over 4000 people, and I notice that in Delphi newsgroup we all love or like
Borland but in Visual Basic list 90% of the people have nothing nice to say
about Microsoft :))

Please do not start any huge discussion about this PS, I think that "Future
of Delphi" is enough.
Thanks again.

 
 
 

1. ExtractAssociatedIcon

Hi

I've just started using API calls. I used ExtractIcon
(copied straight out of a book) and got the expected
result. Then I tried to use ExtractAssociatedIcon using
the following code.

Declare Function MyExtractAssociatedIcon Lib "shell32.dll"
Alias "ExtractAssociatedIcon" _
        (ByVal hInst As Long, ByVal lpIconPath As String, _
            ByVal lpiIcon As Integer) As Long

Sub hIconToPicture()

Dim strIconFilePath As String
Dim hIcon As Long
Dim intLpiIcon As Integer

strIconFilePath = "C:\Program Files\Microsoft
Office\Office10\excel.exe"
intLpiIcon = 0

hIcon = MyExtractAssociatedIcon(0, strIconFilePath,
intLpiIcon)

Form1.Picture1.Picture = GPicTool.IconToPicture(hIcon)

End Sub

And VB returned the following error:

'453' Can't find DLL entry point ExtractAssociatedIcon in
shell32.dll

Is this because of syntax, logic .?

Thanks

2. Great New Macintosh Web Site!

3. ExtractAssociatedIcon into ImageList?

4. stealthnet?

5. ExtractAssociatedIcon and ListView

6. Blur plug in bug 5.0

7. API: ExtractAssociatedIcon Error etc.

8. ExtractAssociatedIcon

9. ExtractAssociatedIcon() to picture object?

10. ExtractAssociatedIcon

11. Something Like ExtractAssociatedIcon