ValkuR Posted September 29, 2006 Share Posted September 29, 2006 HI @ALL. How to load a Picture from .DLL? I´ve try this load as Icon from DLL but don´t work. I hope so, somebody can help me. thx Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 29, 2006 Moderators Share Posted September 29, 2006 HI @ALL.How to load a Picture from .DLL? I´ve try this load as Icon from DLL but don´t work.I hope so, somebody can help me.thxhttp://www.autoitscript.com/forum/index.ph...st&p=242546 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
ValkuR Posted September 29, 2006 Author Share Posted September 29, 2006 oha, thx for fast answer Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 29, 2006 Moderators Share Posted September 29, 2006 oha, thx for fast answer YW, I saw it earlier, so it wasn't hard to find, you can give a big thanks to Larry for that one. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
ValkuR Posted September 29, 2006 Author Share Posted September 29, 2006 (edited) ok, thx Larry . i will try this one. OK. Don´t work for me. Dll as File Attachment expandcollapse popup$gui = GUICreate("",500,345) $pic = GUICtrlCreatePic(".\PIC1_BMP.BMP",500,345,200,200) GUISetState() SetBitmapResourceToPicCtrl($gui,$pic,"new.dll",0) 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 Const $LR_COPYDELETEORG = 8 $hwnd = ControlGetHandle($hwnd,"",$ctrl) Local $DLLinst = DLLCall("kernel32.dll","hwnd","LoadLibrary","str",$file) $DLLinst = $DLLinst[0] Local $hBitmap = DLLCall("user32.dll","hwnd","LoadImage","hwnd",$DLLinst,"int",$resource, _ "int",$IMAGE_BITMAP,"int",0,"int",0,"int",0) $hBitmap = $hBitmap[0] DeleteObject(_SendMessage($hwnd,$STM_SETIMAGE,$IMAGE_BITMAP,$hBitmap,0,"int","int","hwnd")) DLLCall("kernel32.dll","int","FreeLibrary","hwnd",$DLLinst) EndFunc Func _SendMessage($hWnd, $msg, $wParam = 0, $lParam = 0, $r = 0, $t1 = "int", $t2 = "int", $t3 = "long") Local $ret = DllCall("user32.dll", $t3, "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() Func DeleteObject($hObj) Local $bResult = DllCall('gdi32.dll', 'int', 'DeleteObject', _ 'hwnd', $hObj) Return $bResult[0] EndFunc ;==>DeleteObject Edited September 29, 2006 by ValkuR Link to comment Share on other sites More sharing options...
ValkuR Posted September 29, 2006 Author Share Posted September 29, 2006 Thx Larry this works . is this the only way to load a picture from dll file? i like the GUICtrlCreateIcon function Link to comment Share on other sites More sharing options...
ValkuR Posted September 29, 2006 Author Share Posted September 29, 2006 ok, thanks again LARRY. Link to comment Share on other sites More sharing options...
Fossil Rock Posted September 29, 2006 Share Posted September 29, 2006 Don't give us that humble crap... you know your sh!t don't stink. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
jpam Posted September 30, 2006 Share Posted September 30, 2006 larry is this working with jpg,mp3,wav files to ? jpam Link to comment Share on other sites More sharing options...
jpam Posted October 1, 2006 Share Posted October 1, 2006 hi has someone time to expiriment with other data from dll ? i made a Resource.dll with different data inside larry has made a very nice udf for bitmap loading from dll but bitmaps are very large mybe someone can do the same for jpg's mp3's and other file types ! 1 bmp file (works with larry's udf i included it for testing) 2 wave file 3 RC_DATA contains jpg, midi and mp3 jpamResource.dll Link to comment Share on other sites More sharing options...
jpam Posted October 21, 2006 Share Posted October 21, 2006 (edited) larry's function with resize $gui = GUICreate("",500,345) $pic = GUICtrlCreatePic("",0,0,0,0) GUISetState() SetBitmapResourceToPicCtrl($gui,$pic,50,50,50,100,".\new.dll","PIC1_BMP","str") Sleep(1000) SetBitmapResourceToPicCtrl($gui,$pic,50,50,100,100,".\new.dll","PIC1_BMP","str") While 1 If GUIGetMsg() = -3 Then Exit WEnd Func SetBitmapResourceToPicCtrl($hwnd,$ctrl,$posw,$posh,$picw,$pich,$file,$resource,$type = "int") Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local Const $LR_CREATEDIBSECTION = 0x2000 Local Const $LR_COPYDELETEORG = 8 $hwnd = ControlGetHandle($hwnd,"",$ctrl) Local $DLLinst = DLLCall("kernel32.dll","hwnd","LoadLibrary",$type,$file) $DLLinst = $DLLinst[0] Local $hBitmap = DLLCall("user32.dll","hwnd","LoadImage","hwnd",$DLLinst,"str",$resource, _ "int",$IMAGE_BITMAP,"int",0,"int",0,"int",0) $hBitmap = $hBitmap[0] DeleteObject(_SendMessage($hwnd,$STM_SETIMAGE,$IMAGE_BITMAP,$hBitmap,0,"int","int","hwnd")) DLLCall("kernel32.dll","int","FreeLibrary","hwnd",$DLLinst) GUICtrlSetPos($ctrl,$posw,$posh,$picw,$pich) EndFunc Func _SendMessage($hWnd, $msg, $wParam = 0, $lParam = 0, $r = 0, $t1 = "int", $t2 = "int", $t3 = "long") Local $ret = DllCall("user32.dll", $t3, "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() Func DeleteObject($hObj) Local $bResult = DllCall('gdi32.dll', 'int', 'DeleteObject', _ 'hwnd', $hObj) Return $bResult[0] EndFunc ;==>DeleteObject Edited October 21, 2006 by jpam Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now