Results 1 to 4 of 4

Thread: Extracting icon data from executable files

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    35
    If I read a VB-produced .exe file into a byte array, how and where would I find the bytes for that executable's icon(s)? I'm developing an application that will allow users to substitute their icons and data into the .exe file for a specific second application without modifying the executable code in that .exe file. Windows obviously has no trouble finding the icon data in a VB (or any other) executable, as such icons are displayed in Windows Explorer, My Computer, etc. Once again I reveal my ignorance on operating system basics.

    John Fritch

  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    Do you want to read the icon from the EXE, or write an icon to an EXE.
    If you want to just read the icon, use the ExtractAssociatedIcon API. I'll give you the declaration, since the one in the API viewer is wrong.
    Code:
    Declare Function ExtractAssociatedIcon Lib "shell32.dll" Alias "ExtractAssociatedIconA" (ByVal hInst As Long, ByVal lpIconPath As String, lpiIcon As Long) As Long
    Add Private to the beginning if you need to.

    If you need to write an icon to an EXE, you need to learn and understand the EXE format. (Easy to say )

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    35
    Thanks, but I need to write (actually, replace) the icon data in the .exe file.

    John Fritch

  4. #4
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    You can check this site for file formats: http://wotsit.org/
    However, that site is currently (at the time of posting) down.
    Random crash? Conspiracy? BLAME CANADA! (No offense to Canadians, I just watch South Park too much)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width