Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/21/2013 in all areas

  1. [NEW VERSION] - 2 Aug 18 Added: When specifying the icon to use, if the $vIcon parameter is set to the name of an ico or exe file, the main icon within will be displayed, but if a trailing "|" followed by the icon index is added to the name, that icon from within the file is used New UDF and example in the zip below. Details of previous versions: Changelog.txt A forum query about the small pop-ups that some apps produce from the systray led me to create my version of how this can be done. By the way, I call these small GUIs "Toasts" for obvious reasons! A zip containing the UDF, an example script and my StringSize UDF (which is also required): Toast.zip As always, kind comments and constructive criticisms welcome - particularly the former! M23
    1 point
  2. Here's 2 base64 machine code functions I wrote that came out pretty good. Both encode and decode are x64 capable. Comparing times for encoding/decoding the autoit.exe with Microsofts functions, I got them beat by a good percentage for both x84/x64 decode functions. I'm pretty sure thats due to my reverse index idea. It ended up working very well. I beat there x86 encode by a little bit, but they got me beat by just a hair for x64 encode. The attachment includes example that has the time tests I did, plus has the assembly source. Let me know if you have any issues or see something that is scewing my results somehow. Thanks! Func _B64Decode($sSource) Local Static $Opcode, $tMem, $tRevIndex, $fStartup = True If $fStartup Then If @AutoItX64 Then $Opcode = '0xC800000053574D89C74C89C74889D64889CB4C89C89948C7C10400000048F7F148C7C10300000048F7E14989C242807C0EFF3D750E49FFCA42807C0EFE3D750349FFCA4C89C89948C7C10800000048F7F14889C148FFC1488B064989CD48C7C108000000D7C0C0024188C349C1E30648C1E808E2EF49C1E308490FCB4C891F4883C7064883C6084C89E9E2CB4C89D05F5BC9C3' Else $Opcode = '0xC8080000FF75108B7D108B5D088B750C8B4D148B06D7C0C00288C2C1E808C1E206D7C0C00288C2C1E808C1E206D7C0C00288C2C1E808C1E206D7C0C00288C2C1E808C1E2060FCA891783C70383C604E2C2807EFF3D75084F807EFE3D75014FC6070089F85B29D8C9C21000' EndIf Local $aMemBuff = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", 0, "ulong_ptr", BinaryLen($Opcode), "dword", 4096, "dword", 64) $tMem = DllStructCreate('byte[' & BinaryLen($Opcode) & ']', $aMemBuff[0]) DllStructSetData($tMem, 1, $Opcode) Local $aRevIndex[128] Local $aTable = StringToASCIIArray('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/') For $i = 0 To UBound($aTable) - 1 $aRevIndex[$aTable[$i]] = $i Next $tRevIndex = DllStructCreate('byte[' & 128 & ']') DllStructSetData($tRevIndex, 1, StringToBinary(StringFromASCIIArray($aRevIndex))) $fStartup = False EndIf Local $iLen = StringLen($sSource) Local $tOutput = DllStructCreate('byte[' & $iLen + 8 & ']') DllCall("kernel32.dll", "bool", "VirtualProtect", "struct*", $tOutput, "dword_ptr", DllStructGetSize($tOutput), "dword", 0x00000004, "dword*", 0) Local $tSource = DllStructCreate('char[' & $iLen + 8 & ']') DllStructSetData($tSource, 1, $sSource) Local $aRet = DllCallAddress('uint', DllStructGetPtr($tMem), 'struct*', $tRevIndex, 'struct*', $tSource, 'struct*', $tOutput, 'uint', (@AutoItX64 ? $iLen : $iLen / 4)) Return BinaryMid(DllStructGetData($tOutput, 1), 1, $aRet[0]) EndFunc ;==>_B64Decode Func _B64Encode($sSource) Local Static $Opcode, $tMem, $fStartup = True If $fStartup Then If @AutoItX64 Then $Opcode = '0xC810000053574889CE4889D74C89C34C89C89948C7C10600000048F7F14889C14883FA00740348FFC1488B06480FC848C1E80EC0E802D788470748C1E806C0E802D788470648C1E806C0E802D788470548C1E806C0E802D788470448C1E806C0E802D788470348C1E806C0E802D788470248C1E806C0E802D788470148C1E806C0E802D788074883C6064883C708E2994883FA00743B49C7C5060000004929D54883FA03770349FFC54C29EF4883FA03741F4883FA01740E4883FA047408C6073D48FFC7EB0BC6073DC647013D4883C702C607005F5BC9C3' Else $Opcode = '0xC80800008B451499B903000000F7F189C1528B5D108B75088B7D0C83FA007401418B160FCAC1EA0888D0243FD7884703C1EA0688D0243FD7884702C1EA0688D0243FD7884701C1EA0688D0243FD7880783C60383C704E2C95A83FA00740DC647FF3D83FA027404C647FE3DC60700C9C21000' EndIf Local $aMemBuff = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", 0, "ulong_ptr", BinaryLen($Opcode), "dword", 4096, "dword", 64) $tMem = DllStructCreate('byte[' & BinaryLen($Opcode) & ']', $aMemBuff[0]) DllStructSetData($tMem, 1, $Opcode) $fStartup = False EndIf $sSource = Binary($sSource) Local $iLen = BinaryLen($sSource) $tSource = DllStructCreate('byte[' & $iLen & ']') DllStructSetData($tSource, 1, $sSource) Local $tOutput = DllStructCreate('char[' & Ceiling($iLen * (4 / 3) + 3) & ']') DllCall("kernel32.dll", "bool", "VirtualProtect", "struct*", $tOutput, "dword_ptr", DllStructGetSize($tOutput), "dword", 0x00000004, "dword*", 0) Local $sTable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' DllCallAddress('none', DllStructGetPtr($tMem), 'struct*', $tSource, 'struct*', $tOutput, 'str', $sTable, 'uint', $iLen) Return DllStructGetData($tOutput, 1) EndFunc ;==>_B64Encode Results: x86 >_B64Encode avg = 121.71071578269 _Base64Encode_MS avg = 133.64460931775 >_B64Decode avg = 106.147524856932 _Base64Decode_MS avg = 149.362345205542 Results: x64 >_B64Encode avg = 123.473349548198 _Base64Encode_MS avg = 122.300780993821 >_B64Decode avg = 113.430527477353 _Base64Decode_MS avg = 170.667366205978 b64.zip
    1 point
  3. Sundance

    DllCall help please.

    Hi. You must use $resultHDDSN[0] as the result of a successfull DLL call... #include <winapi.au3> Local $resultHDDSN Local $dll = DllOpen("HardwareIDExtractorC.dll") ConsoleWrite("DllOpen with result: " & $dll & @CRLF) $resultHDDSN = DllCall('HardwareIDExtractorC.dll', 'str', 'GetIDESerialNumber', "BYTE", 0) ConsoleWrite("DllCall @error: " & @error & @CRLF) ConsoleWrite('+_WinAPI_GetLastErrorMessage() = ' & _WinAPI_GetLastErrorMessage()) ConsoleWrite('+_WinAPI_GetLastError() = ' & _WinAPI_GetLastError() & @crlf) If @error Then Exit ConsoleWrite("resultHDDSN =" & $resultHDDSN[0] & @CRLF) DllClose($dll)
    1 point
  4. jaberwacky

    GlyphDesigner v1.00

    Don't thank me for the file open bug, you found it first!
    1 point
  5. Biatu

    GlyphDesigner v1.00

    v1.05 https://www.dropbox.com/s/m0arwooyradb78o/GlyphDesigner%20v1.05.exe -Fixed bug with ConfigMenu>GFX Options>Show Shade (Thanks jaberwocky6669) -Fixed bug with FileOpen -Fixed bug with FIleSave (Thanks czardas)
    1 point
  6. StefanS, How do you pass the data to the FileWrite command? Are you writing it manually in a single line? Becasue that will run into the line character limit. What you should do is store the entire thing into a single variable and then pass that: #include <FileConstants.au3> $sData = "################################" $sData &= "################################" ; etc, etc so that no line is over the 4095 limit $hFile = FileOpen("Your_File_Name", $FO_OVERWRITE) ; Now pass it all in one go FileWrite($hFile, $sData) FileClose($hFile) i have just written a 17Mb file like that to test it - so you should be good to go with a mere 29kb. M23 Edit: And I have lifted your "New Member" posting restriction - so this can go on an on and on and .... (if we really have to)!
    1 point
  7. Melba23

    Receive Enter from Edit

    PhoenixXL, Glad you like it. If you need to use the {ENTER} key in another control, you must disable/reenable the Accel key and use ControlSend like this: #include <GUIConstantsEx.au3> #include <WinAPI.au3> $hGUI = GUICreate("Test", 500, 500) $cInput = GUICtrlCreateInput("", 10, 10, 200, 20) $cButton = GUICtrlCreateButton("Test", 10, 100, 80, 30) $cEdit = GUICtrlCreateEdit("", 10, 300, 200, 100) $cEnter = GUICtrlCreateDummy() GUISetState() ; Set an accelerator key - ENTER will fire $cEnter Local $aAccelKeys[1][2] = [["{ENTER}", $cEnter]] GUISetAccelerators($aAccelKeys) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton ConsoleWrite(StringToBinary(GUICtrlRead($cEdit)) & @CRLF) Case $cEnter ; Get control with focus $hFocus = _WinAPI_GetFocus() If $hFocus = GUICtrlGetHandle($cInput) Then ; If input MsgBox(0, "Test", "Enter Pressed In Input") Else ; If not we need to disable the Accel key GUISetAccelerators(0) ; Send a CR to the control ControlSend($hGUI, "", $hFocus, @CR) ; And then reenable the Accel key GUISetAccelerators($aAccelKeys) EndIf EndSwitch WEndYou can test yourself to see what happens if you do not do the disable/reenable cycle. Or the result if you do not ControlSend an {ENTER} to the other control. M23
    1 point
  8. You can use Pythagoras to calculate distance between 2 points (2D): Func Pixel_Distance($x1, $y1, $x2, $y2) ;Pythagoras theorem for 2D Local $a, $b, $c If $x2 = $x1 And $y2 = $y1 Then Return 0 Else $a = $y2 - $y1 $b = $x2 - $x1 $c = Sqrt($a * $a + $b * $B) Return $c EndIf EndFunc ;==>Pixel_Distance If you want to calculate the distance for more than 2 point just calculate it between each points and sum the results. The slope of two points: m = (y2 - y1) / (x2 - x1) Just have a look to my GDI+ examples "Simple Ball Collision Simulation" where I used it! UEZ
    1 point
  9. Nonsense! The distance between points x,y and a,b is ((a-x)2 + (b-y)2)0.5 it's just the hypotenuse of the triangle (or the diagonal of the square) made by the line between the points and the vertical and horizontal lines through the points.
    1 point
×
×
  • Create New...