DXRW4E Posted December 25, 2011 Share Posted December 25, 2011 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)) still not working... $tBuffer = DllStructCreate("wchar[65536]") $pBuffer = DllStructGetPtr($tBuffer) $iMessageID = 1 $iLanguageID = 0 $hModule = _WinAPI_LoadLibrary(@SystemDir & "\ntoskrnl.exe") _WinAPI_FormatMessage(0x0800, $hModule, $iMessageID, $iLanguageID, $pBuffer, "65536", 0) MsgBox(4096, "Read BSOD", DllStructGetData($tBuffer,1)) Ciao. Link to comment Share on other sites More sharing options...
playlet Posted December 28, 2011 Share Posted December 28, 2011 (edited) --- Edited August 19, 2016 by playlet Link to comment Share on other sites More sharing options...
wraithdu Posted December 28, 2011 Share Posted December 28, 2011 (edited) Does the flash object allow you to play a swf directly from a resource? If so, then you need to consult the flash documentation. Edited December 28, 2011 by wraithdu Link to comment Share on other sites More sharing options...
Zedna Posted December 28, 2011 Author Share Posted December 28, 2011 How can I use swf file directly from executable in the script below without extracting it first?I don't knowbut you can try similar approach as in my IE example with res:// syntax, see examples in resource.zip Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
playlet Posted December 29, 2011 Share Posted December 29, 2011 (edited) --- Edited August 18, 2016 by playlet Link to comment Share on other sites More sharing options...
Zedna Posted January 14, 2012 Author Share Posted January 14, 2012 Just for info: I will be almost offline or totally offline for several weeks (maybe months?) so don't expect quick response these days from me ... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Chad2 Posted February 9, 2012 Share Posted February 9, 2012 (edited) Just what I was looking for. Thanks. 5* Edited February 9, 2012 by Chad2 Link to comment Share on other sites More sharing options...
Armag3ddon Posted February 20, 2012 Share Posted February 20, 2012 Okay, what do I need to do to make this work? Even the examples aren't working. If put reshacker.exe everywhere. I must be missing something really obvious, everyone else can use this :I Link to comment Share on other sites More sharing options...
guinness Posted February 20, 2012 Share Posted February 20, 2012 (edited) You don't need reshacker anymore, it now uses the AutoItWrapper program that's included with SciTE4AutoIt3. I think you need to look at the first post again. Edited February 20, 2012 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Armag3ddon Posted February 20, 2012 Share Posted February 20, 2012 (edited) Ah, thanks Something obvious!Well, now it does better but not perfect though, I get errors during compiling:!>23:03:25 Error: EndUpdateResource: Returncode = 0 - LastError:110:The system cannot open the device or file specified.rc:2!>23:03:25 Error: Program Resource updating Failed. The output program will not contain the Resource updates!rc:2/editOkay, got it fixed with this thread: Edited February 20, 2012 by Armag3ddon Link to comment Share on other sites More sharing options...
Morgyone Posted March 28, 2012 Share Posted March 28, 2012 (edited) Hi, Zedna Can you show me how to load an animated cursor (.ani) directly from exe? I can load it from external file but I want it to be available from compiled script as resource. This is what I have so far: #AutoIt3Wrapper_Res_File_Add=link.ani, 21, cursor #include <resources.au3> If Not @Compiled Then $sCurFile = @ScriptDir & "link.ani" Global $aCur = DllCall("user32.dll", "int", "LoadCursorFromFile", "str", $sCurFile) If $aCur[0] = "" Then Exit MsgBox(262144 + 16, "", "Cursor file " & $sCurFile & " not found") Else ; LOAD CURSOR FROM EXE EndIf GUISetState() Global $hGui = GUICreate("Chosen Cursor", 300, 200) GUICtrlCreateLabel("dadadadadada", 10, 10, 200, 25) GUISetState() GUIRegisterMsg(0x0020, 'WM_SETCURSOR') Do Sleep(10) Until GUIGetMsg() = -3 Func WM_SETCURSOR($hWnd, $iMsg, $iWParam, $iLParam) If $hWnd = $hGui Then DllCall("user32.dll", "int", "SetCursor", "int", $aCur[0]) Return 1 EndIf EndFunc ;==>WM_SETCURSOR Thanks, Playlet hi playlet! i just wanted to ask, have you found a way to do it, and if so, can you please describe it for me? =) If not could anyone help me with this please? as i saw on MSDN, the LoadCursor function requires an instance of the exe from which i want to get the cursor resource, and a string as identifier (can be used also an integer index instead?) and sorry for bad grammar ^^ Edited March 28, 2012 by Morgyone Link to comment Share on other sites More sharing options...
playlet Posted March 29, 2012 Share Posted March 29, 2012 (edited) --- Edited August 18, 2016 by playlet Link to comment Share on other sites More sharing options...
Zedna Posted March 29, 2012 Author Share Posted March 29, 2012 as i saw on MSDN, the LoadCursor function requires an instance of the exe from which i want to get the cursor resource, and a string as identifier (can be used also an integer index instead?) Here is my testing script which should work but it doesn't. It works only with loading cursor from external EXE resource (totalcmd.exe). It seems that cursors added by Au3Wrapper directive are corrupted (seen by reshacker after compilation) and that the reason of problems. I will play with it more later ... Maybe Jos can test why cursors added by #AutoIt3Wrapper_Res_File_Add=pen_il.cur, rt_cursor, CUR_1 are corrupted? expandcollapse popup; cursors from Win7 ;~ #AutoIt3Wrapper_Res_File_Add=aero_link.cur, rt_cursor, CUR_1 ;~ #AutoIt3Wrapper_Res_File_Add=aero_busy.ani, rt_anicursor, ANI_CUR_1 ; cursors from Win XP #AutoIt3Wrapper_Res_File_Add=pen_il.cur, rt_cursor, CUR_1 #AutoIt3Wrapper_Res_File_Add=banana.ani, rt_anicursor, ANI_CUR_1 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n #include <GuiConstants.au3> #include <WinAPI.au3> Global $hInstance Global $hCursor Global $gui $gui = GUICreate("Cursor from resources example",820,400) $label1 = GUICtrlCreateLabel("abc def",20,320,380,100) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SETCURSOR, 'WM_SETCURSOR') ;~ $hInstance = _WinAPI_GetModuleHandle("") ; doesn't work $hInstance = _WinAPI_LoadLibraryEx('totalcmd.exe', $LOAD_LIBRARY_AS_DATAFILE) ; work OK ;~ $hCursor = _WinAPI_LoadCursor($hInstance, 'CUR_1') ; doesn't work $hCursor = _WinAPI_LoadCursor($hInstance, 1) ; work OK If @error Then MsgBox(0, '_WinAPI_LoadCursor','error1 CUR') Exit EndIf ;~ $hCursor = _WinAPI_LoadCursor($hInstance, 'ANI_CUR_1') ;~ If @error Then ;~ MsgBox('_WinAPI_LoadCursor','error2 ANI') ;~ Exit ;~ EndIf _WinAPI_SetCursor($hCursor) While 1 If GUIGetMsg() = -3 Then Exit WEnd Func WM_SETCURSOR($hWnd, $iMsg, $iWParam, $iLParam) If $hWnd = $gui Then _WinAPI_SetCursor($hCursor) Return 0 EndIf Return $GUI_RUNDEFMSG EndFunc Func _WinAPI_LoadCursor($hInstance, $sCursor) Local $aResult, $sType = "int" If IsString($sCursor) Then $sType = "str" $aResult = DllCall("User32.dll", "hwnd", "LoadCursor", "hwnd", $hInstance, $sType, $sCursor) _WinAPI_Check("_WinAPI_LoadCursor", ($aResult[0] = 0), 0, True) Return $aResult[0] EndFunc ;==>_WinAPI_LoadCursor Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
ProgAndy Posted March 29, 2012 Share Posted March 29, 2012 (edited) Really strange. UPX should leave the resources accessible. Edit: AutoIt3Wrapper misses handling for RT_CURSOR and RT_CURSOR_GROUP resources. Here is a description of the required format: http://www.devsource.com/c/a/Architecture/Resources-From-PE-I/2/ Edited March 29, 2012 by ProgAndy *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...
Mobius Posted March 29, 2012 Share Posted March 29, 2012 Here is a description of the required format: http://www.devsource.com/c/a/Architecture/Resources-From-PE-I/2/Good link that filled in the blanks, thanks ProgAndy. Link to comment Share on other sites More sharing options...
wraithdu Posted March 29, 2012 Share Posted March 29, 2012 I took a look at the link, and I'll take a shot at adding support for the cursor types to AutoIt3Wrapper. No ETA obviously. One question from that description though... does a single cursor (ie NOT animated) still get a RT_GROUP_CURSOR entry with wNumImages = 1? I'm thinking the answer is yes. Link to comment Share on other sites More sharing options...
Mobius Posted March 29, 2012 Share Posted March 29, 2012 I took a look at the link, and I'll take a shot at adding support for the cursor types to AutoIt3Wrapper. No ETA obviously. One question from that description though... does a single cursor (ie NOT animated) still get a RT_GROUP_CURSOR entry with wNumImages = 1? I'm thinking the answer is yes.Yes Link to comment Share on other sites More sharing options...
wraithdu Posted March 30, 2012 Share Posted March 30, 2012 (edited) Ok, give the attached versions of AutoIt3Wrapper a test. I've included an x86 and x64 version, and tested each when compiling both 32-bit and 64-bit exe's. It should have full support for cursors now. FYI, AutoIt3Wrapper doesn't support PNG compressed icons or cursors at the moment (Vista+).Regarding RT_ANICURSOR and RT_ANIICON. These resources are stored as raw binary data, similar to RT_RCDATA. This is just how it is done, and you'll need to extract the resources to files to use them. If you can find any information to the contrary, please let me know.You could pseudo work around this by storing your animated cursor as individual icons then manually animating them like an animated gif. I think trancexxx has done similar things, as well as some tray icon UDF somewhere. But that is beyond the scope of this thread and AutoIt3Wrapper.Let me know how it goes and I'll get the changes to Jos.Edit:Apparently you CAN load an animated cursor from a resource. See Zedna's next post.Edit 2:Jos has merged the changes and uploaded the new version to the SciTE beta directory for everyone to download. Enjoy! Edited March 30, 2012 by wraithdu Link to comment Share on other sites More sharing options...
Zedna Posted March 30, 2012 Author Share Posted March 30, 2012 (edited) ... Let me know how it goes and I'll get the changes to Jos. Thanks!! Now I tested this new AutoIt3Wrapper and it works fine with standard cursors (.cur) and also with animated cursors (.ani) It works fine also with cursors (also animated) from my Windows7. Here is testing script: expandcollapse popup; cursors from Win7 #AutoIt3Wrapper_Res_File_Add=aero_link.cur, rt_cursor, CUR_1 #AutoIt3Wrapper_Res_File_Add=aero_busy.ani, rt_anicursor, ANI_CUR_1 ; cursors from Win XP #AutoIt3Wrapper_Res_File_Add=3dsmove.cur, 1, CUR_2 #AutoIt3Wrapper_Res_File_Add=banana.ani, rt_anicursor, ANI_CUR_2 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n #include <GuiConstants.au3> #include <WinAPI.au3> $gui = GUICreate("Cursor from resources example",820,400) $label1 = GUICtrlCreateLabel("abc def",20,320,380,100) ; controls in GUI with standard cursor GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SETCURSOR, 'WM_SETCURSOR') $hInstance = _WinAPI_GetModuleHandle("") $hCursor = _WinAPI_LoadCursor($hInstance, 'CUR_2') _WinAPI_SetCursor($hCursor) Sleep(5000) $hCursor = _WinAPI_LoadCursor($hInstance, 'ANI_CUR_2') _WinAPI_SetCursor($hCursor) While 1 If GUIGetMsg() = -3 Then Exit WEnd Func WM_SETCURSOR($hWnd, $iMsg, $iWParam, $iLParam) If $hWnd = $gui Then _WinAPI_SetCursor($hCursor) Return 0 EndIf Return $GUI_RUNDEFMSG EndFunc Func _WinAPI_LoadCursor($hInstance, $sCursor) Local $aResult, $sType = "int" If IsString($sCursor) Then $sType = "str" $aResult = DllCall("User32.dll", "hwnd", "LoadCursor", "hwnd", $hInstance, $sType, $sCursor) _WinAPI_Check("_WinAPI_LoadCursor", ($aResult[0] = 0), 0, True) Return $aResult[0] EndFunc ;==>_WinAPI_LoadCursorCURSORS.zip Edited March 30, 2012 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
wraithdu Posted March 30, 2012 Share Posted March 30, 2012 Heh, that's awesome I had no idea you could load an animated cursor from a resource. All the research I did last night made it seem like you had to save it out to a file first. I'm curious if you found somewhere that was documented, or if you just tried it out. 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