Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/29/2022 in all areas

  1. Hiho Team, attached a small example for a self-centering FileOpenDialog() using a self-terminating timer call. In the past I used _Timer_SetTimer() with a callback function, which works on x86, but does not under x64. So here's an example working for x64 too, using a global variable and WM_TIMER calls. What I just realized is that the doc for _WinAPI_SetTimer(), but also the MSDN doc for SetTimer, seem to be false. Success: The timer identifier. An application can pass this value to the _WinAPI_KillTimer() function to destroy the timer. _WinAPI_KillTimer() does not work when used with a hWnd and no callback func, _WinAPI_SetTimer() needs to be fed a dedicated TimerID (see "9876" used below). When I use the TimerID returned by _WinAPI_SetTimer() then _WinAPI_KillTimer() does not work. Hopefully useful for someone 😉. Edit: Replace fixed TimerID value 9876 with a TimerInit() call, I like the idea of a unique ID more. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> Global $a_Global_FileOpenDialog_Wrapper[3] ; 0 = Title, 1 = hWnd, 2 = TimerID Local $s_Selected_File = _FileOpenDialog_Wrapper("Select File", @ScriptDir, "All (*.*)", 1 + 2 + 4) If Not @error Then MsgBox(0, "", $s_Selected_File) Func _FileOpenDialog_Wrapper($sTitle, $sInitDir, $sFilter, $iOptions = 0, $sDefaultName = "", $hWnd = 0) ; https://groups.google.com/forum/?hl=en&fromgroups=#!topic/microsoft.public.vc.mfc/HafQr4gIRY0 ; The problem is that GetOpenFileName changes the current directory to the last browsed one. The current directory and any of its parents cannot be deleted. If Not $sInitDir Then $sInitDir = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" ; CLSID for "My Computer" Local $sWorkingDir = @WorkingDir $a_Global_FileOpenDialog_Wrapper[0] = $sTitle Local $old_GUISwitch = GUISwitch(0) $a_Global_FileOpenDialog_Wrapper[1] = GUICreate("_FileOpenDialog_Wrapper") GUISwitch($old_GUISwitch) GUIRegisterMsg($WM_TIMER, "WM_TIMER") $a_Global_FileOpenDialog_Wrapper[2] = _WinAPI_SetTimer($a_Global_FileOpenDialog_Wrapper[1], TimerInit(), 10, 0) Local $sFilename = FileOpenDialog($sTitle, $sInitDir, $sFilter, $iOptions, $sDefaultName, $hWnd) Local $iError = @error ConsoleWrite("_WinAPI_KillTimer-2= " & _WinAPI_KillTimer($a_Global_FileOpenDialog_Wrapper[1], $a_Global_FileOpenDialog_Wrapper[2]) & @CRLF) GUIRegisterMsg($WM_TIMER, "") GUIDelete($a_Global_FileOpenDialog_Wrapper[1]) FileChangeDir($sWorkingDir) If Not $iError Then If StringInStr($sFilename, "|", 2) Then ; multiple selection Local $aFilename = StringSplit($sFilename, "|") Else Local $sPath = StringTrimRight($sFilename, StringLen($sFilename) - StringInStr($sFilename, "\", 2, -1)) EndIf EndIf Return SetError($iError, 0, $sFilename) EndFunc ;==>_FileOpenDialog_Wrapper Func WM_TIMER($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam, $ilParam ConsoleWrite("WM_TIMER " & @TAB & TimerInit() & @TAB & $hWnd & @TAB & $iMsg & @TAB & $iwParam & @TAB & $ilParam & @CRLF) Local $hWnd_Timer_Move_FileOpenDialog = WinGetHandle("[TITLE:" & $a_Global_FileOpenDialog_Wrapper[0] & ";CLASS:#32770]", "") If IsHWnd($hWnd_Timer_Move_FileOpenDialog) Then ConsoleWrite("WinMove= " & WinMove($hWnd_Timer_Move_FileOpenDialog, "", (@DesktopWidth - (@DesktopWidth / 4 * 3)) / 2, (@DesktopHeight - (@DesktopHeight / 4 * 3)) / 2, @DesktopWidth / 4 * 3, @DesktopHeight / 4 * 3) & @CRLF) ConsoleWrite("_WinAPI_KillTimer-1= " & _WinAPI_KillTimer($a_Global_FileOpenDialog_Wrapper[1], $a_Global_FileOpenDialog_Wrapper[2]) & @CRLF) ConsoleWrite(_WinAPI_GetLastErrorMessage() & @CRLF) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_TIMER Different approach, same result as with
    2 points
  2. Hi TimRude . Just replace this line... ControlDisable($hWnd, '', 'Edit1') ; <-- WOULD PREFER READONLY INSTEAD OF DISABLED ...with that line _SendMessage(ControlGetHandle($hWnd, "", "Edit1"), 0x00CF, 1, 0) ; $EM_SETREADONLY = 0x00CF
    2 points
  3. Here is a rewrite of Wards Curl UDF with the binary portion removed so that it can support external (updated) library's and add support for x64. I added quite a few new header constants and also have included the curl-ca-bundle certificate. I modified the first two "easy" examples to demonstrate using the ca-bundle to verify the SSL peer. I also added a new example showing how to download the certificate chain. The 7.82.0 version dlls are included but they can be replaced with updated versions as they come out in the future. You can find future releases here : https://curl.se/windows/ Let me know if you have any issues. Cheers! 🙂 Curlx64.7z
    1 point
  4. I figured: it works if no quotes are being used if there're no spaces in path, i.e. "C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" /ErrorStdOut "C:\SetRegTime_.au3" \Registry\Machine\System\ControlSet001\Control 2020:01:01:00:00:00:789:1234 -n So I can execute extracted SetRegTime code from this post from SciTE-Lite now with 3 parameters: none, -n and -s. But -n and -s provide similar result: just first registry key is being processed. No errors and no "Location" in the output. P.S. Adobe has nothing to do with this thread, it was just the top most key in Software branch of Windows registry. This research is not related to piracy in any way.
    1 point
  5. I didn't understand. In 2017 this script worked with key derivation, today I am using the same structure and algorithms for the same application which now works without key derivation in 2023. I don't see why reset semantic versioning or copyright. Ah, OK. I can't do this because it's possible that I die in 2025 and someone who has the script on an old machine in 2032 and runs the script will think I'm alive and providing support.. As for the size of the keys, this tool is not suitable for inserting random keys so to speak, it is meant to be used with IKM, i.e. a Diffie-Hellman shared key derived in some way like HKDF or PBKDF and, in the absence of these , HMAC. It is imperative that the user knows the length of the keys and that he has a mechanism to generate appropriate keys for using this script in conjunction with other tools in other languages. I mean, whoever is programming a cryptographic system in PHP will not find problems in generating keys and will need mechanisms for this. The keys used are ephemeral, meaning they cannot be reused, there is no point in memorizing a 128-bit key as they should not be reused in this tool. That is, if it is the case of using memorized or invented keys on the fly, it is best to use the AutoIt3 example tool which performs the same tasks and supports passowrds of any length. Otherwise, you will need a tool to generate the keys in the correct size so that this step does not depend on manual verification (knowing the length of each key that will be used), as this system should be automatic.
    1 point
  6. 1 point
  7. 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
  8. Learn about AutoIt first. You are walking with your hand in your eyes. Saludos
    1 point
  9. Glad my UDF works for you. Thank you for providing positive feedback. As for making a long and extensive help file, I will not doing it. The UDF is meant to be an example of the code that can be written in AutoIt. It is not intended to be a basic part of the package.
    1 point
  10. HI, I need to run a ".exe" program into a window Autoit. Can you help me?
    1 point
  11. Hiho Forum, different approach, same result as with Hopefully useful for someone 😉. Global $__a_Global_SHEx[3] ; $__a_Global_SHEx[0] = SHELLHOOK registered ; $__a_Global_SHEx[1] = hWnd for Hook ; $__a_Global_SHEx[2] = Dialog title _SHEx_RegisterWindowMessage_Init() Local $s_Selected_File = _FileOpenDialog_Wrapper("Select File", @ScriptDir, "All (*.*)", 1 + 2 + 4) If Not @error Then MsgBox(0, "", $s_Selected_File) Func _FileOpenDialog_Wrapper($sTitle, $sInitDir, $sFilter, $iOptions = 0, $sDefaultName = "", $hWnd = 0) ; https://groups.google.com/forum/?hl=en&fromgroups=#!topic/microsoft.public.vc.mfc/HafQr4gIRY0 ; The problem is that GetOpenFileName changes the current directory to the last browsed one. The current directory and any of its parents cannot be deleted. If Not $sInitDir Then $sInitDir = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" ; CLSID for "My Computer" Local $sWorkingDir = @WorkingDir $__a_Global_SHEx[2] = $sTitle _SHEx_ShellHookWindow($__a_Global_SHEx[1], 1) ; activate hook Local $sFilename = FileOpenDialog($sTitle, $sInitDir, $sFilter, $iOptions, $sDefaultName, $hWnd) Local $iError = @error _SHEx_ShellHookWindow($__a_Global_SHEx[1], 0) ; de-activate hook FileChangeDir($sWorkingDir) If Not $iError Then If StringInStr($sFilename, "|", 2) Then ; multiple selection Local $aFilename = StringSplit($sFilename, "|") Else Local $sPath = StringTrimRight($sFilename, StringLen($sFilename) - StringInStr($sFilename, "\", 2, -1)) EndIf EndIf Return SetError($iError, 0, $sFilename) EndFunc ;==>_FileOpenDialog_Wrapper Func _SHEx_RegisterWindowMessage_Init() $__a_Global_SHEx[0] = GUIRegisterMsg(_SHEx_RegisterWindowMessage("SHELLHOOK"), "_SHEx_HShellWndProc") Local $old_GUISwitch = GUISwitch(0) $__a_Global_SHEx[1] = GUICreate("SHELLHOOK GUI - " & @ScriptName) GUISwitch($old_GUISwitch) EndFunc ;==>_SHEx_RegisterWindowMessage_Init Func _SHEx_RegisterWindowMessage($sText) Local $aRet = DllCall('user32.dll', 'int', 'RegisterWindowMessage', 'str', $sText) Return $aRet[0] EndFunc ;==>_SHEx_RegisterWindowMessage Func _SHEx_ShellHookWindow($hWnd, $bFlag) Local $sFunc = 'DeregisterShellHookWindow' If $bFlag Then $sFunc = 'RegisterShellHookWindow' Local $aRet = DllCall('user32.dll', 'int', $sFunc, 'hwnd', $hWnd) ; ConsoleWrite("_SHEx_ShellHookWindow: " & $aRet[0] & @crlf) Return $aRet[0] EndFunc ;==>_SHEx_ShellHookWindow Func _SHEx_HShellWndProc($hWnd, $Msg, $wParam, $lParam) ; ShellProc callback function ; https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644991(v=vs.85) ConsoleWrite($hWnd & @TAB & $Msg & @TAB & $wParam & @TAB & $lParam & @CRLF) If $wParam = 1 Then ; 1 = $HSHELL_WINDOWCREATED If $lParam = WinGetHandle("[TITLE:" & $__a_Global_SHEx[2] & ";CLASS:#32770]", "") Then ConsoleWrite("WinMove= " & WinMove($lParam, "", (@DesktopWidth - (@DesktopWidth / 4 * 3)) / 2, (@DesktopHeight - (@DesktopHeight / 4 * 3)) / 2, @DesktopWidth / 4 * 3, @DesktopHeight / 4 * 3) & @CRLF) EndIf EndIf ; https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644991(v=vs.85) Return 0 ; The return value should be zero unless the value of nCode is HSHELL_APPCOMMAND and the shell procedure handles the WM_COMMAND message. In this case, the return should be nonzero. EndFunc ;==>_SHEx_HShellWndProc
    1 point
  12. You woud have to add a static variabele that counts the instancematch as long as its not a match you continue instead of exitloop. Just add a bunch of consolewrites and remove exitloop to learn how the code works.
    1 point
  13. According to the original structure definition DllStructGetData($s1, "find_PnpDevice_Info") should return a byte array (length=1036*512) so Ubound should return 530432.
    0 points
  14. Part of programming is the extra fun part of debugging. So do not give us the whole code of yours for us to debug it for you. Either you put effort of doing it yourself, or hire someone to do it for you.
    0 points
×
×
  • Create New...