How to get handle of the current workbook's window?
How to get handle of the main window of 开发者_C百科the current workbook?
Actually, there is only one window that mimics multi-window behavior; thus, getting Application.Hwnd is enough
Since this question is labeled with VSTO, I suppose the author is looking for means to get a handle of the current window in VSTO code. In C#, try:
Globals.ThisAddIn.Application.ActiveWindow
Are you talking about the actual HWND? If so, I'd use WinSpy++ with the pointer tool to ID the window. That'll give you the handle, but more importantly, the class ID of the window, so that you can use ENUMWINDOWS to enumerate through all of excel's Child windows to find those of that particular class.
精彩评论