guitara Posted November 6, 2005 Share Posted November 6, 2005 (edited) I'm trying to add a taskbar button into a trading application, Metatrader (www.metatrader.com). I have an application that interfaces with my broker already, so I thought having a direct button would be easier inside my trading software. IE, click 'buy', and my script runs. Here's an image of the application.If I try and resize the trade window (the big window in the middle, with a black background) and embed a gui, the application draws over it. I've had no success adding a button anywhere on the application ethier. Perhaps you could best help me by giving an example of adding a button to a windows application or adding context menu, or both. Think Paint or wordpad or something. I've seen the notepad and calculator examples, but neither of these do this. Perhaps it's not possible to manupilate every application, if they don't use windows forms,? Also, is there any way to prevent an application form redrawing over an embedded GUI? The control for the trade window doesn't seem to want to be sized (and hence, I don't see my embeded gui). Thanks! Edited November 6, 2005 by guitara Link to comment Share on other sites More sharing options...
quaizywabbit Posted November 7, 2005 Share Posted November 7, 2005 (edited) sometimes these apps can be a bugger to work with, especially when they redraw/update frequently. does the autoit window info tool highlight each section properly? Edited November 7, 2005 by quaizywabbit [u]Do more with pre-existing apps![/u]ANYGUIv2.8 Link to comment Share on other sites More sharing options...
guitara Posted November 7, 2005 Author Share Posted November 7, 2005 Yes, it highlights each toolbar section indivudually, as well as the entire toolbar section (all four outlined at once), giving unique control IDs for each. Then it also gives a control ID for the main black window. Your remove menu script example worked with the application, successfully removing the menu, and the embed GUI appears to work in the main window, but as I said, it flickers between my gui, and the main window, making it useless. I could give code, but I'm not at home, and it's useless if you don't have the app. I'm thinking I'm not doing something properly, as I figured I *should* be able to embed something into one of those toolbars at the top, without having the flickering troubles. Of course, actually embeding the gui, as in the notpad example would be best. Thanks! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 7, 2005 Moderators Share Posted November 7, 2005 Are you creating the buttons in a loop, and not stopping the creation afterwards? Maybe it's just constantly recreating itself is why you're seeing the flicker. Just a thought... GL Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
guitara Posted November 8, 2005 Author Share Posted November 8, 2005 Ok, i'm @ home once again, so I'll post the code. I've stripped everything from it.. Nothing fancy here, just trying to make a button appear. #include <ANYGUI.au3> #include <guiconstants.au3> $Targetwindow = _GuiTarget ("211232: MetaTrader - Demo Account - [EURUSD,M15]", 1,292) $btn1 = _TargetaddCheckbox ( "B", 11, 81, 22, 20); GUISetState(@SW_SHOW); While WinExists($Targetwindow) $msg = GUIGetMsg(1) If $msg[0] = $GUI_EVENT_CLOSE Then Exit If $msg[0] = $GUI_EVENT_RESTORE or $GUI_EVENT_RESIZED then _setwindow() If Not WinExists($Targetwindow) Then Exit Sleep(50) WEnd Well, I was gonna show you some more example code, but I found a hidden control. The main window is contained inside another control. Sending it to that and resizing the control works, except for their is no canvas behind the embededd gui. Click in between the space of the embedded GUI and the window will render it inactive. Kinda funny to see my desktop icons show through into the app. Anyways, thanks for your help. Ohh, here's the code that does work. It's also seems a bit unresponsive at times. Again, this is probably not the best way to do this. #include <ANYGUI.au3> #include <guiconstants.au3> $Targetwindow = _GuiTarget ("211232: MetaTrader - Demo Account - [EURUSD,M15]",1,"",65280); mode 1 set so all '_Targetadd(s) go to this window Func _setwindow() ControlMove($Targetwindow, "", 59648, 0, 0, 800, 500);resize main window control so everything fits $btn1 = _TargetaddCheckbox ( "B", 11, 81, 22, 20); GUISetState(@SW_SHOW); $btn2 = _TargetaddButton ( "Button2", 150, 550, 100, 50); GUISetState(@SW_SHOW); $Child = _TargetaddChild ("Test", 810, 0, 205, 500); GUISetBkColor(0xff000); $label1 = GUICtrlCreateLabel("Child Window", 60, 0, 100, 30) $btn3 = GUICtrlCreateButton("Button3", 52, 35, 100, 50); $grp1 = GUICtrlCreateGroup("Testing", 20, 90, 165, 200); $radio1 = GUICtrlCreateRadio("A", 95, 120); $radio2 = GUICtrlCreateRadio("B", 95, 180); $radio3 = GUICtrlCreateRadio("C", 95, 240); $Date = GUICtrlCreateDate("My Calender", 20, 300, 165, 180); GUISetState(@SW_SHOW); $tab = _TargetaddTab (300, 500, 715, 210); $tab1 = GUICtrlCreateTabItem("First"); $tab2 = GUICtrlCreateTabItem("Second"); $tab3 = GUICtrlCreateTabItem("Third"); GUISetState(@SW_SHOW) EndFunc While WinExists($Targetwindow) $msg = GUIGetMsg(1) If $msg[0] = $GUI_EVENT_CLOSE Then Exit If $msg[0] = $GUI_EVENT_RESTORE or $GUI_EVENT_RESIZED then _setwindow() If Not WinExists($Targetwindow) Then Exit Sleep(50) WEnd Link to comment Share on other sites More sharing options...
quaizywabbit Posted November 8, 2005 Share Posted November 8, 2005 glad to hear you figured it out....good job!!! [u]Do more with pre-existing apps![/u]ANYGUIv2.8 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now