Jump to content

sfranzyshen

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by sfranzyshen

  1. I have been able to use ANYGUIv2.8 & AutoIt v3.3.6.1 by modifying the ANYGUIv2.8.au3 file as follows; CHANGE: #include-once #include <guiconstants.au3> #include "guilist.au3" TO: #include-once #include <GUIconstants.au3> #include <WindowsConstants.au3> #include "GUIListBox.au3" then the code above will work again
  2. Button Text & Background colors! Another problem I have is when I add a control to an app's window, the control dosn't match the UI of the rest of the application. Perfect example of this is the calculator example I posted that added a button to the UI of the calc app, but the button's text color didn't match the rest of the app's UI. Color changes to buttons within AutoIt is in my opion "Broken". However, there is light at the end of the tunnel. The GUIRegisterMsg function has been quietly added to the AutoIt beta version. What this NEW function does is allow us to hook window/control messages. Allowing us to catch the WM_DRAWITEM message and proccess it ourselves. An excelent example is included in the help examples called GUIRegisterMsg.au3. I have stripped this file into two files. The first file is an #include file that contains just the functions and defines. The second file contains the MY_WM_DRAWITEM functions that I included into the calulator example here. #include <guiconstants.au3> #include <anyguiv2.6.au3> #include <_GUIRegisterMsg.au3> Const $HWND_TOP = 0 Const $HWND_BOTTOM = 1 Const $SWP_NOMOVE = 0x0002 Const $SWP_NOSIZE = 0x0001 Run ( "calc" ) WinWait ( "Calculator" ) $Pos = WinGetPos ( "Calculator" ) WinMove ( "Calculator", "", (@DesktopWidth-$Pos[2])/2, (@DesktopHeight-$Pos[3])/2 ) ControlHide ( "Calculator", '', "Static1" ); Hide the control we want to replace _GuiTarget ( "Calculator", 1 ); target the window $Quit = _TargetAddButton ( "Quit", 8, 37, 36, 29 ); add a button where the previous control was $Quit = $Quit[0] GUICtrlSetStyle($Quit, BitOr($WS_TABSTOP, $BS_NOTIFY, $BS_OWNERDRAW)); Set the ownerdrawn flag GUIRegisterMsg($WM_DRAWITEM, "MY_WM_DRAWITEM") GUISetState ( @SW_SHOW ); reset GUI While 1 $msg = GUIGetMsg ( ) If $msg = $Quit Then Exit If Not WinExists ( "Calculator" ) Then Exit wEnd Func OnAutoItExit() ProcessClose ( "calc.exe" ) EndFunc ; Draw the button Func MY_WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam) Local $stDrawItem = DllStructCreate("uint;uint;uint;uint;uint;uint;uint;int[4];dword", $lParam) $nCtlType = DllStructGetData($stDrawItem, 1) If $nCtlType = $ODT_BUTTON Then $nCtrlID = DllStructGetData($stDrawItem, 2) $nItemState = DllStructGetData($stDrawItem, 5) $hCtrl = DllStructGetData($stDrawItem, 6) $hDC = DllStructGetData($stDrawItem, 7) $nLeft = DllStructGetData($stDrawItem, 8, 1) $nTop = DllStructGetData($stDrawItem, 8, 2) $nRight = DllStructGetData($stDrawItem, 8, 3) $nBottom = DllStructGetData($stDrawItem, 8, 4) $sText = "Quit" $nTextColor = 0x0000ff $nBackColor = 0xced3d6 ;0xD6D3CE DrawButton($hWnd, $hCtrl, $hDC, $nLeft, $nTop, $nRight, $nBottom, $nItemState, $sText, $nTextColor, $nBackColor) $stDrawItem = 0 Return 1 EndIf $stDrawItem = 0 Return $GUI_RUNDEFMSG; Proceed the default Autoit3 internal message commands EndFunc Place the attached file "_GUIRegisterMsg.au3" into your include folder. then run the above code BTW: I have been trying to get my _GUICtrlSetOnBottom() function working ... but it wont. So I only offer the _GUICtrlSetOnTop() function as an addition to AnyGUI. You can still accomplish all kinds of z-order changes with this one function. It will work on GUI added controls or existing controls. If you want a control to move down the z-order, just set another control ontop of it. Thanks sfranzyshen _GUIRegisterMsg.au3
  3. z-order
  4. CLEARIFY: In these example, you do not need to change anything in you AnyGUI.au3 file. The #include statement may have been missleading ... no change is need in either case ... The change that was made to AnyGUI.au3 changed the way the targetaddchild was called. Simply the same call made in the _GUICtrlSetOnTop() function. So, you can do the same thing simply by using an unchanged AnyGUI.au3 include file, call a targetadd function, and then call the _GUICtrlSetOnTop() function (as shown above.) Thanks sfranzyshen
  5. Hi Me Again! Ok, I have created two examples below. The first examples shows how to "REPLACE" a control completly (Hide it, then create a new one). The Second example shows how to "PUT ON TOP" a control on top of an existing control. The second example also contains the "_GUICtrlSetOnTop( )" function that can be added to AnyGUI. Replace an existing control example: #include <guiconstants.au3> #include <anyguiv2.6.au3>; z-order modified ;from Winuser.h (maybe shuold be placed into an include file some where) Const $HWND_TOP = 0 Const $HWND_BOTTOM = 1 Const $SWP_NOMOVE = 0x0002 Const $SWP_NOSIZE = 0x0001 Run ( "calc" ) WinWait ( "Calculator" ) $Pos = WinGetPos ( "Calculator" ) WinMove ( "Calculator", "", (@DesktopWidth-$Pos[2])/2, (@DesktopHeight-$Pos[3])/2 ) ControlHide ( "Calculator", '', "Static1" ); Hide the control we want to replace _GuiTarget ( "Calculator", 1 ); target the window $Quit = _TargetAddButton ( "Quit", 8, 37, 36, 29 ); add a button where the previous control was $Quit = $Quit[0] GUISetState ( @SW_SHOW ); reset GUI While 1 $msg = GUIGetMsg ( ) If $msg = $Quit Then Exit If Not WinExists ( "Calculator" ) Then Exit wEnd Func OnAutoItExit() ProcessClose ( "calc.exe" ) EndFunc On-TOP an existing control example: #include <guiconstants.au3> #include <anyguiv2.6.au3>; z-order modified ;from Winuser.h (These should be moved to a include) Const $HWND_TOP = 0 Const $HWND_BOTTOM = 1 Const $SWP_NOMOVE = 0x0002 Const $SWP_NOSIZE = 0x0001 ;other Const $GW_HWNDPREV = 3 Const $GW_HWNDNEXT = 2 Const $GW_HWNDLAST = 1 Const $GW_HWNDFIRST = 0 Run ( "mspaint" ); run an app WinWait ( "untitled - Paint" ); wait for app $Pos = WinGetPos ( "untitled - Paint" ); get default potision of app's window WinMove ( "untitled - Paint", '', (@DesktopWidth-$Pos[2])/2, (@DesktopHeight-$Pos[3])/2, 462, 425 ); move the app to the center on the desktop _GuiTarget ( "untitled - Paint", 1 ); target the GUI of the app $Quit = _TargetAddButton ( "Quit", 3, 180, 50, 25, BitOr($WS_CHILD, $WS_VISIBLE, $WS_TABSTOP) ); create new control on app $GUI = $Quit[2]; save the handle of the AutoIt GUI (child) for later updating $Quit = $Quit[0]; save the controlid of the newley created button GUICtrlSetTip ( -1, "Quit Paint Now!" ); set the tool tip for the newley created button _GUICtrlSetOnTop( $GUI ); we need to call this after creating the button in applications that have controls with no ; current tab order set, in other applications that have tab orders, we do not need to call ; this function unless the screen gets redrawn and we need to update (redraw) our control GUISetState ( @SW_SHOW ); refresh GUI While 1; loop and wait for button press $msg = GUIGetMsg ( ) If $msg = $Quit Then Exit If Not WinExists ( "untitled - Paint" ) Then Exit wEnd Func OnAutoItExit() ProcessClose ( "mspaint.exe" ) EndFunc Func _GUICtrlSetOnTop( $HWND ) DllCall("user32.dll", "long", "SetWindowPos", "hwnd", $HWND, "hwnd", $HWND_TOP, "int", 0, "int", 0, "int", 0, "int", 0, "long", BitOR($SWP_NOMOVE, $SWP_NOSIZE )) GUISetState ( @SW_SHOW ) EndFunc Thanks! I will be posting everything I figure out here ... you (or everyone) are welcome to do with it what ever you would like Hope this helps ya! I am next looking at menus. Anyone got some good links to WIN32 API menu programming? I would like to hide, add, modify application menus. Anyone else? It's got to be possible. quaizywabbit's _WinMenuGetHandle() function looks like a good start! I would also like to interact with parts of controls (custome or API) for instance, the ability to click on just part of a toolbar, or change an edit control within parent control?? Thanks sfranzyshen
  6. "404: The page/file you requested could not be found." That link is broken I do not have Excel installed, so I am not sure what you are doing here ... If you make the change to you AnyGUI, it may just simply work! (I'm not realy sure what you want or are trying to do here?) But, if you modify your AnyGui in the way I showed, ANY control you create, will be placed at the top most layer of the z-order. In other words, the newley created control (any control created with the _Targetadd* functions from AnyGui) will be placed ontop anything else in the targeted window (assuming the control(s) you want to overlay are set with the style WS_TABSTOP.) You can already replace a control. Just Hide it, then create a new control in it's place. I use this where I can not just hide the control. For instance, a toolbar. I do not want to replace the entire toolbar, Just one button of it. So, I fire up this little change and I am able to OVERLAY my control(s) ontop of an existing control(s). Thanks sfranzyshen
  7. Hi All! I have been playing around with AnyGui and it is awesome. There is only one thing I find missing. That is some way to overlay (overlapping) controls. Letting you put a control ontop of another control. The only way to do this is to change the z-order of the controls. Just our luck that win32 api ties the z-order of controls (the z axis) to the tab order of the controls. So all we need to do is change the tab order of the controls and we change the z-order also. Here is the code: I modified my copy of AnyGUIv2.6's _TargetaddChild function to change the z-order (of the child just created) after the GUICreate function is called. Like this Func _TargetaddChild($text, $PosX, $PosY, $SizeX, $SizeY, $LocTargethWnd = 0); Const $HWND_TOP = 0 If not ($LocTargethWnd = 0) Then $TargethWnd = $LocTargethWnd Local $a = GUICreate($text, $SizeX, $SizeY, $PosX, $PosY, $WS_CHILD, -1, $TargethWnd) If $a = 0 Then SetError(1) Return $a Else DLLCall ( "user32.dll", "long", "SetWindowPOS", "hwnd", $a, "hwnd", $HWND_TOP, "int", 0, "int", 0, "int", 0, "int", 0, "long", BitOR ( $SWP_NOMOVE, $SWP_NOSIZE )) Return $a EndFunc ;==>_TargetaddChild Now, when ever I create a control, it shows up ontop HOWEVER! most software will refresh the window (and z-order)after a maximize, or minimize. So, your code will need to be called after these actions so that the z-order can be re-modified. I am working on creating the following functions to make the coding easier. _GUICtrlSetOnTop() _GUICtrlSendUp() _GUICtrlSendDown() I will post them once I am finished. Thanks sfranzyshen
×
×
  • Create New...