Jump to content

Control Handle versus Control ID


qwert
 Share

Recommended Posts

I've succeeded in getting the correct handle for the scroll bar on the main window of a third-party application by using:

$handle = ControlGetHandle("App Name", "", "[CLASSNN:ScrollBar2]")

How can I use this handle to hide -- or remove -- that scrollbar? Nothing seems to work and most steps seem to reference ControlID instead of Handle. Are they interchangeable?

I will appreciate any advice.

Link to comment
Share on other sites

I've succeeded in getting the correct handle for the scroll bar on the main window of a third-party application by using:

$handle = ControlGetHandle("App Name", "", "[CLASSNN:ScrollBar2]")

How can I use this handle to hide -- or remove -- that scrollbar? Nothing seems to work and most steps seem to reference ControlID instead of Handle. Are they interchangeable?

I will appreciate any advice.

Try this demo:

$PID = Run("Notepad.exe")

WinWait("Untitled - Notepad")
$hWin = ("Untitled - Notepad")
WinActivate($hWin)
WinWaitActive($hWin)

$hEdit = ControlGetHandle($hWin, "", "[CLASSNN:Edit1]")
ControlSend($hWin, "", "[CLASSNN:Edit1]", "Works with [CLASSNN:Edit1]." & @CRLF)
ControlSend($hWin, "", $hEdit, "Works with $hEdit too!" & @CRLF)

Sleep(5000)
ProcessClose($PID)

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Thanks for explaining the equivalence of the two methods. Regarding the scrollbar I'm trying to hide, the following line now returns (1=success) but the scrollbar remains visible:

$result = ControlHide("TestApp", "", "[CLASSNN:ScrollBar2]")

What that seems to mean is that scrollbars aren't considered normal controls and can't be controlled with ControHide. Anyone concur?

Link to comment
Share on other sites

Thanks for explaining the equivalence of the two methods. Regarding the scrollbar I'm trying to hide, the following line now returns (1=success) but the scrollbar remains visible:

$result = ControlHide("TestApp", "", "[CLASSNN:ScrollBar2]")

What that seems to mean is that scrollbars aren't considered normal controls and can't be controlled with ControHide. Anyone concur?

Can you name an app with similar scrollbars that we might test?

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I took another look at the rather extensive GUIScrollBar library. It is comprehensive, indeed. But my need is rather simple: to hide the scroll bars once, ever, following the startup of a particular application. Since all functions of this type eventually resolve to a DllCall, it would appear that something like this might work:

$v_ret = DllCall("user32.dll", "int", "ShowScrollBar" , "hwnd", $h_win, "int", 1, "int", False )

However, I have now determined that the Scrollbar I need to hide is actually in the MDIClient (inside the main window, but usually maximized). Now I find myself in far over my head -- lacking even a full understanding of the terminology. For example, I found this passage on the CodeProject web site:

The scrollbars of the MdiClient control are part of its non-client area (area outside the ClientRectangle) and are not themselves controls parented to the MdiClient. That rules out the possibility of changing the visibility of the scrollbars and leaves us with window messages and Win32 functions that affect the size of the non-client area. When the non-client area of a control needs to be calculated, the control is sent a WM_NCCALCSIZE message. In order to hide the scrollbars, we could tell Windows® that the non-client area is a little bit smaller than it actually is and cover up the scrollbars. My first approach to this was a failed attempt at trying to determine what the size of the non-client area should be. A much better approach would be to hide the scrollbars when the non-client area is calculated using the ShowScrollBar Win32 function.

Is anyone willing to provide an interpretation with respect to AutoIt3 functions? I think it means you can only "hide" an MDIClient's scroll bars by forcing them outside of the viewable area by modifying the window sizes.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...