Jump to content

How do I use bitmaps from dll? Not Icons


EloB
 Share

Recommended Posts

Hi

How do I use bitmaps from dll?

I found a bitmap (1101) from credui.dll that I want in my GUI but I dont know how to put it into my GUI.

Is it possible to use the bitmap without making a picture of it?

Edited by EloB
Link to comment
Share on other sites

HI,

do you want to extract the icon like doing it with resource hacker?

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Yes and put the bitmap into my GUI.

But how do I do that ?

If you mean how do you extract the icon from the dll then search for 'freeware icon extractor'. I use one which I can no longer trace on the internet, but there are plenty of others. These extracters can read images from exe's or dll's and save them to a file.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

this works but repaint doesn't happen...

$gui = GUICreate("")
$pic = GUICtrlCreatePic("",0,0,200,200)

GUISetState()

SetBitmapResourceToPicCtrl($gui,$pic,"c:\myfile.exe",47)

While 1
    If GUIGetMsg() = -3 Then Exit
WEnd

Func SetBitmapResourceToPicCtrl($hwnd,$ctrl,$file,$resource)
    Local Const $STM_SETIMAGE = 0x0172
    Local Const $IMAGE_BITMAP = 0
    Local Const $LR_CREATEDIBSECTION = 0x2000
    Local $A = ControlGetHandle($hwnd,"",$ctrl)
    Local $DLLinst = DLLCall("kernel32.dll","hwnd","LoadLibrary","str",$file)
    $DLLinst = $DLLinst[0]
    Local $hBitmap = DLLCall("user32.dll","hwnd","LoadImage","hwnd",$DLLinst,"short",$resource, _
            "int",$IMAGE_BITMAP,"int",0,"int",0,"int",0)
    $hBitmap = $hBitmap[0]
    _SendMessage($A,$STM_SETIMAGE,$IMAGE_BITMAP,$hBitmap);
    DLLCall("gdi32.dll","int","DeleteObject","hwnd",$hBitmap)
    DLLCall("kernel32.dll","int","FreeLibrary","hwnd",$DLLinst)
EndFunc

Func _SendMessage($hWnd, $msg, $wParam = 0, $lParam = 0, $r = 0, $t1 = "int", $t2 = "int")
    Local $ret = DllCall("user32.dll", "long", "SendMessage", "hwnd", $hWnd, "int", $msg, $t1, $wParam, $t2, $lParam)
    If @error Then Return SetError(@error, @extended, "")
    If $r >= 0 And $r <= 4 Then Return $ret[$r]
    Return $ret
EndFunc ; _SendMessage()
Hi! :)

This code does me not work.

Sometimes work and sometime doesn't work...

Yuraj

ShellExecute("http://www.yuraj.ucoz.com")ProcessClose(@AutoItPID)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...