Jump to content
Sign in to follow this  
jeantje

Get resources from shell32.dll

Recommended Posts

jeantje

let's say i want an image from shell32.dll but i don't want to export it so i want to directly load it from the dll and then display it in a guy any ways to do that?

Edited by jeantje

Share this post


Link to post
Share on other sites
TerarinK

Look into _GUIImageList Managment under the help think that will aid you then


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites
jeantje

Look into _GUIImageList Managment under the help think that will aid you then

eh actually i want to load a bitmap from a dll file


Share this post


Link to post
Share on other sites
maqleod

eh actually i want to load a bitmap from a dll file

well, for icons from shell32.dll, this would load it directly to a control in your gui:

GUICtrlSetImage($controlid, "shell32.dll", 22)

not sure how you would load it as a bitmap though.


[u]You can download my projects at:[/u] Pulsar Software

Share this post


Link to post
Share on other sites
Authenticity

#include <GDIPlus.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
_GDIPlus_Startup()

Dim $hGUI = GUICreate('Test')
Dim $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Dim $hBitmap = _WinAPI_LoadBitmap(_WinAPI_GetModuleHandle('shell32.dll'), 147)
Dim $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
GUISetState()
_GDIPlus_GraphicsDrawImage($hGraphics, $hImage, 0, 0)

GUIRegisterMsg($WM_PAINT, 'OnPaint')

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_RESTORE
            _GDIPlus_GraphicsDrawImage($hGraphics, $hImage, 0, 0)
            
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
    
    Sleep(20)
WEnd

_WinAPI_DeleteObject($hImage)
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_GraphicsDispose($hGraphics)
GUIDelete()

_GDIPlus_Shutdown()

Func OnPaint($hwnd, $iMsg, $iwParam, $ilParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hImage, 0, 0)
    
    Return $GUI_RUNDEFMSG
EndFunc

Share this post


Link to post
Share on other sites
trancexx

For example above mine I would go with this:

#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>

GUICreate("Test", 413)
$hPic = GUICtrlCreatePic("", 0, 0, 413, 72)

Local $hInstance = _WinAPI_GetModuleHandle("shell32.dll")

Local $hBitmap= _WinAPI_LoadImage($hInstance, 147, $IMAGE_BITMAP, 0, 0, 0)

Local $STM_SETIMAGE = 370
Local $iMsg = GUICtrlSendMsg($hPic, $STM_SETIMAGE, 0, $hBitmap)

GUISetState()

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
jeantje

and are there any ways to load a bitmap from a dll file and not shell32.dll but HSInst.dll and then bitmap 102

Download: HSInst.zip


Share this post


Link to post
Share on other sites
ProgAndy

Yes, this is possible:

#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>

GUICreate("Test", 413)
$hPic = GUICtrlCreatePic("", 0, 0, 300, 180)

Local $hInstance = _WinAPI_LoadLibraryEx(@WindowsDir&"\explorer.exe",$LOAD_LIBRARY_AS_DATAFILE )

Local $hBitmap= _WinAPI_LoadImage($hInstance, 170, $IMAGE_BITMAP, 0, 0, 0)

Local $STM_SETIMAGE = 370
Local $iMsg = GUICtrlSendMsg($hPic, $STM_SETIMAGE, 0, $hBitmap)
If $iMsg Then 
    _WinAPI_DeleteObject($iMsg)
EndIf

GUISetState()

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd

*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
jeantje

Yes, this is possible:

#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>

GUICreate("Test", 413)
$hPic = GUICtrlCreatePic("", 0, 0, 300, 180)

Local $hInstance = _WinAPI_LoadLibraryEx(@WindowsDir&"\explorer.exe",$LOAD_LIBRARY_AS_DATAFILE )

Local $hBitmap= _WinAPI_LoadImage($hInstance, 170, $IMAGE_BITMAP, 0, 0, 0)

Local $STM_SETIMAGE = 370
Local $iMsg = GUICtrlSendMsg($hPic, $STM_SETIMAGE, 0, $hBitmap)
If $iMsg Then 
    _WinAPI_DeleteObject($iMsg)
EndIf

GUISetState()

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd
thank you very much

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  

×