VitAl2013 Posted April 16, 2010 Share Posted April 16, 2010 Is _ResourceSaveToFile work in non-builded script? How function understand where the file is? Is it normal use variables in this function? Link to comment Share on other sites More sharing options...
VitAl2013 Posted April 16, 2010 Share Posted April 16, 2010 (edited) I unzip resource_au3.zip in the same folder with resource_test.au3. Build it through AutoIt3Wrapper.exe. Start. Hear "tada!" and see big window with only one small picture of window's logo. Close it. Go to C:\Dir1\SubDir2 and found only binary_data2.bmp with 0kb size only. Where is binary_data1.dat & why size is 0? Edited April 16, 2010 by VitAl2013 Link to comment Share on other sites More sharing options...
Zedna Posted April 16, 2010 Author Share Posted April 16, 2010 Is _ResourceSaveToFile work in non-builded script? How function understand where the file is? Is it normal use variables in this function?No. All these resources functions work only from compiled script (EXE). Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted April 16, 2010 Author Share Posted April 16, 2010 I unzip resource_au3.zip in the same folder with resource_test.au3. Build it through AutoIt3Wrapper.exe. Start. Hear "tada!" and see big window with only one small picture of window's logo. Close it. Go to C:\Dir1\SubDir2 and found only binary_data2.bmp with 0kb size only. Where is binary_data1.dat & why size is 0?Read carefully WHOLE my first topic!!You must comile it from full Scite4Autoit3 by F7.For running my examples you must unpack also data files from second ZIP file.You can use ResHacker to check if resources are successfuly added in compiled EXE file.If you are not so skilled to understand these basics information then you may use simpler FileInstall(). Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
slayerz Posted April 18, 2010 Share Posted April 18, 2010 Hi Zedna, currently I'm using the UDF to load an external dll file. Do you have any working example on how I can load animated cursor from an external dll? Right now, I have this example that load from file : #include <GuiConstants.au3> #include <WindowsConstants.au3> $Gui = GuiCreate("Test", 300, 200,750) GUISetState() GUIRegisterMsg($WM_SETCURSOR, 'WM_SETCURSOR') $Cur = DllCall("user32.dll", "int", "LoadCursorFromFile", "str", @ScriptDir&"\mycursor.ani") ; this will load from file While 1 $Msg = GUIGetMsg(1) Select Case $Msg[0] = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func WM_SETCURSOR($hWnd, $iMsg, $iWParam, $iLParam) If $hWnd = $Gui Then DllCall("user32.dll", "int", "SetCursor", "int", $Cur[0]) Return 0 EndIf EndFunc Thanks, slayerz AUTOIT[sup] I'm lovin' it![/sup] Link to comment Share on other sites More sharing options...
Ultimist Posted May 29, 2010 Share Posted May 29, 2010 These aren't working for me. Can someone tell me where exactly I am supposed to extract the zip files from the first post? Thanks. Link to comment Share on other sites More sharing options...
Ultimist Posted May 29, 2010 Share Posted May 29, 2010 Ok, I got it to work... but the included "image3.jpg" will not display in any of the example scripts, nor will any other *.jpg I replace it with. Does this not work correctly with JPG's? Link to comment Share on other sites More sharing options...
cembry90 Posted May 29, 2010 Share Posted May 29, 2010 All I have to say is : AMAZING WORK. I've been looking for something like this forever. I wanted to build a board game, but didn't want to require people to download the images for use. Once again, another epic script from another amazing user! AutoIt Stuff: UDFs: {Grow} Link to comment Share on other sites More sharing options...
Zedna Posted May 29, 2010 Author Share Posted May 29, 2010 @slayerz Look at my first post there is link to topic about animated GIFS. @ultimist Read carefully whole first post of this topic. All information are stated there. If it's not enough for you then read also all posts in this topic, your question (or similar ones) was asked many times already and I answered many times too. @cembry90 Thanks for compliments :-) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Bot Posted June 11, 2010 Share Posted June 11, 2010 I was able to load a PNG file into the GUI. But while my PNG file has dimension of 32x32, it's displayed on the GUI as 48x48 How can I fix this? #AutoIt3Wrapper_Res_File_Add=setup.png, RT_RCDATA, SETUP_ICON_1 #include "Resources.au3" #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #Include <WinAPI.au3> $hGUI = GUICreate("Show PNG", 250, 250) _GDIPlus_StartUp() $hImage = _ResourceGetAsImage("SETUP_ICON_1") $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") GUISetState() do until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_ShutDown() Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) Return $GUI_RUNDEFMSG EndFunc Link to comment Share on other sites More sharing options...
Zedna Posted June 13, 2010 Author Share Posted June 13, 2010 (edited) I was able to load a PNG file into the GUI. But while my PNG file has dimension of 32x32, it's displayed on the GUI as 48x48 How can I fix this?Try to use GUICtrlCreatePic() and _ResourceSetImageToCtrl() as in my examples, you don't need hooking of WM_PAINT in this case. Edited June 13, 2010 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Bot Posted June 14, 2010 Share Posted June 14, 2010 Try to use GUICtrlCreatePic() and _ResourceSetImageToCtrl() as in my examples, you don't need hooking of WM_PAINT in this case.OK I tried and it worked fine Link to comment Share on other sites More sharing options...
marko001 Posted June 16, 2010 Share Posted June 16, 2010 (edited) Hi Zedna, i'm trying to use it to embeed images to buttons, since you stated that now it's supported, but i can't get it to work: #AutoIt3Wrapper_Res_File_Add=cuori_b.bmp, rt_rcdata, cuori_b.bmp ... $fiori = GUICtrlCreateButton("",103,8,44,44, $BS_BITMAP ) $pic1 = GUICtrlSetImage($fiori,"fiori.bmp",0,0) _ResourceSetImageToCtrl($pic1, "fiori.bmp") Can you please give me some hint to manage it? Thanks, Marco Edited June 16, 2010 by marko001 Link to comment Share on other sites More sharing options...
Zedna Posted June 18, 2010 Author Share Posted June 18, 2010 (edited) Hi Zedna, i'm trying to use it to embeed images to buttons, since you stated that now it's supported, but i can't get it to work: Can you please give me some hint to manage it? Thanks, Marco Try this#AutoIt3Wrapper_Res_File_Add=cuori_b.bmp, rt_bitmap, cuori_b ... $fiori = GUICtrlCreateButton("",103,8,44,44, $BS_BITMAP ) _ResourceSetImageToCtrl($fiori, "cuori_b", $RT_BITMAP) EDIT: Don't forget to download/use latest Resources UDF ;-) Edited June 18, 2010 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
JScript Posted July 1, 2010 Share Posted July 1, 2010 Hi Zedna, How to get the data from Message Table? MsgBox(4096, "Read BSOD", _ResourceGetAsString(1073741951, $RT_MESSAGETABLE, 0, $@SystemDir & "\ntoskrnl.exe"))Does not work... http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Zedna Posted July 1, 2010 Author Share Posted July 1, 2010 Hi Zedna, How to get the data from Message Table? MsgBox(4096, "Read BSOD", _ResourceGetAsString(1073741951, $RT_MESSAGETABLE, 0, $@SystemDir & "\ntoskrnl.exe"))Does not work... You have got syntax mistake: $@SystemDir should be @SystemDir But this your way it's completely wrong. There are two possible ways to get "MessageTable" resources: 1) use _ResourceGet() to get pointer to resource data and apply DllStructCreate (typecast) to it with these structures MESSAGE_RESOURCE_DATA MESSAGE_RESOURCE_BLOCK MESSAGE_RESOURCE_ENTRY and loop through their entries 2) use LoadLibrary and FormatMessage API functions this is much simpler and you don't need my Resources UDF not tested: Const $FORMAT_MESSAGE_FROM_HMODULE = 0x0800 Const $FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x0100 $tBuffer = DllStructCreate("wchar[1]") ; I'm not sure here about the size/type of buffer, buffer will be auto alocated $pBuffer = DllStructGetPtr($tBuffer) $iFlags = BitOr($FORMAT_MESSAGE_FROM_HMODULE, $FORMAT_MESSAGE_ALLOCATE_BUFFER) $MessageID = 1 ; Id of message you want to get, replace by your desired number $iLanguageID = 0 ; neutral lang $hModule = _WinAPI_LoadLibrary(@SystemDir & "\ntoskrnl.exe") ; path to your EXE/DLL module _WinAPI_FormatMessage($iFlags, $hModule, $iMessageID, $iLanguageID, $pBuffer, 0, 0) MsgBox(4096, "Read BSOD", DllStructGetData($tBuffer,1)) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
JScript Posted July 1, 2010 Share Posted July 1, 2010 still not working... http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Zedna Posted July 1, 2010 Author Share Posted July 1, 2010 (edited) still not working... Try different MessageId and $tBuffer = DllStructCreate("wchar[1024]") EDIT: You can also try ANSI version $tBuffer = DllStructCreate("char[1024]")or $tBuffer = DllStructCreate("char[1]") Edited July 2, 2010 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Who Posted July 5, 2010 Share Posted July 5, 2010 (edited) #AutoIt3Wrapper_Res_File_Add=C:\AutoIT\mainprog.ico, RT_ICON, MAIN_PROGRAM_ICON_1 $GUI_ImageList = _GUIImageList_Create(16, 16, 5) _GUIImageList_AddIcon($GUI_ImageList, "C:\AutoIT\mainprog.ico", 0, True) $GUI_Toolbar = _GUICtrlToolbar_Create($GUI, BitOR($WS_CLIPSIBLINGS,$TBSTYLE_FLAT)) _GUICtrlToolbar_SetImageList($GUI_Toolbar, $GUI_ImageList) _GUICtrlToolbar_AddButton($GUI_Toolbar, 0, 0)The _AddIcon function requires a path so I tried "res://" & @AutoItExe & "/MAIN_PROGRAM_ICON_1" but it didn't show up. The _AddButton function requires an index so I can't find a way to get the UDF to work with toolbar. Are there any solution for me ? Edited July 5, 2010 by Who Link to comment Share on other sites More sharing options...
Zedna Posted July 5, 2010 Author Share Posted July 5, 2010 (edited) #AutoIt3Wrapper_Res_File_Add=C:\AutoIT\mainprog.ico, RT_ICON, MAIN_PROGRAM_ICON_1 $GUI_ImageList = _GUIImageList_Create(16, 16, 5) _GUIImageList_AddIcon($GUI_ImageList, "C:\AutoIT\mainprog.ico", 0, True) $GUI_Toolbar = _GUICtrlToolbar_Create($GUI, BitOR($WS_CLIPSIBLINGS,$TBSTYLE_FLAT)) _GUICtrlToolbar_SetImageList($GUI_Toolbar, $GUI_ImageList) _GUICtrlToolbar_AddButton($GUI_Toolbar, 0, 0) The _AddIcon function requires a path so I tried "res://" & @AutoItExe & "/MAIN_PROGRAM_ICON_1" but it didn't show up. The _AddButton function requires an index so I can't find a way to get the UDF to work with toolbar. Are there any solution for me ? This should work fine, no need to use my UDF for this #AutoIt3Wrapper_Res_Icon_Add=C:\AutoIT\mainprog.ico ; replace 3 by your desired icon index ; remember there are some standard Autoit's icons in compiled EXE ; so your first added icon is not first in EXE _GUIImageList_AddIcon($GUI_ImageList, @AutoItExe, 3, True) Edited July 5, 2010 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search 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