Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/06/2017 in Posts

  1. Hahhaa reminds me of a friend of mine who had lots of viruses on the pc, but because the anti-virus was always complaining, and he couldn't find what was re-installing the viruses, he uninstalled the antivirus. XD
    1 point
  2. In the UIAutomation object it's possible to replace a method eg. RectToVariant with your own method eg. RectToVariantEx and still be able to execute the original RectToVariant method. The original RectToVariant method can be executed with DllCallAddress, where the address is the original RectToVariant function pointer in the VTable. The interesting part of the code looks like this: Example1() Func Example1() ; Create UIAutomation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $stag_IUIAutomation ) ; Replace RectToVariant with RectToVariantEx ; And get original RectToVariant function pointer Local $pRectToVariantEx = DllCallbackGetPtr( DllCallbackRegister( "RectToVariantEx", "long", "ptr;ptr;ptr*" ) ) $pRectToVariant = ReplaceVTableFuncPtr( Ptr( $oUIAutomation() ), ( 3 + 42 - 1 ) * ( @AutoItX64 ? 8 : 4 ), $pRectToVariantEx ) ; Create rectangle structure Local $tRect = DllStructCreate( $tagRECT ) DllStructSetData( $tRect, "Left", 100 ) DllStructSetData( $tRect, "Top", 200 ) DllStructSetData( $tRect, "Right", 3000 ) DllStructSetData( $tRect, "Bottom", 4000 ) ; Output array Local $aArray ; Execute RectToVariantEx method $oUIAutomation.RectToVariantEx( $tRect, $aArray ) ; Display array _ArrayDisplay( $aArray ) EndFunc Func RectToVariantEx( $pSelf, $pRect, $pVariant ) ; Here it is possible to debug and modify parameters after conver- ; sions on function entry but before the original method is executed. ; Execute original RectToVariant method Local $aRet = DllCallAddress( "long", $pRectToVariant, "ptr", $pSelf, @AutoItX64 ? "struct*" : "struct", DllStructCreate( $tagRECT, $pRect ), "ptr", $pVariant ) ; Note that no COM conversions are applied neither to DllCall nor DllCallAddress functions ; Here it is possible to debug and modify parameters after the origi- ; nal method is executed but before conversions on function exit. Return $aRet[0] EndFunc Example1.au3 in the zip below. As described at the end of the code, this makes it possible to debug and modify parameters immediately before and after the original method is executed. In Example2.au3 debug code is added after the original method is executed: Func RectToVariantEx( $pSelf, $pRect, $pArray ) ; Here it's possible to debug and modify parameters after conver- ; sions on function entry but before the original method is executed. ; Execute original RectToVariant method Local $aRet = DllCallAddress( "long", $pRectToVariant, "ptr", $pSelf, @AutoItX64 ? "struct*" : "struct", DllStructCreate( $tagRECT, $pRect ), "ptr", $pArray ) ; Note that no COM conversions are applied neither to DllCall nor DllCallAddress functions ; Here it's possible to debug and modify parameters after the origi- ; nal method is executed but before conversions on function exit. ; $pArray info ConsoleWrite( "Variant $pArray:" & @CRLF ) ConsoleWrite( "----------------" & @CRLF ) Local $tVariant = DllStructCreate( $tagVARIANT, $pArray ) Local $vt = DllStructGetData( $tVariant, "vt" ) ConsoleWrite( "vt = 0x" & Hex( $vt, 4 ) & " = $VT_ARRAY + $VT_R8" & @CRLF ) Local $data = DllStructGetData( $tVariant, "data" ) ConsoleWrite( "data = " & $data & " (Pointer to safearray)" & @CRLF ) ConsoleWrite( @CRLF ) ; $pSafeArray info Local $pSafeArray = $data ConsoleWrite( "Safearray $pSafeArray:" & @CRLF ) ConsoleWrite( "----------------------" & @CRLF ) InspectSafeArray( $pSafeArray ) ConsoleWrite( @CRLF ) ; Safearray data Local $iUBound, $pSafeArrayData SafeArrayGetUBound( $pSafeArray, 1, $iUBound ) SafeArrayAccessData( $pSafeArray, $pSafeArrayData ) Local $tDouble = DllStructCreate( "double" ) Local $iDoubleSize = DllStructGetSize( $tDouble ) ConsoleWrite( "Safearray data:" & @CRLF ) ConsoleWrite( "---------------" & @CRLF ) For $i = 0 To $iUBound $tDouble = DllStructCreate( "double", $pSafeArrayData ) ConsoleWrite( DllStructGetData( $tDouble, 1 ) & @CRLF ) $pSafeArrayData += $iDoubleSize Next SafeArrayUnaccessData( $pSafeArray ) Return $aRet[0] EndFunc This is exactly the same debugging as I did with C++ code in first post when I was playing with RectToVariant method. I believe it's possible to get VariantToRect to work in this way. I've done a few tests that have failed. I've probably not been sufficiently careful. Examples\Subclassing\1) RectToVariant\
    1 point
  3. I took the liberty to change the script a bit more, for myself, only now i added filecopy so that once the executable changes name, (into a path) the original is copied so i can keep creating "new" shortcuts, instead of "losing" the exe. ;#RequireAdmin #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=FolderProgram.ico #AutoIt3Wrapper_Res_Icon_Add=FolderProgram.ico #AutoIt3Wrapper_Outfile=FolderProgram.exe #AutoIt3Wrapper_Run_Tidy=y #Tidy_Parameters=/tc 3 /reel #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <String.au3> #include <File.au3> FileInstall('FolderProgram.au3', @TempDir & '\FolderProgram.au3', 1) FileInstall('FolderProgram.ico', @TempDir & '\FolderProgram.ico', 1) FileCopy(@ScriptDir & '\FolderProgram.exe', @TempDir & '\FolderProgram.exe', 9) TraySetIcon(@TempDir & '\FolderProgram.ico') GUISetIcon(@TempDir & '\FolderProgram.ico') Local $RootDir = StringSplit(@ScriptDir, '\', 1) Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "", $NewFileName If StringInStr(@ScriptName, "+") Then $ShortCut = StringReplace(@ScriptName, "+", "\") If FileExists($RootDir[1] & $ShortCut) Then Run($RootDir[1] & $ShortCut) Sleep(1000) _PathSplit($ShortCut, $sDrive, $sDir, $sFileName, $sExtension) If Not ProcessExists($sFileName & $sExtension) Then ShellExecute($ShortCut, "", "", "runas") EndIf Else $aFile = StringSplit(@ScriptName, ".") If StringLower($aFile[1]) <> "FolderProgram" Then MsgBox(16, "Error", "Unable to locate: " & $RootDir[1] & $ShortCut) EndIf New_File_Select() EndIf Else New_File_Select() EndIf Exit Func New_File_Select() $sRet = FileOpenDialog('Select a program', @ScriptDir, 'Executables (*.exe;*.com;*.bat;*.cmd)', 1) If @error = 0 Then $NewFileName = StringReplace($sRet, "\", "+") $NewFileName = _StringTitleCase($NewFileName) $NewFileName = StringReplace($NewFileName, ".Exe", ".exe", -1, 1) $NewFileName = StringTrimLeft($NewFileName, 2) FileMove(@AutoItExe, @ScriptDir & "\" & $NewFileName, 8) FileCopy(@TempDir & '\FolderProgram.exe', @ScriptDir & '\FolderProgram.exe', 9) Else MsgBox(16, "Error", "No program was selected.") EndIf EndFunc ;==>New_File_Select EDIT: Now also works inside folders, replaced ".\" by the first split of StringSplit(@ScriptDir, '\', 1)
    1 point
  4. Glad the problem could be solved
    1 point
  5. As you didn't specify properties to be returned by the function default properties (Subject,Body,CreationTime,LastModificationTime,Size) are being used. There are members in your folder where property "Subject" isn't set (denoted by @extended = 1, the property index). Either specify the properties you are interested in or I need to provide a modified function to ignore such errors.
    1 point
  6. qwert, How about this? #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> HotKeySet("{ESC}", "On_Exit") ; Set distance from edge of window where resizing is possible Global Const $iMargin = 4 ; Create GUI $hGUI = GUICreate("Y", 100, 100, -1, -1, $WS_POPUP) GUISetBkColor(0xFF0000) GUISetState() ; Register message handlers GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") ; For resize GUIRegisterMsg($WM_MOUSEMOVE, "_SetCursor") ; For cursor type change While 1 Sleep(10) WEnd ; Check cursor type and resize/drag window as required Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) Local $iCursorType = _GetBorder() If $iCursorType > 0 Then ; Cursor is set to resizing style $iResizeType = 0xF000 + $iCursorType _SendMessage($hGUI, $WM_SYSCOMMAND, $iResizeType, 0) EndIf EndFunc ;==>_WM_LBUTTONDOWN ; Set cursor to correct resizing form if mouse is over a border Func _SetCursor() Local $iCursorID If _GetBorder() = 2 Then $iCursorID = 13 EndIf GUISetCursor($iCursorID, 1) EndFunc ;==>_SetCursor ; Determines if mouse cursor over a border Func _GetBorder() Local $aCurInfo = GUIGetCursorInfo() Local $aWinPos = WinGetPos($hGUI) Local $iSide = 0 If $aCurInfo[0] < $iMargin Then $iSide = 1 If $aCurInfo[0] > $aWinPos[2] - $iMargin Then $iSide = 2 Return $iSide EndFunc ;==>_GetBorder Func On_Exit() Exit EndFunc ;==>On_Exit Or you might like to look at my GUIExtender UDF, the link is on my sig. M23
    1 point
  7. For reference: Conclusion: When you want to use MS ACCESS *.accdb files you should have instaled ODBC driver "AccessDatabaseEngine.exe"
    1 point
  8. Nikolas92, Use the $LVS_SMALLICON style when creating the ListView. M23
    1 point
  9. Didn't realize adwcleaner was a program that ran as admin. If you're interacting with any window that has admin privileges your script has to run as admin as well. #RequireAdmin AutoItSetOption("WinTitleMatchMode", -2) WinMove("adwcleaner", "", 0, 0)
    1 point
×
×
  • Create New...