Leaderboard
Popular Content
Showing content with the highest reputation on 12/26/2021 in all areas
-
There are also several other options from other users, if you search for "color picker". Like @Yashied 's Color Picker UDF https://www.autoitscript.com/forum/topic/96464-colorpicker-udf/page/3/#comments And @KaFu's COP Color Picker multi value color picking https://www.autoitscript.com/forum/topic/80320-cop-color-picker-multi-value-color-picking/?tab=comments#comment-577922 And more. /edit, ohh, like this one from @LarsJ https://www.autoitscript.com/forum/topic/170523-simulating-a-modeless-choose-color-dialog/?tab=comments#comment-12467262 points
-
Ah, never mind. I found it. It's _ChooseColor. I searched for color dialog. My bad.1 point
-
Maybe this depends on some setting or Python version. The version I used to test doesn't output C-style escapes for control characters, but yours seem to do just that. In your last example, TAB (ASCII 0x09) can be output as \x09 or \t (C-style escape). Of course the result is 100% equivalent. Here's a version featuring C-style escape sequences: Local $sSecret = "TC3Gu5t9xGARNpq86cd98joQYCN3*******" Local $sMessage = "2019-02-25" ConsoleWrite(@LF & "Python hexdigest form:" & @LF) ConsoleWrite("HMAC-SHA512: " & @TAB & @TAB & _HashHMAC("SHA512", $sMessage, $sSecret) & @CRLF) ConsoleWrite("HMAC-SHA384: " & @TAB & @TAB & _HashHMAC("SHA384", $sMessage, $sSecret) & @CRLF) ConsoleWrite("HMAC-SHA256: " & @TAB & @TAB & _HashHMAC("SHA256", $sMessage, $sSecret) & @CRLF) ConsoleWrite("HMAC-RIPEMD160: " & @TAB & _HashHMAC("RIPEMD160", $sMessage, $sSecret) & @CRLF) ConsoleWrite("HMAC-SHA1: " & @TAB & @TAB & _HashHMAC("SHA1", $sMessage, $sSecret) & @CRLF) ConsoleWrite("HMAC-MD5: " & @TAB & @TAB & _HashHMAC("MD5", $sMessage, $sSecret) & @CRLF) ConsoleWrite(@LF & "Python digest form:" & @LF) ConsoleWrite("HMAC-SHA512: " & @TAB & @TAB & _HashHMAC("SHA512", $sMessage, $sSecret, $HMAC_PYFORM) & @CRLF) ConsoleWrite("HMAC-SHA384: " & @TAB & @TAB & _HashHMAC("SHA384", $sMessage, $sSecret, $HMAC_PYFORM) & @CRLF) ConsoleWrite("HMAC-SHA256: " & @TAB & @TAB & _HashHMAC("SHA256", $sMessage, $sSecret, $HMAC_PYFORM) & @CRLF) ConsoleWrite("HMAC-RIPEMD160: " & @TAB & _HashHMAC("RIPEMD160", $sMessage, $sSecret, $HMAC_PYFORM) & @CRLF) ConsoleWrite("HMAC-SHA1: " & @TAB & @TAB & _HashHMAC("SHA1", $sMessage, $sSecret, $HMAC_PYFORM) & @CRLF) ConsoleWrite("HMAC-MD5: " & @TAB & @TAB & _HashHMAC("MD5", $sMessage, $sSecret, $HMAC_PYFORM) & @CRLF) Func _HashHMAC($sAlgorithm, $bData, $bKey, $iOutputForm = $HMAC_HEXFORM) Local $oHashHMACErrorHandler = ObjEvent("AutoIt.Error", "_HashHMACErrorHandler") Local $oHMAC = ObjCreate("System.Security.Cryptography.HMAC" & $sAlgorithm) If @error Then SetError(1, 0, "") $oHMAC.key = Binary($bKey) Local $bHash = $oHMAC.ComputeHash_2(Binary($bData)) Local $sHex = StringLower(StringMid($bHash, 3)) Switch $iOutputForm Case $HMAC_RAWFORM Return $bHash Case $HMAC_HEXFORM Return $sHex Case $HMAC_PYFORM Local $c, $sPy For $i = 1 To BinaryLen($bHash) $c = BinaryMid($bHash, $i, 1) Switch $c Case 0x00 To 0x06, 0x0E To 0x1F, 0x7F To 0xFF $sPy &= "\x" & StringLower(Hex($c, 2)) Case 0x07 ; BELL $sPy &= "\a" Case 0x08 ; BS $sPy &= "\b" Case 0x09 ; HTAB $sPy &= "\t" Case 0x0A ; LF $sPy &= "\n" Case 0x0B ; VTAB $sPy &= "\v" Case 0x0C ; FF $sPy &= "\f" Case 0x0D ; CR $sPy &= "\r" Case 0x22 $sPy &= '\"' ; escaping single quote may not be required Case 0x27 $sPy &= "\'" ; escaping double quote may not be required Case 0x5C $sPy &= "\\" Case Else $sPy &= Chr($c) EndSwitch Next Return $sPy Case Else Return SetError(2) EndSwitch EndFunc ;==>_HashHMAC Func _HashHMACErrorHandler($oError) ;Dummy Error Handler EndFunc ;==>_HashHMACErrorHandler1 point
-
I don't get it. Using your values: Local $sSecret = "TC3Gu5t9xGARNpq86cd98joQYCN3*******" Local $sMessage = "2019-02-25" and the script above as is now (last edited), I get this: Python hexdigest form: HMAC-SHA512: 125753b86f4425fa4a35663ad918cd129c0aaa963062a6d84ede71493fc352cc3dd93db80668f2b2a539ebb58cf4abf055006ff084055c13c1b428ee61d07b7a HMAC-SHA384: 0eff73645a835de1f78a44d9487f8cf61d7b13c0057ba1371c4b522a9db2afca0671165bfe74aff75be2d25cafc4d69b HMAC-SHA256: f1cb4d518a0eda9d5cbbfdb7850983f1e603eeae484edea76e4dd8d8deb5556e HMAC-RIPEMD160: dcd6396ea581b0c47a0769c57744503e20f336fa HMAC-SHA1: 4e34c2586c2bff5e4501a7e5e87c599463ea090f HMAC-MD5: bd01e348b876a764cb026490b0b8ca6a Python digest form: HMAC-SHA512: \x12WS\xb8oD%\xfaJ5f:\xd9\x18\xcd\x12\x9c\x0a\xaa\x960b\xa6\xd8N\xdeqI?\xc3R\xcc=\xd9=\xb8\x06h\xf2\xb2\xa59\xeb\xb5\x8c\xf4\xab\xf0U\x00o\xf0\x84\x05\\\x13\xc1\xb4(\xeea\xd0{z HMAC-SHA384: \x0e\xffsdZ\x83]\xe1\xf7\x8aD\xd9H\x7f\x8c\xf6\x1d{\x13\xc0\x05{\xa17\x1cKR*\x9d\xb2\xaf\xca\x06q\x16[\xfet\xaf\xf7[\xe2\xd2\\\xaf\xc4\xd6\x9b HMAC-SHA256: \xf1\xcbMQ\x8a\x0e\xda\x9d\\\xbb\xfd\xb7\x85\x09\x83\xf1\xe6\x03\xee\xaeHN\xde\xa7nM\xd8\xd8\xde\xb5Un HMAC-RIPEMD160: \xdc\xd69n\xa5\x81\xb0\xc4z\x07i\xc5wDP> \xf36\xfa HMAC-SHA1: N4\xc2Xl+\xff^E\x01\xa7\xe5\xe8|Y\x94c\xea\x09\x0f HMAC-MD5: \xbd\x01\xe3H\xb8v\xa7d\xcb\x02d\x90\xb0\xb8\xcaj1 point
-
You're right.. Searching for windows registry run at shutdown indeed gives relevant results. I will try it now, thank you.1 point
-
1 point
-
Yeah that helps. The SQLite Expert program that jchd put me on to has an sql builder section. This has helped me loads, when building and to understand the returned queries. It shows the relationships betwen the table, albeit not as clearly as your picture. It is great for simple queries, which I then convert to AutoIt functions. For more complex ones, it's to the books or google to see if it is possible to do it, which it always has been. There will be a lot more tables as each category will have one with switches to be used with the installer files. This program only creates and edits the db files, (see pic) I still need to create the program that reads the db. If I could stop redesigning GUI's, adding functionality, changing font colours and stop trying to make code that's clean and short while still readable (instead of making it work then trimming) I may have finished it sooner. A lot of time is also lost on adding logging (I wrote my own UDF which took a while) and return codes etc, though this is not wasted time. It seems like whatever I want to do, I have to discover how to do it. Thanks again for them pic, saved and will print off.1 point
-
Yeah, Sorry about the "one array". Half the info was left in my head. I am using AutoIT for the program and the _SQLite* functions for DB interaction. When using _SQLite_QuerySingleRow, the function returns an array. I use this array to populate controls in a loop. Your code above works great, and I will be able to use it when it becomes a function. Seems like this project will never get finished. Thanks for your continued support. See you next year 😆1 point
-
I don't know what you meant by "in one array using sqlite". If you meant in a single SQLITE function call, then there are several ways. Below, is an example of one of the ways you could do it. Since I'm the one that replied to your previous SQL-related topic, almost a year ago to the day, I'll keep the tradition going by replying to this one too. 😉 SELECT plat.id, i.path, pkg.type, i.switches, ver.version, c.class, i.install_order, i.id AS installer_id, i.display_name, i.display_version, i.display_description, group_concat(u.username) AS user_list FROM installer i INNER JOIN category c ON c.id = i.category_id INNER JOIN installer_user iu ON i.id = iu.installer_id INNER JOIN user u ON u.id = iu.user_id INNER JOIN platform plat ON plat.id = i.platform_id INNER JOIN package pkg ON pkg.id = i.package_id INNER JOIN minwinver ver ON ver.id = i.minwinver_id WHERE i.display_name = 'SciTE4AutoIt3' AND i.id = 5 GROUP BY plat.id, i.path, pkg.type, i.switches, ver.version, c.class, i.install_order, i.id, i.display_name, i.display_version, i.display_description;1 point
-
In my code optimization work, I only work with these 2 functions so I share it: ; # Dao Van Trong - TRONG.LIVE # ======================================================= ; Title .........: Resource UDF for RCDATA ; ; _RCDATA_GetResAsBytes($sResNameOrID, $iResLang = 0) ; _RCDATA_GetResAsString($sResNameOrID, $iResLang = 0) ; ; ================================================================ #Region - # FUNCTION # Func _RCDATA_GetResAsBytes($sResNameOrID, $iResLang = 0) Local $hRes, $hInstance = __WinAPI_GetModuleHandle(Null) If ($iResLang <> 0) Then $hRes = __WinAPI_FindResourceEx($hInstance, 10, $sResNameOrID, $iResLang) ;$RT_RCDATA = 10 Else $hRes = __WinAPI_FindResource($hInstance, 10, $sResNameOrID) EndIf If @error Or Not $hRes Then Return SetError(1, 0, 0) Local $dSize = __WinAPI_SizeOfResource($hInstance, $hRes) If @error Or Not $dSize Then Return SetError(2, 0, 0) Local $hLoad = __WinAPI_LoadResource($hInstance, $hRes) If @error Or Not $hLoad Then Return SetError(3, 0, 0) Local $pData = __WinAPI_LockResource($hLoad) If @error Or Not $pData Then Return SetError(4, 0, 0) Local $tBuffer = DllStructCreate("byte[" & $dSize & "]") __WinAPI_MoveMemory(DllStructGetPtr($tBuffer), $pData, $dSize) Return DllStructGetData($tBuffer, 1) EndFunc ;==>_RCDATA_GetResAsBytes Func _RCDATA_GetResAsString($sResNameOrID, $iResLang = 0) Local $pResource = _RCDATA_GetResAsBytes($sResNameOrID, $iResLang) If @error Then Return SetError(1, 0, 0) Local $iError = @error, $iLength = @extended Local Enum $BINARYTOSTRING_NONE, $BINARYTOSTRING_ANSI, $BINARYTOSTRING_UTF16LE, $BINARYTOSTRING_UTF16BE, $BINARYTOSTRING_UTF8 Local $iStart = $BINARYTOSTRING_NONE, $iUTFEncoding = $BINARYTOSTRING_ANSI Local Const $sUTF8 = '0xEFBBBF', $sUTF16BE = '0xFEFF', $sUTF16LE = '0xFFFE', $sUTF32BE = '0x0000FEFF', $sUTF32LE = '0xFFFE0000' Local $iUTF8 = BinaryLen($sUTF8), $iUTF16BE = BinaryLen($sUTF16BE), $iUTF16LE = BinaryLen($sUTF16LE), $iUTF32BE = BinaryLen($sUTF32BE), $iUTF32LE = BinaryLen($sUTF32LE) Select Case BinaryMid($pResource, 1, $iUTF32BE) = $sUTF32BE $iStart = $iUTF32BE $iUTFEncoding = $BINARYTOSTRING_ANSI Case BinaryMid($pResource, 1, $iUTF32LE) = $sUTF32LE $iStart = $iUTF32LE $iUTFEncoding = $BINARYTOSTRING_ANSI Case BinaryMid($pResource, 1, $iUTF16BE) = $sUTF16BE $iStart = $iUTF16BE $iUTFEncoding = $BINARYTOSTRING_UTF16BE Case BinaryMid($pResource, 1, $iUTF16LE) = $sUTF16LE $iStart = $iUTF16LE $iUTFEncoding = $BINARYTOSTRING_UTF16LE Case BinaryMid($pResource, 1, $iUTF8) = $sUTF8 $iStart = $iUTF8 $iUTFEncoding = $BINARYTOSTRING_UTF8 EndSelect $iStart += 1 $iLength = $iLength + 1 - $iStart Local $sString = BinaryToString(BinaryMid($pResource, $iStart), $iUTFEncoding) $pResource = 0 Return SetError($iError, $iLength, $sString) EndFunc ;==>_RCDATA_GetResAsString #EndRegion - # FUNCTION # #Region ; #INTERNAL_USE_ONLY# # Dao Van Trong - TRONG.LIVE ;#include <WinAPIRes.au3> ;#include <WinAPIInternals.au3> Func __WinAPI_GetModuleHandle($sModuleName) If $sModuleName = "" Then $sModuleName = Null Local $aCall = DllCall("kernel32.dll", "handle", "GetModuleHandleW", "wstr", $sModuleName) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_GetModuleHandle Func __WinAPI_IsBadReadPtr($pAddress, $iLength) Local $aCall = DllCall('kernel32.dll', 'bool', 'IsBadReadPtr', 'struct*', $pAddress, 'uint_ptr', $iLength) If @error Then Return SetError(@error, @extended, False) Return $aCall[0] EndFunc ;==>__WinAPI_IsBadReadPtr Func __WinAPI_IsBadWritePtr($pAddress, $iLength) Local $aCall = DllCall('kernel32.dll', 'bool', 'IsBadWritePtr', 'struct*', $pAddress, 'uint_ptr', $iLength) If @error Then Return SetError(@error, @extended, False) Return $aCall[0] EndFunc ;==>__WinAPI_IsBadWritePtr Func __WinAPI_MoveMemory($pDestination, $pSource, $iLength) If __WinAPI_IsBadReadPtr($pSource, $iLength) Then Return SetError(10, @extended, 0) If __WinAPI_IsBadWritePtr($pDestination, $iLength) Then Return SetError(11, @extended, 0) DllCall('ntdll.dll', 'none', 'RtlMoveMemory', 'struct*', $pDestination, 'struct*', $pSource, 'ulong_ptr', $iLength) If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc ;==>__WinAPI_MoveMemory Func __WinAPI_FindResource($hInstance, $sType, $sName) Local $sTypeOfType = 'int', $sTypeOfName = 'int' If IsString($sType) Then $sTypeOfType = 'wstr' EndIf If IsString($sName) Then $sTypeOfName = 'wstr' EndIf Local $aCall = DllCall('kernel32.dll', 'handle', 'FindResourceW', 'handle', $hInstance, $sTypeOfName, $sName, $sTypeOfType, $sType) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_FindResource Func __WinAPI_FindResourceEx($hInstance, $sType, $sName, $iLanguage) Local $sTypeOfType = 'int', $sTypeOfName = 'int' If IsString($sType) Then $sTypeOfType = 'wstr' EndIf If IsString($sName) Then $sTypeOfName = 'wstr' EndIf Local $aCall = DllCall('kernel32.dll', 'handle', 'FindResourceExW', 'handle', $hInstance, $sTypeOfType, $sType, $sTypeOfName, $sName, 'ushort', $iLanguage) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_FindResourceEx Func __WinAPI_LoadResource($hInstance, $hResource) Local $aCall = DllCall('kernel32.dll', 'handle', 'LoadResource', 'handle', $hInstance, 'handle', $hResource) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_LoadResource Func __WinAPI_LockResource($hData) Local $aCall = DllCall('kernel32.dll', 'ptr', 'LockResource', 'handle', $hData) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_LockResource Func __WinAPI_SizeOfResource($hInstance, $hResource) Local $aCall = DllCall('kernel32.dll', 'dword', 'SizeofResource', 'handle', $hInstance, 'handle', $hResource) If @error Or Not $aCall[0] Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_SizeOfResource #EndRegion ; #INTERNAL_USE_ONLY# # Dao Van Trong - TRONG.LIVE ;# Dao Van Trong - TRONG.LIVE1 point
-
I use it for source code protection. By saving the data to Rescource RCDATA and encrypting and packaging the exe file. Decompiled Autoit source code doesn't seem too difficult, but Unpack technique is not everyone can do! #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_File_Add=FileNameInDisk.ext, RT_RCDATA, FileNameInRes, 0 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** If Not @Compiled Then Exit MsgBox(64, "", "You need Compile this script !") Global $FileContent = _RCDATA_GetResAsString('FileNameInRes') ConsoleWrite("Get Resource AsString E: " & @error & @CRLF) ConsoleWrite("Resource Type: " & VarGetType($FileContent) & @CRLF) ConsoleWrite("-Data (" & StringLen($FileContent) & "): " & $FileContent & @CRLF) Sleep(1000) _WriteToFile(@ScriptDir & "\" & "_FileNameInDisk_1.ext", $FileContent, 16) Global $FileContent = _RCDATA_GetResAsBytes('FileNameInRes') ConsoleWrite("Get Resource AsBytes E: " & @error & @CRLF) ConsoleWrite("Resource Type: " & VarGetType($FileContent) & @CRLF) ConsoleWrite("-Data (" & StringLen($FileContent) & "): " & $FileContent & @CRLF) Sleep(1000) _WriteToFile(@ScriptDir & "\" & "_FileNameInDisk_2.ext", $FileContent, 16) Sleep(5000) Func _WriteToFile($pFile, $sData = '', $Mode = 16) FileDelete($pFile) ConsoleWrite("+File: " & $pFile & @CRLF) ;ConsoleWrite("-Data: " & $sData & @CRLF) ConsoleWrite("-Data len: " & StringLen($sData) & @CRLF) Local $hOpen = FileOpen($pFile, 2 + 8 + $Mode) ConsoleWrite("-FileOpen " & $pFile & " E: " & @error & @CRLF) Local $FileWrite = FileWrite($hOpen, $sData) ConsoleWrite("-FileWrite (" & $FileWrite & ") " & $pFile & " E: " & @error & @CRLF) FileClose($hOpen) ConsoleWrite("-FileClose " & $pFile & " E: " & @error & @CRLF) ConsoleWrite("-FileExists: " & FileExists($pFile) & @CRLF) Sleep(500) EndFunc ;==>_WriteToFile ; # Dao Van Trong - TRONG.LIVE # ======================================================= ; Title .........: Resource UDF for RCDATA ; ; _RCDATA_GetResAsBytes($sResNameOrID, $iResLang = 0) ; _RCDATA_GetResAsString($sResNameOrID, $iResLang = 0) ; ; ================================================================ #Region - # FUNCTION # Func _RCDATA_GetResAsBytes($sResNameOrID, $iResLang = 0) Local $hRes, $hInstance = __WinAPI_GetModuleHandle(Null) If ($iResLang <> 0) Then $hRes = __WinAPI_FindResourceEx($hInstance, 10, $sResNameOrID, $iResLang) ;$RT_RCDATA = 10 Else $hRes = __WinAPI_FindResource($hInstance, 10, $sResNameOrID) EndIf If @error Or Not $hRes Then Return SetError(1, 0, 0) Local $dSize = __WinAPI_SizeOfResource($hInstance, $hRes) If @error Or Not $dSize Then Return SetError(2, 0, 0) Local $hLoad = __WinAPI_LoadResource($hInstance, $hRes) If @error Or Not $hLoad Then Return SetError(3, 0, 0) Local $pData = __WinAPI_LockResource($hLoad) If @error Or Not $pData Then Return SetError(4, 0, 0) Local $tBuffer = DllStructCreate("byte[" & $dSize & "]") __WinAPI_MoveMemory(DllStructGetPtr($tBuffer), $pData, $dSize) Return DllStructGetData($tBuffer, 1) EndFunc ;==>_RCDATA_GetResAsBytes Func _RCDATA_GetResAsString($sResNameOrID, $iResLang = 0) Local $pResource = _RCDATA_GetResAsBytes($sResNameOrID, $iResLang) If @error Then Return SetError(1, 0, 0) Local $iError = @error, $iLength = @extended Local Enum $BINARYTOSTRING_NONE, $BINARYTOSTRING_ANSI, $BINARYTOSTRING_UTF16LE, $BINARYTOSTRING_UTF16BE, $BINARYTOSTRING_UTF8 Local $iStart = $BINARYTOSTRING_NONE, $iUTFEncoding = $BINARYTOSTRING_ANSI Local Const $sUTF8 = '0xEFBBBF', $sUTF16BE = '0xFEFF', $sUTF16LE = '0xFFFE', $sUTF32BE = '0x0000FEFF', $sUTF32LE = '0xFFFE0000' Local $iUTF8 = BinaryLen($sUTF8), $iUTF16BE = BinaryLen($sUTF16BE), $iUTF16LE = BinaryLen($sUTF16LE), $iUTF32BE = BinaryLen($sUTF32BE), $iUTF32LE = BinaryLen($sUTF32LE) Select Case BinaryMid($pResource, 1, $iUTF32BE) = $sUTF32BE $iStart = $iUTF32BE $iUTFEncoding = $BINARYTOSTRING_ANSI Case BinaryMid($pResource, 1, $iUTF32LE) = $sUTF32LE $iStart = $iUTF32LE $iUTFEncoding = $BINARYTOSTRING_ANSI Case BinaryMid($pResource, 1, $iUTF16BE) = $sUTF16BE $iStart = $iUTF16BE $iUTFEncoding = $BINARYTOSTRING_UTF16BE Case BinaryMid($pResource, 1, $iUTF16LE) = $sUTF16LE $iStart = $iUTF16LE $iUTFEncoding = $BINARYTOSTRING_UTF16LE Case BinaryMid($pResource, 1, $iUTF8) = $sUTF8 $iStart = $iUTF8 $iUTFEncoding = $BINARYTOSTRING_UTF8 EndSelect $iStart += 1 $iLength = $iLength + 1 - $iStart Local $sString = BinaryToString(BinaryMid($pResource, $iStart), $iUTFEncoding) $pResource = 0 Return SetError($iError, $iLength, $sString) EndFunc ;==>_RCDATA_GetResAsString #EndRegion - # FUNCTION # #Region ; #INTERNAL_USE_ONLY# # Dao Van Trong - TRONG.LIVE ;#include <WinAPIRes.au3> ;#include <WinAPIInternals.au3> Func __WinAPI_GetModuleHandle($sModuleName) If $sModuleName = "" Then $sModuleName = Null Local $aCall = DllCall("kernel32.dll", "handle", "GetModuleHandleW", "wstr", $sModuleName) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_GetModuleHandle Func __WinAPI_IsBadReadPtr($pAddress, $iLength) Local $aCall = DllCall('kernel32.dll', 'bool', 'IsBadReadPtr', 'struct*', $pAddress, 'uint_ptr', $iLength) If @error Then Return SetError(@error, @extended, False) Return $aCall[0] EndFunc ;==>__WinAPI_IsBadReadPtr Func __WinAPI_IsBadWritePtr($pAddress, $iLength) Local $aCall = DllCall('kernel32.dll', 'bool', 'IsBadWritePtr', 'struct*', $pAddress, 'uint_ptr', $iLength) If @error Then Return SetError(@error, @extended, False) Return $aCall[0] EndFunc ;==>__WinAPI_IsBadWritePtr Func __WinAPI_MoveMemory($pDestination, $pSource, $iLength) If __WinAPI_IsBadReadPtr($pSource, $iLength) Then Return SetError(10, @extended, 0) If __WinAPI_IsBadWritePtr($pDestination, $iLength) Then Return SetError(11, @extended, 0) DllCall('ntdll.dll', 'none', 'RtlMoveMemory', 'struct*', $pDestination, 'struct*', $pSource, 'ulong_ptr', $iLength) If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc ;==>__WinAPI_MoveMemory Func __WinAPI_FindResource($hInstance, $sType, $sName) Local $sTypeOfType = 'int', $sTypeOfName = 'int' If IsString($sType) Then $sTypeOfType = 'wstr' EndIf If IsString($sName) Then $sTypeOfName = 'wstr' EndIf Local $aCall = DllCall('kernel32.dll', 'handle', 'FindResourceW', 'handle', $hInstance, $sTypeOfName, $sName, $sTypeOfType, $sType) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_FindResource Func __WinAPI_FindResourceEx($hInstance, $sType, $sName, $iLanguage) Local $sTypeOfType = 'int', $sTypeOfName = 'int' If IsString($sType) Then $sTypeOfType = 'wstr' EndIf If IsString($sName) Then $sTypeOfName = 'wstr' EndIf Local $aCall = DllCall('kernel32.dll', 'handle', 'FindResourceExW', 'handle', $hInstance, $sTypeOfType, $sType, $sTypeOfName, $sName, 'ushort', $iLanguage) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_FindResourceEx Func __WinAPI_LoadResource($hInstance, $hResource) Local $aCall = DllCall('kernel32.dll', 'handle', 'LoadResource', 'handle', $hInstance, 'handle', $hResource) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_LoadResource Func __WinAPI_LockResource($hData) Local $aCall = DllCall('kernel32.dll', 'ptr', 'LockResource', 'handle', $hData) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_LockResource Func __WinAPI_SizeOfResource($hInstance, $hResource) Local $aCall = DllCall('kernel32.dll', 'dword', 'SizeofResource', 'handle', $hInstance, 'handle', $hResource) If @error Or Not $aCall[0] Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_SizeOfResource #EndRegion ; #INTERNAL_USE_ONLY# # Dao Van Trong - TRONG.LIVE ;# Dao Van Trong - TRONG.LIVE1 point
-
Finally.... he he. But how do i center the text??? The $sString will be replaced with a automatic pull from the system... #include <GDIPlus.au3> Global $hBitmap, $hImage, $hGraphic, $hFamily, $hFont, $tLayout, $hFormat, $aInfo, $hBrush1, $hBrush2, $iWidth, $iHeight, $hPen Global $sString="SERVERNAME" ; Initialize GDI+ library _GDIPlus_StartUp() ; Load image and emboss text $hImage = _GDIPlus_ImageLoadFromFile('C:\Temp\1.jpg') $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 38, 1) $hFormat = _GDIPlus_StringFormatCreate(0x4000) $hBrush2 = _GDIPlus_BrushCreateSolid(0xff000000) $hPen = _GDIPlus_PenCreate(0xC4000000, 1) $tLayout = _GDIPlus_RectFCreate (150, 250 ) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush2) ; Save image _GDIPlus_ImageSaveToFile($hImage, @MyDocumentsDir & '\AutoItImage2.bmp') ; Free resources _GDIPlus_PenDispose ($hPen ) _GDIPlus_BrushDispose ($hBrush1 ) _GDIPlus_BrushDispose ($hBrush2 ) _GDIPlus_StringFormatDispose($hFormat ) _GDIPlus_FontDispose ($hFont ) _GDIPlus_FontFamilyDispose ($hFamily ) _GDIPlus_GraphicsDispose ($hGraphic) _GDIPlus_ImageDispose ($hImage ) _GDIPlus_ShutDown() ; Show image Run("MSPaint.exe " & '"' & @MyDocumentsDir & '\AutoItImage2.bmp"')1 point