Sign in to follow this  
Followers 0
Melba23

Icon Extraction Trial

4 posts in this topic

#1 ·  Posted (edited)

Hi,

I have a 2-part question.

Firstly, the following code works nicely on Vista to show the various Messagebox icons hidden in System32\User32.dll, but I would like to see if it works on other OS versions. Could someone please try it on Win XP and Win2000 and see if it works there as well. If it does not (which I hope is not the case) and you are feeling really kind - could you play with the icon indices and see what numbers are required to match the icons and the labels.

#include <GUIConstantsEx.au3>

GUICreate("Icon test", 200, 260)

$hBut = GUICtrlCreateButton("Quit", 60, 220, 80, 30)

GUICtrlCreateIcon("user32.dll", -5, 20,  20)
GUICtrlCreateIcon("user32.dll", -4, 20,  70)
GUICtrlCreateIcon("user32.dll", -3, 20, 120)
GUICtrlCreateIcon("user32.dll", -2, 20, 170)

GUICtrlCreateLabel("Information",   100,  30)
GUICtrlCreateLabel("Stop",   100,  80)
GUICtrlCreateLabel("Query",  100, 130)
GUICtrlCreateLabel("Exclamation", 100, 180)

GUISetState()

While 1

$iMsg = GUIGetMsg()

If $iMsg = $GUI_EVENT_CLOSE Or $iMsg = $hBut Then Exit

WEnd

Secondly, my old Win98 system has the same icons (the Win98 equivalents actually) in System\User.exe, but this code does not work (and yes I did change "User32.dll" to "User.exe" before you ask!). Reshacker tells me that User.exe is Win16 application and therefore cannot deal with it, but IconJack shows the icons hidden in this file without problem. Googling a bit explained that Win98 is basically 16bit and uses "thunks" to make the transfer between the 16 and 32 bit code sections (you could not make it up could you!). I imagine that is what happens when Messagebox gets the relevant icons from User32.exe - there is a very small User32.dll alongside (which does not hold any icons and therefore does not respond the code above).

Does anyone have any ideas how to get at these recalcitrant icons? As I explained earlier, I am trying to make my script as universal as possible and I know some people still use Win98 for their main system. I searched the forums and came up with this:

#include <GUIConstants.au3>
#include <WinAPI.au3>

$Form1 = GUICreate("", 400, 400)
$pic = GUICtrlCreatePic("", 0, 20, 400, 380)
GUICtrlSetState(-1, $GUI_DISABLE)
$b1 = GUICtrlCreateButton("Change Pic", 150, 0, 100, 20)
GUISetState(@SW_SHOW)
Global $i = 0, $aBitmaps[46] = [130,131,133,134,135,136,137,138,140,141,142,143, 14351,14353,14354,14355,14356, 145,146,147,148,149,204,205,206,207,214,215,216,217,225,226,227,228,230,231,240,241,242,245,246,247,


 309,310,369,390]
While 1
    Switch GuiGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $b1
            GUICtrlSetImageFromDLL($pic, 'shell32.dll', $aBitmaps[$i])
            $i += 1
            If $i = UBound($aBitmaps)-1 Then $i = 0
    EndSwitch
WEnd

Func GUICtrlSetImageFromDLL($controlID, $filename, $imageIndex)
    Local Const $STM_SETIMAGE = 0x0172

    $hLib = _WinAPI_LoadLibrary($filename)
    $hBmp = _WinAPI_LoadImage($hLib, $imageIndex, $IMAGE_BITMAP, 0, 0, $LR_DEFAULTCOLOR)
    GUICtrlSendMsg($controlID, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp)
    _WinAPI_FreeLibrary($hLib)
    _WinAPI_DeleteObject($hBmp)
EndFunc

which works nicely to extract bmps. I played around substituting $IMAGE_ICON for $IMAGE_BITMAP and using a GUICtrlCreateIcon in place of the GUICtrlCreatePic, but I got nothing to show, neither in Vista nor in Win98. If anyone has any bright ideas on how to get these 4 icons out of User.exe in Win98 I would be most grateful.

M23

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites



Hi,

your first part question: it works on xp sp3 as well.

post-42353-1229421572_thumb.jpg

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

For Win98:

You could extract the icons to iconfiles :) -> this code should work: http://www.autoitscript.com/forum/index.ph...;hl=icl+extract

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@99ojo,

Thank you for taking the time to reply.

@Prog@ndy,

Thanks for the suggestion, but I wanted to keep everything in the one script so it can be used as a UDF. At present I am working on a version using a script you wrote (using some of Zedna's Resources UDF) which displays images derived from streams coming from the hex code of an image. Looks good so far - so thanks again for that!

Danke zu beine, und es tut mir leid fur meine schlechtes Deutch.

M23

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0