Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/26/2020 in all areas

  1. New UX Window in AutoIt v3 Watch Full Source Code : Link
    4 points
  2. Here is a idispatch object with all the base code written in assembly and is setup in a way so that it can be easily modified to integrate your own custom methods with minimal overhead code. Credits to @genius257 (and @trancexx for helping him) for his AutoitObject udf. I learned a tremendous amount from his code and a lot of the assembly is based of his work so many many thanks! Credits also to @LarsJ for his Accessing Autoit Variables thread showing us that we can expose the autoit variables via objects and how to work with the autoit variants/safearrays within assembly code. As mentioned above this is setup for you to modify so there's not a lot of functions you'll be calling directly and a good amount of code you should not have to touch but I'm going to explain the parts that your expected modify and how that code links to the functions you should not have to mess with. There's really only two spots. The first part is your function table. At the top of the IDispatchASM() function you will find a variable like code below called $sFunctions and will get used in two functions; _CreateFuncTable() and _AsmFuncTable(). You don't call these functions but that's where it gets used. One function gathers all the addresses of the functions and the other generates the assembly code allowing you to easily call these functions within your assembly code. The format is one dll per line with a comma separated list of functions for that dll. There is also one line included for autoit functions and will handle registering and releasing the callbacks so its all nicely in one spot. Local $sFunctions = 'kernel32.dll:HeapAlloc,GlobalAlloc,GlobalFree,GlobalLock,GlobalHandle,RtlMoveMemory' & @LF & _ 'oleaut32.dll:VariantInit,VariantCopy,VariantClear,' & @LF & _ 'au3:' & _RegisterAu3Callbacks('_CreateArray,ptr,dword|_GetKeys,ptr,ptr') To call any of function in the list, you just need to first load up a register with the current memory position and call that register with the function name added to it. Here's some small snips from the code showing what I mean: _('getmempos ebx'); load ebx with memory pos ..code... _('stdcall [ebx+_CreateArray], [esi+tObj.count]'); call autoit function to create an array for us to fill ..code... _('stdcall [ebx+VariantClear], [pVarResult]') _('stdcall [ebx+VariantCopy], [pVarResult],[edx+tProp.Variant]'); copy array to result _('stdcall [ebx+_CreateArray],0'); release object The second area that you will modify is the _invoke function and you would do this to add your own methods. All the methods that are currently included are completely optional and can be replaced/removed if you choose. Whats there right now is more or less practice. All you have to do to add your own method is create a new .elseif statement with the ID your assigning and name of method. Just follow the pattern like below. The _DefineDispID() function works hand in hand with the _AsmDispIDChecks() to automatically generate the lookup code needed to lookup the ID's. The only important part to remember when creating your own methods is that they MUST begin with characters "__" and you must use a negative ID starting at -2. I've written the lookup code to only check if this is one of our methods being called when the first 2 characters begin with "__" - this saves a lot of extra checking going on when its not a method being called. ;===================================== _(' .elseif dword[dispIdMember] = ' & _DefineDispID(-5,'__keys')); .. _(' getmempos ebx') ...code... _(' stdcall [ebx+_CreateArray],0'); release object ;===================================== _(' .elseif dword[dispIdMember] = ' & _DefineDispID(-6,'__fill')); _(' mov esi, [pDispParams]') ...code... _(' xor eax,eax'); set return S_OK ;===================================== _(' .elseif dword[dispIdMember] = ' & _DefineDispID(-7,'__reverse')) ; _(' mov esi, [pDispParams]') ...code... _(' xor eax,eax'); set return S_OK ;===================================== Let me know if you have issues, questions or comments. Thanks for looking Update 05/24/2020: I got x64 support working for this now. I didn't get all the methods converted but all the base code is there it looks to be stable (fingers crossed). It should be able to run this portion of the example either 32bit or 64bit. Example: Local $aArray = [111, 222, 333] $oIDispatch = IDispatchASM() $oIDispatch.string = "string test" $oIDispatch.__string = "__string test2" $oIDispatch.float = 12.345145 $oIDispatch.array = $aArray $oIDispatch.binary = Binary(12345678) $oIDispatch.bool = True $oIDispatch.dllStruct = DllStructCreate("BYTE t") $oIDispatch.dllStruct.t = 99 ConsoleWrite('-Direct get test:' & @CRLF & _ '$oIDispatch.string = ' & $oIDispatch.string & @CRLF & _ '$oIDispatch.__string = ' & $oIDispatch.__string & @CRLF & _ '$oIDispatch.float = ' & $oIDispatch.float & @CRLF & _ '$oIDispatch.array[1] = ' & $oIDispatch.array[1] & @CRLF) ConsoleWrite('-method __keysau3 test:' & @CRLF) Local $aKeyAU3s = $oIDispatch.__keysau3() ConsoleWrite('$aKeyAU3s = ' & _ArrayToString($aKeyAU3s) & @CRLF) ConsoleWrite('-method __get test:' & @CRLF) For $k In $oIDispatch.__keysau3() $val = $oIDispatch.__get($k) ConsoleWrite('$oIDispatch.' & $k & ' = ' & (IsArray($val) ? _ArrayToString($val) : (IsDllStruct($val) ? DllStructGetData($val, 1) : $val)) & @CRLF) Next ConsoleWrite('-method __set test:' & @CRLF) Local $i = 0 For $k In $oIDispatch.__keysau3() $oIDispatch.__set($k) = $i ConsoleWrite('$oIDispatch.' & $k & ' = ' & $oIDispatch.__get($k) & @CRLF) $i += 1 Next Output: -Direct get test: $oIDispatch.string = string test $oIDispatch.__string = __string test2 $oIDispatch.float = 12.345145 $oIDispatch.array[1] = 222 -method __keysau3 test: $aKeyAU3s = string|__string|float|array|binary|bool|dllStruct -method __get test: $oIDispatch.string = string test $oIDispatch.__string = __string test2 $oIDispatch.float = 12.345145 $oIDispatch.array = 111|222|333 $oIDispatch.binary = 0x4E61BC00 $oIDispatch.bool = True $oIDispatch.dllStruct = 99 -method __set test: $oIDispatch.string = 0 $oIDispatch.__string = 1 $oIDispatch.float = 2 $oIDispatch.array = 3 $oIDispatch.binary = 4 $oIDispatch.bool = 5 $oIDispatch.dllStruct = 6 I also added 2 more methods to the 32bit part. __PrintAllParms shows how to check the number of parms that were passed and then prints each one to the console. The second is __search and is generic (1D) array search method demonstrating the use of VarCmp function. That would be a key function in creating a arraysort as well. Let me know if you have any issues. Thanks! Edit: Fixed issue with beta versions of autoit not working IDispatchASM 5-24-2020.zip Previous versions:
    4 points
  3. Nine

    idm hex to value how can?

    Woot ! Working !
    2 points
  4. Nine

    idm hex to value how can?

    A different approach displaying correctly the 64 bits integer : Local $sHexStr = "f4c0bb7f00000000" ConsoleWrite("0x" & $sHexStr & " = " & _Hex2Dec($sHexStr) & " [signed]" & @CRLF) ConsoleWrite("0x" & $sHexStr & " = " & _Hex2Dec($sHexStr, False) & " [unsigned]" & @CRLF) $sHexStr = "f4c0bb7f" ConsoleWrite("0x" & $sHexStr & " = " & _Hex2Dec($sHexStr) & @CRLF) Func _Hex2Dec($iN, $bSigned = True) If Mod(StringLen($iN),2) Then $iN = "0" & $iN Local $tByte = DllStructCreate ("byte string [8]") Local $tINT64 = DllStructCreate ("INT64 int", DllStructGetPtr ($tByte)) Local $tUINT64 = DllStructCreate ("UINT64 uint", DllStructGetPtr ($tByte)) Local $j = 1, $aResult For $i = StringLen($iN)-1 to 0 Step -2 DllStructSetData ($tByte, "string", "0x" & StringMid($iN,$i,2),$j) $j += 1 Next If $bSigned Then $aResult = DllCall("msvcrt.dll", "INT:cdecl", "sprintf", "STR", "", "STR", "%lli", "INT64", $tINT64.int) Else $aResult = DllCall("msvcrt.dll", "INT:cdecl", "sprintf", "STR", "", "STR", "%llu", "UINT64", $tUINT64.uint) EndIf Return $aResult[1] EndFunc ;==>_Hex2Dec
    2 points
  5. jchd

    make process use less cpu

    @water PM me your GPS location and I'll send you a list of glass polishing shops in your vincinity. I use https://www.vetrox.fr/ yearly and I've always been happy with them servicing my own crystal ball.
    2 points
  6. jchd

    idm hex to value how can?

    Beware of endianness: 0x7FBBC0F4 = 2 143 011 060 [10] 0xF4C0BB7F = 4 106 271 615 [10] 0xF4C0BB7F00000000 = -810 441 778 791 448 576 [10] (signed) 0xF4C0BB7F00000000 = 17 636 302 294 918 103 040 [10] (unsigned)
    2 points
  7. Oh. Then I like to suggest to all users posting questions on this forum: Be as specific as possible. My crystal ball gets dusty over time and then delivers wrong predictions
    2 points
  8. GUIs of interest here are non-AutoIt GUIs not created with GUICreate(). They are created with Windows API functions eg. _WinAPI_CreateWindowEx(). (2020-04-26) Is it possible in such a non-AutoIt GUI to implement a Windows message loop? Which functionality and techniques do and do not work in such non-AutoIt GUIs? Which internal functions can be used? Can AutoIt and non-AutoIt GUIs exist side by side in the same script? Can existing UDFs be used? This example started last week with inspiration from this thread. After several tests during the week, I've decided to make a little more of the example. This is an update of first post. Over the coming weeks I'll be adding more code in new posts. If it all works well and stable, the ideas in the project may be seen in a wider perspective. Some information has been deleted during this update. The information will be added again later. Basic functionality What is a Windows message loop In Microsoft documentation, a message loop is usually coded like this: while GetMessage(&msg, 0, 0, 0) { // Retrieve a message from the message queue // Processes accelerator keystrokes if (!TranslateAccelerator( hwndMain, // handle to receiving window haccel, // handle to active accelerator table &msg)) // message data { TranslateMessage(&msg); // Translate a virtual-key message into a character message DispatchMessage(&msg); // Send a message to the window procedure } } And the window procedure is defined like this: LRESULT CALLBACK WinProc( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam) // second message parameter { switch (uMsg) { case WM_CREATE: // Initialize the window. return 0; case WM_PAINT: // Paint the window's client area. return 0; case WM_SIZE: // Set the size and position of the window. return 0; case WM_DESTROY: // Clean up window-specific data objects. return 0; // // Process other messages. // default: return DefWindowProc(hwnd, uMsg, wParam, lParam); } return 0; } Message loop The purpose of a message loop is first and foremost to keep the program running and prevent it from ending immediately. It's exactly the same in AutoIt. But why so complicated code as shown above? It's necessary for advanced message handling eg. to use keyboard accelerators that are local to the individual program and not global as hot keys. Window procedure The window procedure handles the messages sent from the DispatchMessage() function in the message loop. Even in a simpler message loop, messages are sent to the window procedure. This is done through deault code in the Windows API functions and the operating system. If a message isn't handled by the window procedure, it's forwarded to the default window procedure DefWindowProc(). 0) _WinAPI_RegisterClassEx.au3 This is the example of _WinAPI_RegisterClassEx() in the help file. _WinAPI_CreateWindowEx() is used to create the GUI window. The example here is a slightly modified version: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=y Opt( "MustDeclareVars", 1 ) #include <WinAPIRes.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> Global $bExit = False Example() Func Example() Local Const $sClass = "MyWindowClass" Local Const $sName = "_WinAPI_RegisterClassEx" ; Get module handle for the current process Local $hInstance = _WinAPI_GetModuleHandle( 0 ) ; Create a class cursor Local $hCursor = _WinAPI_LoadCursor( 0, 32512 ) ; IDC_ARROW ; Create a class icons (large and small) Local $tIcons = DllStructCreate( "ptr;ptr" ) _WinAPI_ExtractIconEx( @SystemDir & "\shell32.dll", 130, DllStructGetPtr( $tIcons, 1 ), DllStructGetPtr( $tIcons, 2 ), 1 ) Local $hIcon = DllStructGetData( $tIcons, 1 ) Local $hIconSm = DllStructGetData( $tIcons, 2 ) ; Create DLL callback function (window procedure) Local $pWinProc = DllCallbackGetPtr( DllCallbackRegister( "WinProc", "lresult", "hwnd;uint;wparam;lparam" ) ) ; Create and fill $tagWNDCLASSEX structure Local $tWCEX = DllStructCreate( $tagWNDCLASSEX & ";wchar szClassName[" & ( StringLen( $sClass ) + 1 ) & "]" ) DllStructSetData( $tWCEX, "Size", DllStructGetPtr( $tWCEX, "szClassName" ) - DllStructGetPtr( $tWCEX ) ) DllStructSetData( $tWCEX, "Style", 0 ) DllStructSetData( $tWCEX, "hWndProc", $pWinProc ) DllStructSetData( $tWCEX, "ClsExtra", 0 ) DllStructSetData( $tWCEX, "WndExtra", 0 ) DllStructSetData( $tWCEX, "hInstance", $hInstance ) DllStructSetData( $tWCEX, "hIcon", $hIcon ) DllStructSetData( $tWCEX, "hCursor", $hCursor ) DllStructSetData( $tWCEX, "hBackground", _WinAPI_CreateSolidBrush( _WinAPI_GetSysColor( $COLOR_3DFACE ) ) ) DllStructSetData( $tWCEX, "MenuName", 0 ) DllStructSetData( $tWCEX, "ClassName", DllStructGetPtr( $tWCEX, "szClassName" ) ) DllStructSetData( $tWCEX, "hIconSm", $hIconSm ) DllStructSetData( $tWCEX, "szClassName", $sClass ) ; Register a window class _WinAPI_RegisterClassEx( $tWCEX ) ; Create a window _WinAPI_CreateWindowEx( 0, $sClass, $sName, BitOR( $WS_CAPTION, $WS_POPUPWINDOW, $WS_VISIBLE ), ( @DesktopWidth - 826 ) / 2, ( @DesktopHeight - 584 ) / 2, 826, 584, 0 ) ; Main msg loop While Sleep(10) If $bExit Then ExitLoop WEnd ; Unregister window class and release resources _WinAPI_UnregisterClass( $sClass, $hInstance ) _WinAPI_DestroyCursor( $hCursor ) _WinAPI_DestroyIcon( $hIcon ) _WinAPI_DestroyIcon( $hIconSm ) EndFunc ; Window procedure Func WinProc( $hWnd, $iMsg, $wParam, $lParam ) Switch $iMsg Case $WM_CLOSE $bExit = True EndSwitch Return _WinAPI_DefWindowProcW( $hWnd, $iMsg, $wParam, $lParam ) EndFunc Note that the Esc key, which can normally be used to close an AutoIt window, doesn't work. But you can use Alt+F4 to close the window. Alt+F4 is a hot key. In the example, the main message loop is coded this way: ; Main msg loop While Sleep(10) If $bExit Then ExitLoop WEnd And the window procedure that handles messages: Func WinProc( $hWnd, $iMsg, $wParam, $lParam ) Switch $iMsg Case $WM_CLOSE $bExit = True EndSwitch Return _WinAPI_DefWindowProcW( $hWnd, $iMsg, $wParam, $lParam ) EndFunc Esc key In AutoIt, the Esc key to exit the program is implemented as an accelerator key. But this simple message loop is unable to handle keyboard accelerators. Keyboard accelerators The Microsoft documentation for keyboard accelerators can be found here. To use keyboard accelerators in a program, the following code steps must be implemented: Create a keyboard accelerator struct to store information Fill in the accelerator key structure with information Create an accelerator table with CreateAcceleratorTable() Include TranslateAccelerator() in the message loop Include a WM_COMMAND message handler in the window procedure Includes\WinMsgLoop.au3 (2020-04-26) WinMsgLoop.au3 implements the functions to use keyboard accelerators and to create a Windows message loop: #include-once ; Message structure Global Const $tagMSG = "hwnd hwnd;uint message;wparam wParam;lparam lParam;dword time;int X;int Y" ; Keyboard accelerator structure Global Const $tagACCEL = "byte fVirt;word key;word cmd;" ; Values of the fVirt field Global Const $FVIRTKEY = TRUE Global Const $FNOINVERT = 0x02 Global Const $FSHIFT = 0x04 Global Const $FCONTROL = 0x08 Global Const $FALT = 0x10 #cs ; One accelerator key Local $tAccel = DllStructCreate( $tagACCEL ) DllStructSetData( $tAccel, "fVirt", $FVIRTKEY ) DllStructSetData( $tAccel, "key", $VK_ESCAPE ) DllStructSetData( $tAccel, "cmd", $VK_ESCAPE ) ; cmd = key to keep it simple ; Two accelerator keys Local $tAccel = DllStructCreate( $tagACCEL & $tagACCEL ) DllStructSetData( $tAccel, 1, $FVIRTKEY ) DllStructSetData( $tAccel, 2, $VK_KEY1 ) DllStructSetData( $tAccel, 3, $VK_KEY1 ) DllStructSetData( $tAccel, 4, $FVIRTKEY ) DllStructSetData( $tAccel, 5, $VK_KEY2 ) DllStructSetData( $tAccel, 6, $VK_KEY2 ) #ce ; Error handling ; @error = 0: No errors ; 1: Parameter error ; Create a keyboard accelerator table Func WinMsgLoop_CreateAcceleratorTable( $tAccel ) Local $iSize = DllStructGetSize( $tAccel ) If Mod( $iSize, 6 ) Then Return SetError(1,0,0) ; SetError ( code [, extended = 0 [, return value]] ) Return DllCall( "User32.dll", "handle", "CreateAcceleratorTableW", "struct*", $tAccel, "int", $iSize/6 )[0] EndFunc ; Retrieve a message from the message queue Func WinMsgLoop_GetMessage( ByRef $tMsg ) Return DllCall( "User32.dll", "bool", "GetMessageW", "struct*", $tMsg, "hwnd", 0, "uint", 0, "uint", 0 )[0] EndFunc ; Processes accelerator keystrokes Func WinMsgLoop_TranslateAccelerator( $hWnd, $hAccel, ByRef $tMsg ) Return DllCall( "User32.dll", "int", "TranslateAcceleratorW", "hwnd", $hWnd, "handle", $hAccel, "struct*", $tMsg )[0] EndFunc ; Processes dialog box messages Func WinMsgLoop_IsDialogMessage( $hWnd, ByRef $tMsg ) Return DllCall( "User32.dll", "bool", "IsDialogMessageW", "hwnd", $hWnd, "struct*", $tMsg )[0] EndFunc ; Translate a virtual-key message into a character message Func WinMsgLoop_TranslateMessage( ByRef $tMsg ) DllCall( "User32.dll", "bool", "TranslateMessage", "struct*", $tMsg ) EndFunc ; Send a message to the window procedure Func WinMsgLoop_DispatchMessage( ByRef $tMsg ) DllCall( "User32.dll", "lresult", "DispatchMessageW", "struct*", $tMsg ) EndFunc ; Destroy a keyboard accelerator table Func WinMsgLoop_DestroyAcceleratorTable( $hAccel ) DllCall( "User32.dll", "bool", "DestroyAcceleratorTable", "handle", $hAccel ) EndFunc ; Posts a WM_QUIT message to the message queue ; WinMsgLoop_GetMessage() returns 0 on WM_QUIT and the message loop terminates Func WinMsgLoop_PostQuitMessage( $iExitCode = 0 ) Return DllCall( "User32.dll", "none", "PostQuitMessage", "int", $iExitCode )[0] EndFunc 1) Windows message loop.au3 In this example, the Esc and End keys can be used to exit the program. It contains a complete Windows message loop. The script contains a number of ConsoleWrites so you can see what's going on in SciTE console. Keyboard accelerators: #cs ; Esc accelerator key to Exit ; Create keyboard accelerator structure Local $tAccel = DllStructCreate( $tagACCEL ) DllStructSetData( $tAccel, "fVirt", $FVIRTKEY ) DllStructSetData( $tAccel, "key", $VK_ESCAPE ) DllStructSetData( $tAccel, "cmd", $VK_ESCAPE ) ; cmd = key to keep it simple #ce ; Esc/End accelerator keys to Exit ; Create keyboard accelerator structure Local $tAccel = DllStructCreate( $tagACCEL & $tagACCEL ) DllStructSetData( $tAccel, 1, $FVIRTKEY ) DllStructSetData( $tAccel, 2, $VK_ESCAPE ) DllStructSetData( $tAccel, 3, $VK_ESCAPE ) ; cmd = key to keep it simple DllStructSetData( $tAccel, 4, $FVIRTKEY ) DllStructSetData( $tAccel, 5, $VK_END ) DllStructSetData( $tAccel, 6, $VK_END ) ; Create a keyboard accelerator table Local $hAccel = WinMsgLoop_CreateAcceleratorTable( $tAccel ) ConsoleWrite( "$hAccel = " & $hAccel & @CRLF & @CRLF ) Using dialog box keys (2020-04-26) To use dialog box keys, the message loop must contain the IsDialogMessage() function. The function identifies and processes the keys. Windows message loop: (2020-04-26) ; Windows message loop Local $tMsg = DllStructCreate( $tagMSG ) While WinMsgLoop_GetMessage( $tMsg ) ; Retrieve a message from the message queue ConsoleWrite( "0x" & Hex( DllStructGetData( $tMsg, "message" ), 4 ) & @CRLF ) If Not WinMsgLoop_TranslateAccelerator( $hWnd, $hAccel, $tMsg ) And _ ; Processes accelerator keystrokes Not WinMsgLoop_IsDialogMessage( $hWnd, $tMsg ) Then ; Processes dialog box messages WinMsgLoop_TranslateMessage( $tMsg ) ; Translate a virtual-key message into a character message WinMsgLoop_DispatchMessage( $tMsg ) ; Send a message to the window procedure EndIf If $bExit Then ExitLoop WEnd WM_COMMAND message handler: (2020-04-26) Case $WM_COMMAND ConsoleWrite( @CRLF & "$WM_COMMAND" & @CRLF ) Switch BitShift( $wParam, 16 ) ; HiWord Case 1 ; Accelerator key ConsoleWrite( "Accelerator key" & @CRLF ) Switch BitAND( $wParam, 0xFFFF ) ; LoWord Case $VK_ESCAPE ConsoleWrite( "$VK_ESCAPE" & @CRLF ) _WinAPI_DestroyWindow( $hWnd ) Return 0 ; Don't call DefWindowProc() Case $VK_END ConsoleWrite( "$VK_END" & @CRLF ) _WinAPI_DestroyWindow( $hWnd ) Return 0 EndSwitch EndSwitch Program termination code: (2020-04-26) Case $WM_CLOSE ConsoleWrite( @CRLF & "$WM_CLOSE" & @CRLF ) If MsgBox( $MB_OKCANCEL, "Really close?", "My application", 0, $hWnd ) = $IDOK Then _WinAPI_DestroyWindow( $hWnd ) Else ConsoleWrite( @CRLF ) EndIf Return 0 ; Don't call DefWindowProc() Case $WM_DESTROY ConsoleWrite( @CRLF & "$WM_DESTROY" & @CRLF ) $bExit = True Return 0 2) Windows message loop 2.au3 (2020-04-26) Optimized version of the message loop because DllCall() is used directly instead of more time-consuming functions in WinMsgLoop.au3 UDF: ; Windows message loop Local $tMsg = DllStructCreate( $tagMSG ) While DllCall( "User32.dll", "bool", "GetMessageW", "struct*", $tMsg, "hwnd", 0, "uint", 0, "uint", 0 )[0] ; Retrieve a message from the message queue ConsoleWrite( "0x" & Hex( DllStructGetData( $tMsg, "message" ), 4 ) & @CRLF ) If Not DllCall( "User32.dll", "int", "TranslateAcceleratorW", "hwnd", $hWnd, "handle", $hAccel, "struct*", $tMsg )[0] And _ ; Processes accelerator keystrokes Not DllCall( "User32.dll", "bool", "IsDialogMessageW", "hwnd", $hWnd, "struct*", $tMsg )[0] Then ; Processes dialog box messages DllCall( "User32.dll", "bool", "TranslateMessage", "struct*", $tMsg ) ; Translate a virtual-key message into a character message DllCall( "User32.dll", "lresult", "DispatchMessageW", "struct*", $tMsg ) ; Send a message to the window procedure EndIf If $bExit Then ExitLoop WEnd 3) Navigating with Tab key.au3 (2020-04-26) When IsDialogMessage() is added to the code in the message loop, dialog box keys work immediately. Eg. Tab and Shift+Tab. Demonstrated in the example with three buttons. 4) Adding virtual ListView.au3 A virtual listview with cell background colors is created in the window. As it's a virtual list view, a WM_NOTIFY message handler is needed to handle LVN_GETDISPINFO notifications. Background colors are drawn through NM_CUSTOMDRAW notifications. A virtual and custom drawn listview is very message intensive and therefore interesting to test. ; Create ListView $hListView = _GUICtrlListView_Create( $hWnd, "", 10, 10, 800, 538, $LVS_DEFAULT+$LVS_OWNERDATA-$LVS_SINGLESEL, $WS_EX_CLIENTEDGE ) _GUICtrlListView_SetExtendedListViewStyle( $hListView, $LVS_EX_DOUBLEBUFFER+$LVS_EX_FULLROWSELECT ) ; Add columns For $i = 0 To $iCols - 1 _GUICtrlListView_AddColumn( $hListView, "Col " & $i, 96, 2 ) ; 2 = Centered text Next ; ListView items For $i = 0 To $iRows - 1 For $j = 0 To $iCols - 1 $aItems[$i][$j] = $i & "/" & $j Next Next ; ListView colors Local $aLVColors = [ 0xCCCCFF, 0xCCFFFF, 0xCCFFCC, 0xFFFFCC, 0xFFCCCC, 0xFFCCFF ] ; BGR For $i = 0 To $iRows - 1 For $j = 0 To $iCols - 1 $aColors[$i][$j] = $aLVColors[Random( 0,5,1 )] Next Next ; Set number of rows in virtual ListView DllCall( "user32.dll", "lresult", "SendMessageW", "hwnd", $hListView, "uint", $LVM_SETITEMCOUNT, "wparam", $iRows, "lparam", 0 ) Case $WM_NOTIFY Switch DllStructGetData( DllStructCreate( $tagNMHDR, $lParam ), "Code" ) Case $LVN_GETDISPINFOW ; Fill virtual listview Local Static $tText = DllStructCreate( "wchar[100]" ), $pText = DllStructGetPtr( $tText ) Local $tNMLVDISPINFO = DllStructCreate( $tagNMLVDISPINFO, $lParam ) If Not BitAND( DllStructGetData( $tNMLVDISPINFO, "Mask" ), $LVIF_TEXT ) Then Return Local $sItem = $aItems[DllStructGetData($tNMLVDISPINFO,"Item")][DllStructGetData($tNMLVDISPINFO,"SubItem")] DllStructSetData( $tText, 1, $sItem ) DllStructSetData( $tNMLVDISPINFO, "TextMax", StringLen( $sItem ) ) DllStructSetData( $tNMLVDISPINFO, "Text", $pText ) Return 0 ; Don't call DefWindowProc() Case $NM_CUSTOMDRAW ; Draw back colors Local $tNMLVCUSTOMDRAW = DllStructCreate( $tagNMLVCUSTOMDRAW, $lParam ) Local $dwDrawStage = DllStructGetData( $tNMLVCUSTOMDRAW, "dwDrawStage" ), $iItem Switch $dwDrawStage ; Holds a value that specifies the drawing stage Case $CDDS_PREPAINT ; Before the paint cycle begins Return $CDRF_NOTIFYITEMDRAW ; Notify the parent window of any item-related drawing operations Case $CDDS_ITEMPREPAINT ; Before painting an item Return $CDRF_NOTIFYSUBITEMDRAW ; Notify the parent window of any subitem-related drawing operations Case $CDDS_ITEMPREPAINT + $CDDS_SUBITEM ; Before painting a subitem $iItem = DllStructGetData( $tNMLVCUSTOMDRAW, "dwItemSpec" ) DllStructSetData( $tNMLVCUSTOMDRAW, "ClrTextBk", $aColors[$iItem][DllStructGetData($tNMLVCUSTOMDRAW,"iSubItem")] ) Return $CDRF_NEWFONT ; $CDRF_NEWFONT must be returned after changing font or colors EndSwitch EndSwitch Usage of the code I don't think there's such a great need for code like this. At least the code shows that translating Windows API functions into AutoIt works pretty well. Implementing the code in the WinMsgLoop.au3 UDF was straightforward. There is a question about using keyboard accelerators in non-AutoIt GUIs in this post. If you use AutoIt for prototyping, you might get some ideas here. Because the examples do not contain internal AutoIt functions but only Windows API functions, they are easy to translate into C/C++ and other languages. When translating back and forth between AutoIt and other languages, the internal functions are always the problem. How to translate these functions? Recent performance issue Recently, a problem was raised in this post regarding a multiple 100% performance degradation on Windows 10 versions later than 1803 as soon as a GUI element became visible in a script. The problem persisted throughout the rest of the code, even though the GUI element was deleted. I've tested the issue under Windows 10 1809 with all the examples here. All of the examples suffer from the problem. How much of the code needs to be translated into C/C++ before the problem disappears? Only the line which contains the _WinAPI_CreateWindowEx() function that creates and displays the window? Or does the problem still exist when all code is translated? That could be interesting. I've already done examples of translating AutoIt code into C/C++ eg. in this example and this example so it's not that hard. 7z-file The 7z-file contains source code for the UDFs and examples. You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. WinMsgLoop.7z
    1 point
  9. Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team
    1 point
  10. Welcome to the forum In your first try you never called the function that have been written and you didn't set a hotkey on that function... so you can't call it! you need a loop to don't exit after set the hotkeys. also you just copied the mouseclicks out of the helpfile... Mouseclick ( 271, 163 [, speed = 10] ) The parameter which are inside [] are optional! that means you don't need to write them if you won't change them so it should be Mouseclick ( 271, 163 ) or Mouseclick ( 271, 163 , 10 ) also for the send() For using _ispressed() you will need to add #include <misc.au3> on the top of your script as you can see in the helpfile your ShowMe() func contains a loop so you won't be able to do something after you pressed F9 ( like your pause ) by the way try the helpfile examples next time first Good luck
    1 point
  11. You rang??? What you share some exact information what it is you need to automate and show us what you have that isn't working? Jos
    1 point
  12. ...so, you can code this. Welcome to the forum GG
    1 point
  13. Verssuss, Here you go: #include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <Array.au3> ; Just for the demonstration HotKeySet("{F2}", "_xxx") Global $asdf[3] ; Set a ridiculously low size - normally I would use at least 100 $q = 0 $GUI = GUICreate("gui", 670, 500) $ListView = GUICtrlCreateListView("Name|No Name|Surrname|Next Name|U cant do it name", 10, 200, 450, 250,$LVS_SHOWSELALWAYS) $LV = GUICtrlGetHandle($ListView) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; Sleep(10) ; Not needed - there is an automatic Sleep in GUIGetMsg WEnd Func _xxx() HotKeySet("{F2}") $var2 = _GUICtrlListView_GetSelectedIndices($LV) $asdf[$q] = _GUICtrlListView_InsertItem($LV,"Name "& $q, $var2 + 1) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "IS", 1) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "THIS", 2) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "WROKING", 3) _GUICtrlListView_AddSubItem($LV, $asdf[$q], "RIGHT", 4) _GUICtrlListView_setItemSelected($LV, $asdf[$q], True) _GUICtrlListView_setItemSelected($LV, $asdf[$q] - 1, False) $q = $q + 1 ; Check if array needs resizing If $q = UBound($asdf) Then ReDim $asdf[$q * 2] ; Just to show you what is happening _ArrayDisplay($asdf, "", Default, 8) EndIf HotKeySet("{F2}", "_xxx") EndFunc M23
    1 point
  14. Nine

    idm hex to value how can?

    And out of curiosity, would you be kind enough, to test this : #include <APIRegConstants.au3> #include <Array.au3> #include <MsgBoxConstants.au3> #include <WinAPIError.au3> #include <WinAPIReg.au3> Local $hKey = _WinAPI_RegOpenKey($HKEY_CURRENT_USER, 'Software\DownloadManager\4950') If @error Then MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), @extended, _WinAPI_GetErrorMessage(@extended)) Exit EndIf Local $tData = DllStructCreate('byte string[260]') _WinAPI_RegQueryValue ($hKey, "FileSize", $tData) ConsoleWrite ($tData.string & @CRLF) _WinAPI_RegCloseKey($hKey)
    1 point
  15. Jos

    idm hex to value how can?

    Here is a working version, as the build in regread doesn't support "REG_NONE" types. 1. Download _RegFuns.au3 from this topic: 2. Edit the file and comment the line 20: ;~ Global Const $REG_QWORD = 11 Use this script: #include "_RegFunc.au3" $kvalue = _RegRead("HKEY_CURRENT_USER\Software\DownloadManager\4705","FileSize",True) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $kvalue = ' & $kvalue & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console;~ "FileSize"=hex(0):f4,c0,bb,7f,00,00,00,00 at Internet Download Manager result : 1,99 GB (2143011060 Bytes) $hSize = "" For $x = StringLen($kvalue)-1 to 2 Step -2 $hSize &= StringMid($kvalue,$x,2) Next ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Dec($hSize) = ' & Dec($hSize) & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Jos
    1 point
  16. What happens, when you use : Local $sValue = RegRead("HKCU64\Software\DownloadManager\4950", "FileSize")
    1 point
  17. Nine

    idm hex to value how can?

    You shouldn't need to use it in HKCU, but try using #RequireAdmin, cause you should get a binary string.
    1 point
  18. Jos

    idm hex to value how can?

    Something like this?: $kvalue = "hex(0):f4,c0,bb,7f,00,00,00,00" $hSize = "" $Akey = StringSplit(StringMid($kvalue, StringInStr($kvalue, ":") + 1), ",") For $x = UBound($Akey) - 1 to 1 Step -1 If ($Akey[$x] <> "00") Then $hSize &= $Akey[$x] EndIf Next ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Dec($hSize) = ' & Dec($hSize) & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Jos
    1 point
  19. jchd

    idm hex to value how can?

    Like that! Place the bytes in little endianness order (reverse order).
    1 point
  20. Jos

    idm hex to value how can?

    Yea right ...... So you post something to convert to a decimal value but they are unrelated... smart. Sure, when you a capable of posting some related information -> input with the expected output. Jos
    1 point
  21. I think the author mean external process, not his own. I think i sow somewhere an example of setting the limit for CPU usage for specific process... Edit: Yes, this one.
    1 point
  22. Create a hex string, e.g. using RegEx or string functions (remove commas) -> I'm sure you can do that yourself . Local $sHexStr $sHexStr = "f4c0bb7f00000000" ConsoleWrite(_Hex2Dec('0x' & $sHexStr) & @CRLF & @CRLF) $sHexStr = "f4c0bb7f" ConsoleWrite(_Hex2Dec('0x' & $sHexStr) & @CRLF & @CRLF) Func _Hex2Dec($iN) Local $aN, $ihex = 0 $aN = StringSplit(StringTrimLeft($iN, 2), "", 1) For $x = 1 To UBound($aN) - 1 $ihex += Dec($aN[$x]) * (16 ^ (UBound($aN) - 1 - $x)) Next Return $ihex EndFunc ;==>_Hex2Dec EDIT : Pay attention to the advice given by @jchd regarding endianness (two posts below). I neglected to mention that.
    1 point
  23. water

    make process use less cpu

    Most of the time it is a problem with a loop. Add a Sleep(10) and the CPU usage drops significantly. For further hints we need to see your code
    1 point
  24. Jos

    idm hex to value how can?

    Should that should HEX information contain the value 5460004555? Hex for 5460004555 is "0x145710ECB". Jos
    1 point
  25. According to the documentation for WS_TABSTOP, the IsDialogMessage() function must be included in the message loop to identify a keystroke as a dialog box key. Example here.
    1 point
  26. Verssuss, If you look at the Recursion tutorial in the Wiki and scroll down to the "A little added extra" section at the end you will see a good way of getting an array to expand dynamically to fit any size of data. M23
    1 point
  27. _GUICtrlListView_EnsureVisible($LV, $q) About the size of a variable I don't understand the question... Set the one you want, the limitations are mentioned here
    1 point
  28. Im gonna change that to iDispatch, but even with that change I dont know if "idispatch object" is an actual thing, its just what I started calling it in my head. IDispatch is the interface we are using to create the object. It all really started with Hooking into the IDispatch interface. Then came AutoitObject and sometime later we got the native function ObjCreateInterface. iDispatch is what your looking to read up on.
    1 point
  29. Aelc

    UPDATE Save/Load Function

    You should use an index. I mean i don't know what this list is for but you would have another value than "name"( & $i ) maybe ... or do you just wanna have constantly inputs? and then the copy works too for me Case $menu_file_save $index = _GUICtrlListView_GetItemCount($listview) $file_save = FileSaveDialog("Choose a filename.", "", "Data (*.ini)", $FD_PROMPTOVERWRITE, $FD_PATHMUSTEXIST) For $i = 0 To _GUICtrlListView_GetItemCount($listview) -1 step 1 IniWrite($file_save, "procedura", $i, _GUICtrlListView_GetItemText($ListView, $i, 0) & "|" & _ _GUICtrlListView_GetItemText($ListView, $i, 1) & "|" & _ _GUICtrlListView_GetItemText($ListView, $i, 2) & "|" & _ _GUICtrlListView_GetItemText($ListView, $i, 3) & "|" & _ _GUICtrlListView_GetItemText($ListView, $i, 4)) Next IniWrite($file_save, "procedura", "index",$index ) Case $menu_file_load $file_load = FileOpenDialog("Choose a filename.", "", "Data (*.ini)", $FD_PATHMUSTEXIST) $List = IniRead ( $file_load,"procedura","index","" ) For $i = 0 To $List - 1 GUICtrlCreateListViewItem(IniRead ( $file_load,"procedura",$i,""),$ListView) Next
    1 point
  30. I put in a PR with the author on github its been merged and should fix the above issue amognst others..
    1 point
  31. Beege

    Tray Icon Bar Graph UDF

    Here is the latest UDF that I have been working on. Its sort of a spin off from my other Graph UDF. Its for creating a scrolling bar graph as the tray icon. Its very similar to how the program ProcessExploror by sysinternals displays cpu history. Please let me know what you think, especially if you have any kind of problems. Thanks for looking. Example #include "TIG.au3" Opt('GuiOnEventMode', 1); Black Green Pink Yellow Blue Red Purple Orange Gray Local $Color, $Invert, $aColors[9] = [0xFF000000, 0xFF00FF00, 0xFFF004DE, 0xFFFFFF00, 0xFF00ACFF, 0xFFFF0000, 0xFF8000FF, 0xFFFF8000, 0xFFADADAD] Local $GUI = GUICreate('TrayIcon', 200, 50) GUISetOnEvent(-3, '_Exit', $GUI) GUISetState() _TIG_CreateTrayGraph(0, 1000) While 1 $Color = $aColors[Random(0,8,1)] $Invert = _Invert($Color) _TIG_SetBackGoundColor($Color) _TIG_SetBarColor($Invert) For $i = 0 To 16 _TIG_UpdateTrayGraph(Random(0, 1000, 1)) Sleep(100) Next WEnd Func _Exit() Exit EndFunc ;==>_Exit ;Returns Invert of ARGB value Func _Invert($iValue) Return '0x' & Hex(BitOR(0xFF000000,(0xFFFFFFFF-$iValue)),8) EndFunc UDF #Region Header ; #INDEX# ======================================================================================================================= ; Title .........: TIG ; AutoIt Version : 3.3.4.0 ; Language ......: English ; Description ...: Functions to create and update a tray icon scrolling bar graph ; Author(s) .....: Beege ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_TIG_CreateTrayGraph ;_TIG_SetBarColor ;_TIG_SetBackGoundColor ;_TIG_SetRange ;_TIG_UpdateTrayGraph ; =============================================================================================================================== #cs CallTips: _TIG_CreateTrayGraph($iMin = 0, $iMax = 100, $iBarColor = 0xFF00ACFF, $iBackColor = 0xFF000000) Default $iBarColor = Blue; $iBackColor = Black _TIG_SetBarColor($iBarColor = 0xFF00ACFF) Default $iBarColor = Blue _TIG_SetBackGoundColor($iBackColor = 0xFF000000) Default $iBackColor = Black _TIG_SetRange($iMin = 0, $iMax = 100) _TIG_UpdateTrayGraph($iValue) #ce #include <GDIPlus.au3> #include <WindowsConstants.au3> #EndRegion Header #Region Initialization AutoItWinSetTitle(AutoItWinGetTitle() & '_TraYIcoNUdF') #EndRegion Initialization #Region Global Variables and Constants Global Enum $g_hGUI, $g_hGraphics, $g_hBitmap, $g_hBuffer, $g_hPen, $g_iMin, $g_iMax, $g_iBackColor, $g_iBarColor, $g_hIcon, $g_sValues, $g_hShell32, $iMax Global $aTI[$iMax] $aTI[$g_hGUI] = WinGetHandle(AutoItWinGetTitle()) #cs $aTI[$g_hGUI] = Autoit Window Handle $aTI[$g_hGraphics] = Handle to Graphics object $aTI[$g_hBitmap] = Handle to Bitmap Object $aTI[$g_hBuffer] = Handle to Buffer $aTI[$g_hPen] = Handle to Pen Object $aTI[$g_iMin] = Minimum Y Range $aTI[$g_iMax] = Maximum Y Range $aTI[$g_iBackColor] = Background Color $aTI[$g_iBarColor] = Bar Color $aTI[$g_hIcon] = Handle to Icon Bitmap $aTI[$g_sValues] = String Containing Y Value History $aTI[$g_hShell32] = Handle to Shell32 dll #ce #EndRegion Global Variables and Constants #Region Public Functions ; #FUNCTION# ==================================================================================================================== ; Name...........: _TIG_CreateTrayGraph ; Description ...: Creates Tray Icon Bar Graph ; Syntax.........: _TIG_CreateTrayGraph($iMin = 0, $iMax = 100, $iBarColor = 0xFF00ACFF, $iBackColor = 0xFF000000) ; Parameters ....: $iMin - Minimum Y Value. Must Not be less than 0. ; $iMax - Maximum Y Value ; $iBarColor - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB). Default = Blue ; $iBackColor - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB). Default = Black ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Minimum Value Less than zero ; - <> 0 - Value returned from _WinAPI_GetLastERROR() ; Author ........: Beege ; Remarks .......: ; =============================================================================================================================== Func _TIG_CreateTrayGraph($iMin = 0, $iMax = 100, $iBarColor = 0xFF00ACFF, $iBackColor = 0xFF000000) If $iMin < 0 Then Return SetError(1, @extended, 0) _GDIPlus_Startup() OnAutoItExitRegister('_GdiExit') If $iBarColor = -1 Or $iBarColor = Default Then $iBarColor = 0xFF00ACFF If $iBackColor = -1 Or $iBackColor = Default Then $iBackColor = 0xFF000000 If $iMin = -1 Or $iMin = Default Then $iMin = 0 If $iMax = -1 Or $iMax = Default Then $iMax = 100 $aTI[$g_hGraphics] = _GDIPlus_GraphicsCreateFromHWND($aTI[$g_hGUI]) $aTI[$g_hBitmap] = _GDIPlus_BitmapCreateFromGraphics(16, 16, $aTI[$g_hGraphics]) $aTI[$g_hBuffer] = _GDIPlus_ImageGetGraphicsContext($aTI[$g_hBitmap]) $aTI[$g_hPen] = _GDIPlus_PenCreate($iBarColor, 1) $aTI[$g_hIcon] = -1 $aTI[$g_sValues] = 0 $aTI[$g_iBackColor] = $iBackColor $aTI[$g_iMin] = $iMin $aTI[$g_iMax] = $iMax $aTI[$g_hShell32] = DllOpen('shell32.dll') _GDIPlus_GraphicsClear($aTI[$g_hBuffer], $iBackColor) _GDIPlus_GraphicsDrawImageRect($aTI[$g_hGraphics], $aTI[$g_hBitmap], 0, 0, 16, 16) _CreateTrayIcon() If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc ;==>_TIG_CreateTrayGraph ; #FUNCTION# ==================================================================================================================== ; Name...........: _TIG_SetBarColor ; Description ...: Sets Bar Color for tray icon ; Syntax.........: _TIG_SetBarColor($iBarColor = 0xFF00ACFF) ; Parameters ....: $iBarColor - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB). Default = Blue ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 ; Author ........: Beege ; Remarks .......: None ; =============================================================================================================================== Func _TIG_SetBarColor($iBarColor = 0xFF00ACFF) If $iBarColor = -1 Or $iBarColor = Default Then $iBarColor = 0xFF00ACFF _GDIPlus_PenSetColor($aTI[$g_hPen], $iBarColor) If @error Then Return SetError(1, @extended, 0) Return 1 EndFunc ;==>_TIG_SetBarColor ; #FUNCTION# ==================================================================================================================== ; Name...........: _TIG_SetBackGoundColor ; Description ...: Sets BackGround Color for tray icon ; Syntax.........: _TIG_SetBackGoundColor($iBackColor = 0xFF000000) ; Parameters ....: $iBarColor - Alpha, Red, Green and Blue Hex Value. (0xAARRGGBB). Default = Black ; Return values .: Success - 1 ; Author ........: Beege ; Remarks .......: None ; =============================================================================================================================== Func _TIG_SetBackGoundColor($iBackColor = 0xFF000000) If $iBackColor = -1 Or $iBackColor = Default Then $iBackColor = 0xFF000000 $aTI[$g_iBackColor] = $iBackColor Return 1 EndFunc ;==>_TIG_SetBackGoundColor ; #FUNCTION# ==================================================================================================================== ; Name...........: _TIG_UpdateTray ; Description ...: Update Tray Bar Graph with new Value ; Syntax.........: _TIG_UpdateTray($iValue) ; Parameters ....: $iValue - Value to update graph with ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - Value returned from _WinAPI_GetLastERROR() ; Author ........: Beege ; Remarks .......: None ; =============================================================================================================================== Func _TIG_UpdateTrayGraph($iValue) $aTI[$g_sValues] = $iValue & '|' & $aTI[$g_sValues] Local $iX = 15, $split = StringSplit($aTI[$g_sValues], '|') _GDIPlus_GraphicsClear($aTI[$g_hBuffer], $aTI[$g_iBackColor]) For $y = 1 To $split[0] _GDIPlus_GraphicsDrawLine($aTI[$g_hBuffer], $iX, (16 - _CalcValue($split[$y])), $iX, 16, $aTI[$g_hPen]) $iX -= 1 Next _GDIPlus_GraphicsDrawImageRect($aTI[$g_hGraphics], $aTI[$g_hBitmap], 0, 0, 16, 16) If $split[0] = 16 Then $aTI[$g_sValues] = StringLeft($aTI[$g_sValues], StringInStr($aTI[$g_sValues], '|', 0, -1) - 1) _CreateTrayIcon() If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc ;==>_TIG_UpdateTrayGraph ; #FUNCTION# ==================================================================================================================== ; Name...........: _TIG_SetRange ; Description ...: Sets Minimum and Maximum Y values of the Graph ; Syntax.........: _TIG_SetRange($iMin = 0, $iMax = 100) ; Parameters ....: $iMin - Minimum Y Value. Must be Greater than 0. ; $iMax - Maximum Y Value ; Return values .: Success - 1 ; Failure - 0 and sets @ERROR: ; - 1 Minimum Value Less than zero ; Author ........: Beege ; Remarks .......: None ; =============================================================================================================================== Func _TIG_SetRange($iMin = 0, $iMax = 100) If $iMin < 0 Then Return SetError(1, @extended, 0) If $iMin = -1 Or $iMin = Default Then $iMin = 0 If $iMax = -1 Or $iMax = Default Then $iMax = 100 $aTI[$g_iMin] = $iMin $aTI[$g_iMax] = $iMax Return 1 EndFunc ;==>_TIG_SetRange #EndRegion Public Functions #Region Internel Functions ; #FUNCTION# ==================================================================================================================== ; Name...........: _TraySetIcon ; Author ........: Yashied ; Modified ......: Beege ; =============================================================================================================================== Func _TraySetIcon() Static $tNOTIFYICONDATA = DllStructCreate('dword Size;hwnd hWnd;uint ID;uint Flags;uint CallbackMessage;ptr hIcon;') Static $p_tNOTIFYICONDATA = DllStructGetPtr($tNOTIFYICONDATA) DllStructSetData($tNOTIFYICONDATA, 'Size', DllStructGetSize($tNOTIFYICONDATA)) DllStructSetData($tNOTIFYICONDATA, 'hWnd', $aTI[$g_hGUI]) DllStructSetData($tNOTIFYICONDATA, 'ID', 1) DllStructSetData($tNOTIFYICONDATA, 'Flags', 2) ; NIF_ICON DllStructSetData($tNOTIFYICONDATA, 'hIcon', $aTI[$g_hIcon]) Local $Ret = DllCall($aTI[$g_hShell32], 'int', 'Shell_NotifyIcon', 'dword', 1, 'ptr', $p_tNOTIFYICONDATA) If @error Or $Ret[0] = 0 Then Return SetError(_WinAPI_GetLastError(), 0, 0) Return 1 EndFunc ;==>_TraySetIcon Func _CreateTrayIcon() Local $hclone = _GDIPlus_BitmapCloneArea($aTI[$g_hBitmap], 0, 0, 16, 16) Local $hIcon = DllCall($__g_hGDIPDll, 'int', 'GdipCreateHICONFromBitmap', 'ptr', $hclone, 'int*', 0) If $aTI[$g_hIcon] <> -1 Then _WinAPI_DestroyIcon($aTI[$g_hIcon]) $aTI[$g_hIcon] = $hIcon[2] _GDIPlus_BitmapDispose($hclone) _TraySetIcon() If @error Then Return SetError(@error, @extended, 0) EndFunc ;==>_CreateTrayIcon Func _CalcValue($iValue) If $iValue >= $aTI[$g_iMax] Then Return 16 If $iValue <= $aTI[$g_iMin] Then Return 0 Local $fPercent = $iValue / $aTI[$g_iMax] Switch Int($fPercent * 100) Case 8 To 98 Return Int($fPercent * 16) Case 98 To 100 Return 16 Case 1 To 7 Return 1 EndSwitch EndFunc ;==>_CalcValue Func _GdiExit() If $aTI[$g_hIcon] <> -1 Then _WinAPI_DestroyIcon($aTI[$g_hIcon]) _GDIPlus_GraphicsDispose($aTI[$g_hGraphics]) _GDIPlus_GraphicsDispose($aTI[$g_hBuffer]) _GDIPlus_BitmapDispose($aTI[$g_hBitmap]) _GDIPlus_PenDispose($aTI[$g_hPen]) DllClose($aTI[$g_hShell32]) _GDIPlus_Shutdown() EndFunc ;==>_GdiExit #EndRegion Internel Functions TIG.au3
    1 point
  32. water

    ExcelChart

    Version 0.4.0.1

    1,467 downloads

    Extensive library to control and manipulate Microsoft Excel charts. Written by GreenCan and water. Theads: General Help & Support - Example Scripts BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort KNOWN BUGS (last changed: 2017-07-21) None. The COM error handling related bugs have been fixed.
    1 point
  33. Here's an example with some code I whipped up for another member last night. Note that I had to shorten the AutoIt code DRAMATICALLY in the obfuscated version, since the forum wouldn't let me post that much.. I kept getting the error Un-obfuscated: 25 lines @ 802 bytes Obfuscated: 863 lines @ 65,704 bytes Not Obfuscated Obfuscated Simply put : AutoIt is NOT secure. Ever. There is no *magical program* or obfuscator that will make your code 100% safe. Yes the obfuscator helps, but by no means is it safe from hackers. Themida won't do any good for a determined individual. I've got a friend that has a bachelor's degree in computer programming and he helps me with suggestions when I make AutoIt programs. So far, he has been able to retrieve source for all but one of my compiled executables, most of which I obfuscate and then pack with Themida. Long story short - if you want security, go learn C++ and use some professional tool such as Themida or PC Guard.
    1 point
×
×
  • Create New...