Leaderboard
Popular Content
Showing content with the highest reputation on 08/03/2023 in all areas
-
Control Viewer (mod.)
robertocm reacted to argumentum for a file
Version 0.2024.9.16
5,363 downloads
This is @Yashied's most excellent control viewer, modified by me, based on the code @boomingranny posted. There are 2 forum entries, one shows active and the other depreciated, and not seen @Yashied since March 2016, so I feel is OK to post this, tho, i'd take it down upon request. PS: Do run as Admin if available, as it may not do what you need without the rights.1 point -
Tester needed ^^
argumentum reacted to Shark007 for a topic
@argumentum , its existance is the problem. The function is not even called because you need an OS < 14393 I am on Win11 22H21 point -
"GuiCtrls_HiDpi" (UDF in progress)
argumentum reacted to Shark007 for a topic
Still thinking out load, The font looks better using a setting of 1. Using 0, or what I had before, is too bold'ish compared to using 1. EDIT - Since solving the 5 second delay I was experiencing, I can now tell you that I have completely abondonned my old way of dealing with HiDpi Gui's and have now fully adopted this method. After dumping the manifest method altogether and using UEZ's August 4th release, I'm a happy camper. I still need to modify _WinAPI_DPI.au3 with the following though, Case @OSBuild > 13999 $DPIAwareContext = ($DPIAwareContext < -5) ? -5 : ($DPIAwareContext > -1) ? -1 : $DPIAwareContext $iMode = ($iMode < 1) ? 1 : ($iMode > 2) ? 2 : $iMode Switch $iMode Case 1 _WinAPI_SetProcessDpiAwarenessContext($DPIAwareContext) If @error Then Return SetError(3, 0, 0) Case 2 _WinAPI_SetThreadDpiAwarenessContext($DPIAwareContext) If @error Then Return SetError(4, 0, 0) EndSwitch otherwise, my GUI does not show.1 point -
"GuiCtrls_HiDpi" (UDF in progress)
argumentum reacted to Andreik for a topic
Everything comes with a price.1 point -
"GuiCtrls_HiDpi" (UDF in progress)
argumentum reacted to Shark007 for a topic
I have it working in my quite large project which contains aprox 100 different controls. Currently tracking down why my app take a full 5 seconds to open whereas it was instant before. More thinking out loud.1 point -
I think there is a way to use it with Oracle forms because they are just Java or at least they used to be back when I had to deal with them shudder Oracle is an ominous monster that once installed can never be uninstalled fully. And if you try to install Oracle again, you will be mega hosed. I never screwed up with it in the field or during any development, but it was a Pia. Wait no I did screw up my machine at work and the IT guys laughed at me because they knew I tried to reinstall it and that’s what trashed the system.1 point
-
"GuiCtrls_HiDpi" (UDF in progress)
argumentum reacted to Shark007 for a topic
heated? well not really but I did get jos involved . . .1 point -
I think so, but you there have been two different questions posted to this thread. It might be best to move the discussion over to @Champak's new thread.1 point
-
@Sushaant To be more precise, we can help as long as you just need to give you a rod, not that you expect a whole fish. We help, but we don't do anything instead of you - you have to get involved and ask questions about small things and not about complex solutions. The previous speakers were simply very direct, and we are happy to see you here. Welcome to the AutoIt forum.1 point
-
"GuiCtrls_HiDpi" (UDF in progress)
argumentum reacted to Andreik for a topic
Here is what I was talking about. I made the most basic example for a basic understanding but actually to implement it your UDF you just need to put in CBTProc() the logic from _HiDpi_GUIDelete() when you find that a window created by your current process is about to be destroyed. The rest of code is basically what you already do, saving the handles of GUI into an array, etc. #include <WinAPIProc.au3> #include <WinAPISys.au3> #include <Array.au3> Global Const $WH_CBT = 5 Global $aGUI[2] = [1, 0] $hCBTProc = DllCallbackRegister('CBTProc', 'long_ptr', 'int;wparam;lparam') $hHook = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($hCBTProc), _WinAPI_GetModuleHandle(0), _WinAPI_GetCurrentThreadId()) $aGUI[1] = GUICreate('Test', 400, 400) $idButton = GUICtrlCreateButton('Create window', 100, 100, 100, 30) GUISetState(@SW_SHOW, $aGUI[1]) While True $aMsg = GUIGetMsg(1) Switch $aMsg[0] Case -3 ; GUI_EVENT_CLOSE GUIDelete($aMsg[1]) _ArrayDisplay($aGUI) If $aGUI[0] = 0 Then ExitLoop Case $idButton $aGUI[0] += 1 ReDim $aGUI[$aGUI[0] + 1] $aGUI[$aGUI[0]] = GUICreate('I am a new window', 400, 400, Random(0, @DesktopWidth - 400, 1), Random(0, @DesktopHeight - 400, 1)) GUISetState(@SW_SHOW, $aGUI[$aGUI[0]]) _ArrayDisplay($aGUI) EndSwitch WEnd _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hCBTProc) Func CBTProc($nCode, $wParam, $lParam) If $nCode = 4 Then ; HCBT_DESTROYWND ; If a window is about to be destroyed ; let's check if it's not a GUI created by us For $Index = 1 To $aGUI[0] If $aGUI[$Index] = $wParam Then ; This is a window created by us _ArrayDelete($aGUI, $Index) $aGUI[0] -= 1 ExitLoop EndIf Next EndIf Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc1 point -
"GuiCtrls_HiDpi" (UDF in progress)
argumentum reacted to Shark007 for a topic
preliminary results are looking quite good. As time permits (today), I'm going to attempt to integrate this into a very large existing project I have that currently uses my own implementation of HiDpi. EDIT - not as easy as I had hoped it would be. One thing I've noticed is that GuiCtrls_HiDpi deals with font, and it should not. When an Application is Dpi Aware, the font is dealt with by the system and does not require user interaction at all. Only the graphical control dimensions and placement, such as the gui itself, labels, checkbox's, splashtext etc. require Dpi adjustment to their " left, top, width, height ", not the font itself. Example: When a user sets Windows DPI to 225% . . . left, top, width, height, should each be multiplied bt 2.25 resulting in a perfect gui. How I currently achieve this (DpiAwareness is set in the manifest) _GDIPlus_Startup() Global $iScale = DllCall($__g_hGDIPDll, "int", "GdipGetDpiX", "handle", _GDIPlus_GraphicsCreateFromHWND(0), "float*", 0)[2] / 96 ;Windows scaling _GDIPlus_Shutdown() If Not $iScale >= 1 Then $iScale = 1 GUICtrlCreateLabel('Shark007', 185 * $iScale, 60 * $iScale, 145 * $iScale, 18 * $iScale) All of the software I create employs this method and all of my software is DpiAware which I distribute globally without complaint.1 point -
"GuiCtrls_HiDpi" (UDF in progress)
argumentum reacted to Andreik for a topic
I'll do an example after I get some sleep, 6:43 AM here.1 point -
Thanks, That worked. Incidentally I did have to place this capabilityAdd at the end of the other capabilityAdds. I'm going to start a new thread now since I have a specific issue regarding what I'm doing and don't want to hijack this thread.1 point
-
SystemParametersInfo > GetSystemFont ( I made an ugly bug )
argumentum reacted to Andreik for a topic
Well after a closer inspection I think it has nothing to do with GuiSetState() but with data returned by _WinAPI_SystemParametersInfo() that goes out of scope when function returns so data is not reliable anymore. This code would be a better approach: #include <WinAPISys.au3> #include <WinAPIsysinfoConstants.au3> Global $___gt__HiDpi_WinFont = _SystemParametersInfo_GetSystemFont() $hGUI = GUICreate('Test', 400, 400) GUISetState(@SW_SHOW, $hGUI) ConsoleWrite("Font : Attributes: " & $___gt__HiDpi_WinFont.Attributes & @CRLF) ConsoleWrite("Font : Weight: " & $___gt__HiDpi_WinFont.Weight & @CRLF) ConsoleWrite("Font : Quality: " & $___gt__HiDpi_WinFont.Quality & @CRLF) ConsoleWrite("Font : FaceName: " & $___gt__HiDpi_WinFont.FaceName & @CRLF) Func _SystemParametersInfo_GetSystemFont() Local $tLOGFONT = DllStructCreate(StringReplace($tagLOGFONT, 'OutPrecision', 'Attributes')) Local $iSize = DllStructGetSize($tLOGFONT) Local $tNONCLIENTMETRICS = DllStructCreate("STRUCT;uint cbsize;int iBorderWidth;int iScrollWidth;int iScrollHeight;int iCaptionWidth;" & _ "int iCaptionHeight;byte lfCaptionFont[" & $iSize & "];int iSmCaptionWidth;int iSmCaptionHeight;byte lfSmCaptionFont[" & $iSize & "];int iMenuWidth;" & _ "int iMenuHeight;byte lfMenuFont[" & $iSize & "];byte lfStatusFont[" & $iSize & "];byte lfMessageFont[" & $iSize & "];int iPaddedBorderWidth;ENDSTRUCT") $tNONCLIENTMETRICS.cbsize = DllStructGetSize($tNONCLIENTMETRICS) If Not _WinAPI_SystemParametersInfo($SPI_GETNONCLIENTMETRICS, $tNONCLIENTMETRICS.cbsize, $tNONCLIENTMETRICS) Then Return SetError(@error, @extended, 0) Local $tTemp = DllStructCreate($tagLOGFONT, DllStructGetPtr($tNONCLIENTMETRICS, "lfCaptionFont")) With $tLOGFONT .Weight = $tTemp.Weight .FaceName = $tTemp.FaceName .Quality = $tTemp.Quality .Attributes = BitOR(($tTemp.Italic ? 2 : 0),($tTemp.Underline ? 4 : 0),($tTemp.Strikeout ? 8 : 0)) EndWith Return $tLOGFONT EndFunc1 point -
OK, thanks. I'll work this some more and get back. I know how to post code now!1 point
-
@agivx3 If your primary goal is to capture the new location of a redirect response, then the example below should help. If your primary goal is to figure out why your script didn't work using the WinHttp UDF, then maybe someone else will come along and help you with that. Of course that assumes that this thread isn't closed first, since you revived it after being dormant for 7 years. Example: #include <Constants.au3> http_redirect_example("https://go.microsoft.com/fwlink/?LinkID=2093505") Func http_redirect_example($sURL) Const $OPTION_ENABLE_REDIRECTS = 6 ;Register COM Error Handler Local $oComErr = ObjEvent("AutoIt.Error", com_error_handler) If @error Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "ERROR", "Unable to register COM error handler - @error = " & @error) With ObjCreate("winhttp.winhttprequest.5.1") ;Open GET request .Open("GET", $sURL) If @error Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "ERROR", StringFormat("(0x%X) %s", $oComErr.RetCode, $oComErr.WinDescription)) ;Set option to disable redirects in order to capture 301 and 302 responses .Option($OPTION_ENABLE_REDIRECTS) = False ;Send the request .Send() If @error Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "ERROR", StringFormat("(0x%X) %s", $oComErr.RetCode, $oComErr.Description)) ConsoleWrite("Requested URL: " & $sURL & @CRLF) ConsoleWrite(StringFormat("HTTP Status: %s %s", .Status, .StatusText) & @CRLF) ;If http status code is 301 or 302 (Redirect) If .Status = 301 Or .Status = 302 Then ;Display new location ConsoleWrite("New Location: " & .GetResponseHeader("Location") & @CRLF) Return EndIf ;Display response ConsoleWrite(@CRLF & "HTTP Response:" & @CRLF) ConsoleWrite(.ResponseText & @CRLF) EndWith EndFunc Func com_error_handler($oError) With $oError ConsoleWrite(@CRLF) ConsoleWrite("COM ERROR:" & @CRLF) ConsoleWrite("- Error Number........... " & "0x" & Hex(.number) & @CRLF) ConsoleWrite("- Error WinDescription... " & StringStripWS(.windescription, $STR_STRIPTRAILING) & @CRLF) ConsoleWrite("- Error Description...... " & StringStripWS(.description , $STR_STRIPTRAILING) & @CRLF) ConsoleWrite("- Error ScriptLine....... " & .scriptline & @CRLF) ConsoleWrite("- Error RetCode.......... " & "0x" & Hex(.retcode) & @CRLF) EndWith Return ; Return so @error can be trapped by the calling function EndFunc Example's output: Requested URL: https://go.microsoft.com/fwlink/?LinkID=2093505 HTTP Status: 302 Moved Temporarily New Location: https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/f343fe88-b98f-4578-9e6b-0534cc919974/MicrosoftEdgeEnterpriseX86.msi1 point