Return Excel's application window handle
[C++]
static HWND XlHwnd();
The handle to Excel's application window. If a modal dialog is being shown by Excel,
then this function will return the handle of the dialog window instead.
In either case the return value is a useful handle to use an ancestor for your own windows
or as an argument to Windows API calls.
Since this function is static, it is not necessary to use an instance of CXllApp to invoke it.
It is not therefore necessary to fix the MFC CWinApp instance using the XLL_FIX_STATE macro:
you can use code such as:
hwnd = CXllApp::XlHwnd();
It is not usually necessary to call this function to retrieve arguments for MFC functions. The CExcelWnd class will automatically attach itself to the Excel application window when it is constructed; this is the preferred interface between Excel and MFC windows.
Header: xllplus.h