Last modified: March 18, 2009
Applies to: Excel 2010 | Office 2010 | VBA | Visual Studio
Returns the window handle of the top-level Microsoft Excel window.
This function is useful for writing Windows API code.
When you call this function using Excel4 or Excel4v, the returned XLOPER integer variable is a signed 16-bit short int. This is only capable of containing the low 16 bits of the 32-bit Windows handle. To find the high part, your code must iterate through all open windows looking for a match with the low part. Starting in Excel 2007, the integer variable of the XLOPER12 is a signed 32-bit int and therefore contains the entire handle, removing the need to iterate all open windows.
See the code for the fShowDialog function in SAMPLES\GENERIC\GENERIC.C.