Sign in to follow this  
Followers 0
musicstashall

Hide and restore the window element

2 posts in this topic

#1 ·  Posted

Guru, mentors, help please). I draw on external windows various controls. I want to hide the original contents of the window and display my own, custom. It seems that everyone is working, but not without a kick, after hiding an element, you have to minimize the window and restore it, then it will be cleaned. But when you restore content, everything is drawn immediately.
1. How to hide the item, update, redraw the window ??
2. How can I avoid going beyond the window of "superimposed" elements if the window size changes?

#include <GUIConstants.au3>

While 1
  ;Get window handle
  $hGUI = WinWaitActive("Цвет и внешний вид"); I'm sorry, I do not know, as in English appears header... may be «Color and appearance»

  $aPos = ControlGetPos($hGUI, "", "[CLASS:msctls_trackbar32; INSTANCE:1]"); Binding to this element
  $gui = GUICreate("", $aPos[2], $aPos[3] * 5, $aPos[0] + $aPos[2] + 20, $aPos[1] + $aPos[3] * 2, $WS_POPUP); Create your own window
  DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $gui, "hwnd", $hGUI)
 
  ;$btn = GUICtrlCreateButton("Кнопка1", 0, 0, $aPos[2], $aPos[3])
  ;$sld = GUICtrlCreateSlider(0, 0, $aPos[2], $aPos[3])
  $lab1 = GUICtrlCreateLabel("Дополнительные настройки цвета", 0, 0, $aPos[2], $aPos[3]); Create our own elements
  $lab2 = GUICtrlCreateLabel("Настройки прозрачности и блюр", 0, 30, $aPos[2], $aPos[3])
  $lab3 = GUICtrlCreateLabel("Настройки окна проводника", 0, 60, $aPos[2], $aPos[3])
  GUISetState()

  GUICtrlSetState($lab1, $GUI_FOCUS)
  GUICtrlSetState($lab2, $GUI_FOCUS)
  While 1
    Switch GUIGetMsg()
      Case $lab1
        $t = ControlHide("[CLASS:CabinetWClass]", "", "[CLASS:DirectUIHWND; INSTANCE:4]") ; Concealed an item
        WinSetState("Цвет и внешний вид", "", @SW_SHOWNA) ; I'm trying to update the window somehow
        GUISetState($hGUI, @SW_RESTORE) ; I also try to update the contents of the window
      Case $lab2
        $t = ControlHide("[CLASS:CabinetWClass]", "", "[CLASS:DirectUIHWND; INSTANCE:4]")
      Case $lab3
        ControlShow ("[CLASS:CabinetWClass]", "", "[CLASS:DirectUIHWND; INSTANCE:4]"); Restore content
        ExitLoop
    EndSwitch
    Sleep(50)
  WEnd
Sleep(50)
WEnd

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The issue was partly resolved. After each change in the windows, you need to access the library, specifying a new window. Then the windows will be "obedient". In this case, Form1:

DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $Form1, "hwnd", $hGUI)

But immediately another question arose: how to connect the form to the script? Or how for GUI in a script to develop the form ?? The script has $gui1, I want to develop a form for it ...

sorry for dullness))

Edited by musicstashall

Share this post


Link to post
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
Sign in to follow this  
Followers 0