AL3X Posted April 29, 2008 Share Posted April 29, 2008 (edited) -- Edited July 2, 2015 by AL3X Link to comment Share on other sites More sharing options...
Zedna Posted April 29, 2008 Author Share Posted April 29, 2008 Doesn`t work for me at all... I have ResHacker and the "old mehod" ... but nothing...It just doesn`t include the files :S- try to put ResHacker.exe into script directory or somewhere in "Windows search path" for example: C:\Windows\- try to compile/test my examples (unmodified) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
taotao878 Posted April 30, 2008 Share Posted April 30, 2008 If png is translucent, The effect is not ideal like attachment show effect is: Link to comment Share on other sites More sharing options...
AL3X Posted April 30, 2008 Share Posted April 30, 2008 (edited) -- Edited July 2, 2015 by AL3X Link to comment Share on other sites More sharing options...
Zedna Posted April 30, 2008 Author Share Posted April 30, 2008 (edited) Still nothing... I have ResHacker.exe in all possible places, and nothing... Could you send me an already compiled .exe ? one of the examples would be nice ^^Here is compiled resource_test.exe. It's also UPX compressed but resources stays uncompressed so you can see all embeded data by ResHacker.exeEDIT: - You must compile it from Scite4AutoIt3 by F7- in case of problems post all Scite Output messages (from compilation)resource_test_exe.zip Edited April 30, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
AL3X Posted April 30, 2008 Share Posted April 30, 2008 Here is compiled resource_test.exe. It's also UPX compressed but resources stays uncompressed so you can see all embeded data by ResHacker.exeEDIT: - You must compile it from Scite4AutoIt3 by F7- in case of problems post all Scite Output messages (from compilation)OohhH !!! It works !!! I mean...When I compile the script from context menu (right button > compile script) it doesnt work!!! But if I open Scite and F7, it builds it with all files !!! LOL !!! Thats pretty cool !!! A lot of thanks for that =D I'll use it a lot of =PPD: Is the "compile thing and F7" a bug? or are they 2 different things suppoused to do to different things... ?Thanks Link to comment Share on other sites More sharing options...
Zedna Posted April 30, 2008 Author Share Posted April 30, 2008 (edited) PD: Is the "compile thing and F7" a bug? or are they 2 different things suppoused to do to different things... ?All #AutoIt3Wrapper directives are working/trigered only when you compile script by F7 from Scite4AutoIt3.It's not bug it's a fact.EDIT: It's also written in notes in my first post! Edited April 30, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
AL3X Posted April 30, 2008 Share Posted April 30, 2008 (edited) -- Edited July 2, 2015 by AL3X Link to comment Share on other sites More sharing options...
Zedna Posted April 30, 2008 Author Share Posted April 30, 2008 I have a good news about that- add support for other control types to _ResourceSetImageToCtrl() (now probably only picture control)I discovered that control must have SS_BITMAP style to be able set image by STM_SETIMAGE message - used in my Func _SetBitmapToCtrl($CtrlId, $hBitmap)So I will play with adding this SS_BITMAP style to control before setting image by STM_SETIMAGE. I quickly tested this on Button control without resources and it worked fine.So stay tuned ... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted May 1, 2008 Author Share Posted May 1, 2008 (edited) I discovered that control must have SS_BITMAP style to be able set image by STM_SETIMAGE message - used in my Func _SetBitmapToCtrl($CtrlId, $hBitmap) So I will play with adding this SS_BITMAP style to control before setting image by STM_SETIMAGE. I quickly tested this on Button control without resources and it worked fine. In _ResourceSetImageToCtrl/_SetBitmapToCtrl I use STM_SETIMAGE message which works only with static controls so for button control it doesn't work. As far as I know static controls are: Picture, Label I tested button only with this scenario (without resources) which works fine: Const $BS_BITMAP = 0x80 $gui = GUICreate("Test",900,600) $but = GUICtrlCreateButton("aaa",500,320,200,100, $BS_BITMAP ) GUISetState(@SW_SHOW) GUICtrlSetImage($but , "Image1.bmp") While 1 If GUIGetMsg() = -3 Then Exit WEnd Edited May 1, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted May 2, 2008 Author Share Posted May 2, 2008 Updated first post 2008-05-02 - added new RT,SND constants - fixed bad order of parameters ResName x ResType in FindResourceExA (thanks SmOke_N) - added DeleteObject of oldBmp from ST_SETIMAGE in _SetBitmapToCtrl (thanks ProgAndy) - added setting SS_BITMAP style to control before ST_SETIMAGE in _SetBitmapToCtrl (support for labels) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
AL3X Posted May 7, 2008 Share Posted May 7, 2008 (edited) -- Edited July 2, 2015 by AL3X Link to comment Share on other sites More sharing options...
Zedna Posted May 7, 2008 Author Share Posted May 7, 2008 @ZednaHi! I have another cuestion . It is possible to add and use an .exe? I mean, with this UDF it's possible to add and play a sound... That's ok . But, it's possible to add an .exe and use it just as a FileInstalled one?Thanks As far as I know this is not possible. It's Windows system limitation.Add EXE into resources and at runtime Create new process from this EXE loaded into memory from resources.The same applies also for DLL files stored inside resources and calling their functions directly from memory.I don't know this exactly but I remember Valik answered this question already somewhere on the forum. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
AL3X Posted May 7, 2008 Share Posted May 7, 2008 (edited) -- Edited July 2, 2015 by AL3X Link to comment Share on other sites More sharing options...
sanhen Posted May 11, 2008 Share Posted May 11, 2008 not support 3.2.10.0 or 3.2.11.12???? Link to comment Share on other sites More sharing options...
ProgAndy Posted May 11, 2008 Share Posted May 11, 2008 work fine Don't forget to Compile first with AutoIt3Wrapper and ResHacker installed http://www.autoitscript.com/autoit3/scite/...oIt3Wrapper.htmAutoIt3Wrapper is included in Scite4AutoIt: http://www.autoitscript.com/autoit3/scite/downloads.shtml *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 Link to comment Share on other sites More sharing options...
sanhen Posted May 11, 2008 Share Posted May 11, 2008 Has been installed. You can test success? Link to comment Share on other sites More sharing options...
ProgAndy Posted May 16, 2008 Share Posted May 16, 2008 The newest UDF code with extension for external DLLs expandcollapse popup#include-once #include <WinAPI.au3> #include <GDIPlus.au3> #include <Memory.au3> Global Const $RT_CURSOR = 1 Global Const $RT_BITMAP = 2 Global Const $RT_ICON = 3 Global Const $RT_MENU = 4 Global Const $RT_DIALOG = 5 Global Const $RT_STRING = 6 Global Const $RT_FONTDIR = 7 Global Const $RT_FONT = 8 Global Const $RT_ACCELERATOR = 9 Global Const $RT_RCDATA = 10 Global Const $RT_MESSAGETABLE = 11 Global Const $RT_GROUP_CURSOR = 12 Global Const $RT_GROUP_ICON = 14 Global Const $RT_VERSION = 16 Global Const $RT_DLGINCLUDE = 17 Global Const $RT_PLUGPLAY = 19 Global Const $RT_VXD = 20 Global Const $RT_ANICURSOR = 21 Global Const $RT_ANIICON = 22 Global Const $RT_HTML = 23 Global Const $RT_MANIFEST = 24 Global Const $SND_RESOURCE = 0x00040004 Global Const $SND_SYNC = 0x0 Global Const $SND_ASYNC = 0x1 Global Const $SND_MEMORY = 0x4 Global Const $SND_LOOP = 0x8 Global Const $SND_NOSTOP = 0x10 Global Const $SND_NOWAIT = 0x2000 Global Const $SND_PURGE = 0x40 Func _ResourceGet($ResName, $ResType = 10, $ResLang = 0,$DLL=-1) ; $RT_RCDATA = 10 Local Const $IMAGE_BITMAP = 0 Local $hInstance, $hBitmap, $InfoBlock, $GlobalMemoryBlock, $MemoryPointer, $ResSize If $DLL == -1 Then $hInstance = DllCall("kernel32.dll", "int", "GetModuleHandleA", "int", 0) Else $hInstance = DllCall("kernel32.dll","int","LoadLibrary","str",$DLL) EndIf $hInstance = $hInstance[0] If $ResType = $RT_BITMAP Then $hBitmap = DllCall("user32.dll", "hwnd", "LoadImage", "hwnd", $hInstance, "str", $ResName, _ "int", $IMAGE_BITMAP, "int", 0, "int", 0, "int", 0) If @error Then Return SetError(1, 0, 0) $hBitmap = $hBitmap[0] Return $hBitmap ; returns handle to Bitmap EndIf If $ResLang <> 0 Then $InfoBlock = DllCall("kernel32.dll", "int", "FindResourceExA", "int", $hInstance, "long", $ResType, "str", $ResName, "short", $ResLang) Else $InfoBlock = DllCall("kernel32.dll", "int", "FindResourceA", "int", $hInstance, "str", $ResName, "long", $ResType) EndIf If @error Then Return SetError(2, 0, 0) $InfoBlock = $InfoBlock[0] If $InfoBlock = 0 Then Return SetError(3, 0, 0) $ResSize = DllCall("kernel32.dll", "dword", "SizeofResource", "int", $hInstance, "int", $InfoBlock) If @error Then Return SetError(4, 0, 0) $ResSize = $ResSize[0] If $ResSize = 0 Then Return SetError(5, 0, 0) $GlobalMemoryBlock = DllCall("kernel32.dll", "int", "LoadResource", "int", $hInstance, "int", $InfoBlock) If @error Then Return SetError(6, 0, 0) $GlobalMemoryBlock = $GlobalMemoryBlock[0] If $GlobalMemoryBlock = 0 Then Return SetError(7, 0, 0) $MemoryPointer = DllCall("kernel32.dll", "int", "LockResource", "int", $GlobalMemoryBlock) If @error Then Return SetError(8, 0, 0) $MemoryPointer = $MemoryPointer[0] If $MemoryPointer = 0 Then Return SetError(9, 0, 0) If $DLL <> -1 Then DllCall("Kernel32.dll","int","FreeLibrary","str",$hInstance) SetExtended($ResSize) Return $MemoryPointer EndFunc Func _ResourceGetAsString($ResName, $ResType = 10, $ResLang = 0,$DLL=-1) ; $RT_RCDATA = 10 Local $ResPointer, $ResSize, $struct $ResPointer = _ResourceGet($ResName, $ResType, $ResLang,$DLL) If @error Then SetError(1, 0, 0) Return '' EndIf $ResSize = @extended $struct = DllStructCreate("char[" & $ResSize & "]", $ResPointer) Return DllStructGetData($struct, 1) ; returns string EndFunc Func _ResourceGetAsBytes($ResName, $ResType = 10, $ResLang = 0,$DLL=-1) ; $RT_RCDATA = 10 Local $ResPointer, $ResSize $ResPointer = _ResourceGet($ResName, $ResType, $ResLang,$DLL) If @error Then Return SetError(1, 0, 0) $ResSize = @extended Return DllStructCreate("byte[" & $ResSize & "]", $ResPointer) ; returns struct with bytes EndFunc Func _ResourceSaveToFile($FileName, $ResName, $ResType = 10, $ResLang = 0, $CreatePath = 0,$DLL=-1) ; $RT_RCDATA = 10 Local $ResStruct, $ResSize, $FileHandle $ResStruct = _ResourceGetAsBytes($ResName, $ResType, $ResLang,$DLL) If @error Then Return SetError(1, 0, 0) $ResSize = DllStructGetSize($ResStruct) If $CreatePath Then $CreatePath = 8 ; mode 8 = Create directory structure if it doesn't exist $FileHandle = FileOpen($FileName, 2+16+$CreatePath) If @error Then Return SetError(2, 0, 0) FileWrite($FileHandle, DllStructGetData($ResStruct, 1)) If @error Then Return SetError(3, 0, 0) FileClose($FileHandle) If @error Then Return SetError(4, 0, 0) Return $ResSize EndFunc Func _ResourceSetImageToCtrl($CtrlId, $ResName, $ResType = 10,$DLL=-1) ; $RT_RCDATA = 10 Local $ResData, $nSize, $hData, $pData, $pStream, $pBitmap, $hBitmap $ResData = _ResourceGet($ResName, $ResType,0,$DLL) If @error Then Return SetError(1, 0, 0) $nSize = @extended If $ResType = $RT_BITMAP Then _SetBitmapToCtrl($CtrlId, $ResData) If @error Then Return SetError(2, 0, 0) Else ; thanks ProgAndy ; for other types than BITMAP use GDI+ for converting to bitmap first $hData = _MemGlobalAlloc($nSize,2) $pData = _MemGlobalLock($hData) _MemMoveMemory($ResData,$pData,$nSize) _MemGlobalUnlock($hData) $pStream = DllCall( "ole32.dll","int","CreateStreamOnHGlobal", "int",$hData, "long",1, "Int*",0) $pStream = $pStream[3] _GDIPlus_Startup() $pBitmap = DllCall($ghGDIPDll,"int","GdipCreateBitmapFromStream", "ptr",$pStream, "int*",0) $pBitmap = $pBitmap[2] $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($pBitmap) _SetBitmapToCtrl($CtrlId, $hBitmap) If @error Then SetError(3, 0, 0) _GDIPlus_BitmapDispose($pBitmap) _GDIPlus_Shutdown() _WinAPI_DeleteObject($pStream) _MemGlobalFree($hData) EndIf Return 1 EndFunc ; internal helper function Func _SetBitmapToCtrl($CtrlId, $hBitmap) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local Const $SS_BITMAP = 0xE Local Const $GWL_STYLE = -16 Local $hWnd = GUICtrlGetHandle($CtrlId) If $hWnd = 0 Then Return SetError(1, 0, 0) ; set SS_BITMAP style to control Local $oldStyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE) If @error Then Return SetError(2, 0, 0) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "long", BitOR($oldStyle[0], $SS_BITMAP)) If @error Then Return SetError(3, 0, 0) Local $oldBmp = DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hWnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap) If @error Then Return SetError(4, 0, 0) If $oldBmp[0] <> 0 Then _WinAPI_DeleteObject($oldBmp[0]) Return 1 EndFunc ; thanks Larry ; MSDN: http://msdn2.microsoft.com/en-us/library/ms712879.aspx ; default flag is $SND_SYNC = 0 Func _ResourcePlaySound($ResName, $Flag = 0) Local $ret = DllCall("winmm.dll", "int", "PlaySound", "str", $ResName, "hwnd", 0, "int", BitOr($SND_RESOURCE,$Flag)) If @error Then Return SetError(1, 0, 0) Return $ret[0] EndFuncoÝ÷ Ø7¦¡«¢+Ø¥¹±Õ±ÐíU% ½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±ÐíIͽÕÉ̹ÔÌÐì((É¥½¸´U$ ÉÑ)U% ÉÑ ÌäíÍÌäì¤(ÀÌØí%ôU% Ñɱ ÉÑA¥ ÅÕ½ÐìÅÕ½Ðì°À°À¤)}IͽÕÉMÑ%µQ½ ÑÉ° ÀÌØí%°ÅÕ½ÐìÄÐÌÔÔÅÕ½Ðì°È±MåÍѵ¥ÈµÀìÅÕ½ÐìÀäÈíÍ¡±°Ìȹ±°ÅÕ½Ðì¤)U%MÑMÑÑ ¤(¹É¥½¸((É¥½¸´U$M±Ñ1½½À)]¡¥±Ä($ÀÌØíµÍôU%Ñ5Í ¤(%M±Ð($% ÍÀÌØíµÍôÀÌØíU%}Y9Q} 1=M($$%á¥Ð(%¹M±Ð)]¹(¹É¥½ *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 Link to comment Share on other sites More sharing options...
Zedna Posted May 16, 2008 Author Share Posted May 16, 2008 The newest UDF code with extension for external DLLs Thanks again ProgAndy!I will definitelly add this into my UDF. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
SxyfrG Posted May 17, 2008 Share Posted May 17, 2008 Quick question, When installing Resource hacker and AutoIT3Wrapper, where should i place them so they work correctly? This is a great UDF and once i've gotten the above issue solved i'll be sure to use it My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website 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