Bert Posted November 3, 2008 Posted November 3, 2008 (edited) I have a script that embeds a excel object into a gui. Works fine. I've noticed that the embedded excel object will get corrupted from a visual aspect if another window gets on top of the GUI then removed. The displayed corruption can be removed if I scroll down to hide all the corruption, then scroll back. Not a good solution by any means. This is what it looks like if I were for example to open notepad, have that window have focus on top of the gui , then close notepad giving the GUI focus again. $FileName = @ScriptDir&'\book1.xls' If Not FileExists($FileName) Then MsgBox(0, "ERROR", "File not found") Exit EndIf ;Basic GUI $oExcelDoc = ObjGet($FileName); Get an Excel Object from an existing filename If IsObj($oExcelDoc) Then $mainGUI = GUICreate("viewer", @DesktopWidth - 50, @DesktopHeight - 150, 10, 10, $WS_MINIMIZEBOX +$WS_SYSMENU);, $WS_CLIPCHILDREN) $GUI_ActiveX = GUICtrlCreateObj($oExcelDoc, 10, 70, @DesktopWidth - 75, @DesktopHeight - 260) ;------------------ ;Turns off all command bars in excel to prevent user from making changes For $Bar In $oExcelDoc.CommandBars If $Bar.Enabled = True Then $Bar.Enabled = False If $Bar.Visible = True Then $Bar.Visible = False Next $oExcelDoc.Application.DisplayFormulaBar = False $oExcelDoc.Application.CommandBars("Shadow Settings").Visible = False $oExcelDoc.Application.DisplayScrollBars = True $oExcelDoc.Application.DisplayStatusBar = False Is there a different way to embed the object so that it won't get corrupted when this happens? Or a way to refresh the screen? Edited November 3, 2008 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/
Bert Posted November 3, 2008 Author Posted November 3, 2008 Never mind. I just figured out what I did...I needed to do this: $mainGUI = GUICreate("viewer", @DesktopWidth - 50, @DesktopHeight - 150, 10, 10, $WS_MINIMIZEBOX +$WS_SYSMENU + $WS_CLIPCHILDREN) The Vollatran project My blog: http://www.vollysinterestingshit.com/
dbzfanatic Posted November 3, 2008 Posted November 3, 2008 I don't know about a different embed method but why not just set it to always on top or send a $WM_PAINT message to redraw the window so there isn't any corruption. If the window is active then don't send, if it's not the active window get ready and when it's active again send the message,just my idea. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
footswitch Posted July 7, 2011 Posted July 7, 2011 Hey there. Updated code: #include <WindowsConstants.au3> $FileName = @ScriptDir&'\book1.xlsx' If Not FileExists($FileName) Then MsgBox(0, "ERROR", "File not found") Exit EndIf ;Basic GUI $oExcelDoc = ObjGet($FileName); Get an excel Object from an existing filename If IsObj($oExcelDoc) Then $mainGUI = GUICreate("viewer", @DesktopWidth - 50, @DesktopHeight - 150, 10, 10, $WS_MINIMIZEBOX +$WS_SYSMENU + $WS_CLIPCHILDREN) $GUI_ActiveX = GUICtrlCreateObj($oExcelDoc, 10, 70, @DesktopWidth - 75, @DesktopHeight - 260) Else MsgBox(0,"","failed") EndIf ;------------------ ;Turns off all command bars in excel to prevent user from making changes For $Bar In $oExcelDoc.CommandBars If $Bar.Enabled = True Then $Bar.Enabled = False If $Bar.Visible = True Then $Bar.Visible = False Next $oExcelDoc.Application.DisplayFormulaBar = False $oExcelDoc.Application.CommandBars("Shadow Settings").Visible = False $oExcelDoc.Application.DisplayScrollBars = True $oExcelDoc.Application.DisplayStatusBar = False GUISetState() While 1 Sleep(500) WEnd Any hints as to make this work without the toolbars and so forth? Just the cells... Regards, footswitch
Donnovan Posted October 9, 2011 Posted October 9, 2011 This, in VBA, make the Excel to show only the grid cells: Application.DisplayFullScreen = True I added the line "$oExcelDoc.Application.DisplayFullScreen = True" and got a error from Autoit. Not sure why.
CrimsonTide Posted December 29, 2011 Posted December 29, 2011 This, in VBA, make the Excel to show only the grid cells: Application.DisplayFullScreen = TrueI added the line "$oExcelDoc.Application.DisplayFullScreen = True" and got a error from Autoit. Not sure why. Add "$oExcelDoc.Application.DisplayFullScreen = True" before Guictrlcreateobj is called
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