Visual Studio Development Bookmark and Share   
 index > Visual Studio Tools for Office > Excel 2007 Title bar disappears
 

Excel 2007 Title bar disappears

I'm working on a Excel Document Customization project and I've found that occasionally the Excel's title bar gets messed up.
See screenshot: http://cid-461780d974c4f1b6.skydrive.live.com/self.aspx/Public/Screenshots/Excel2007TitleBarIssue.png
It's not something that could be easily reproduced, as the same steps don't necessarily cause the issue every time.

I'm not sure whether this is anything related to the customization as I've there seem to be others who've encountered something similar (http://www.eggheadcafe.com/software/aspnet/34714589/excel-displayrefresh-pro.aspx ).

Does anyone have insight in to this problem?
Any information would be appreciated.

In case it's useful few things to note about the customization code:
1. It does use Globals.ThisWorkbook.Application.ScreenUpdating = true/false often, but always does leave it set to true when it's done with a method (generally called set in a finally block).
2. Some Win Forms dialog boxes created by the customization have custom drawn/user drawn controls.
sameera  Thursday, October 15, 2009 8:36 AM

Hello sameera,

Welcome to MSDN forums!

I've looked at your screen shot, but if we could not find a way to reproduce issue we not be able to reach the root cause of this issue easily.

However, let's try to narrow the issue down first. As the screen shot shows I'm not sure if the issue is caused by your customization, so, does this issue remains if you turn off your customization? Is there any other application level add-in is enabled in your Excel? When this appears what happens if you move Excel window or minimum/maximum Excel window? Will the issue disappear?

Anyway, we could try to force whole window redraw, this may help the issue?

        [DllImport("user32.dll")]
        static extern bool InvalidateRect(IntPtr hWnd, RECT lpRect, bool bErase);
        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
        [DllImport("user32.dll")]
        static extern bool UpdateWindow(IntPtr hWnd);

        [StructLayout(LayoutKind.Sequential)]
        public struct RECT
        {
            public int Left;
            public int Top;
            public int Right;
            public int Bottom;
        }

             RECT rec;
            GetWindowRect(Process.GetCurrentProcess().MainWindowHandle, out rec);
            InvalidateRect(Process.GetCurrentProcess().MainWindowHandle, rec, false);
            UpdateWindow(Process.GetCurrentProcess().MainWindowHandle);
           
Hope this helps you.

Thanks.

Tim Li

MSDN Subscriber Support in Forum

If you have any feedback on our support, please contact EMAIL GONE


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Tim Li  Friday, October 16, 2009 5:59 AM
Hi,


I am writing to check the status of the issue on your side. Could you please let me know if the suggestion works for you or not? If you have any questions or concerns, please feel free to let me know. I will be more than happy to be of assistance.

Tim Li

MSDN Subscriber Support in Forum

If you have any feedback on our support, please contact msdnmg@microsoft.com


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Tim Li  Monday, October 19, 2009 2:32 AM
Hi Tim,

The screenshot was from a client's computer. I too have seen this at times but, I'm not sure how exactly to repo it either. I was hoping somebody else would have run in to it. What I can easily repo is when I run a long running method (macro or VSTO). At this point the classic Windows title bar appear overlapping the Excel title bar:

http://cid-461780d974c4f1b6.skydrive.live.com/self.aspx/Public/Screenshots/Issue^_as^_reproduced.png

But, generally this goes off when the process ends. Maybe these are related and something obstructs the refreshing of the toolbar on certain situations. I guess, we'd have to leave it at that till I find exactly how to reproduce it or if somebody else encounters it.

Thanks for taking the time to check the issue.
sameera  Monday, October 19, 2009 3:53 AM

You can use google to search for other answers

Custom Search

More Threads

• Facing a Serious problem with Mail Merge using C#
• Regular Expressions in VSTO Office development
• Complex data in RichTextContentControl
• Sub "goes away"
• please suggest me
• Word Publish: The Web server does not appear to have the FrontPage server extensions installed
• Convert XLSX to XPS
• Can not open published project
• How To List Worksheets of an Excel File in C#?
• Word.Application.WindowBeforeRightClick is not raised when right-clicking picture content controls