Remarks
The WindowFromPoint function does not retrieve a handle to a hidden or disabled window, even if the point is within the window. An application should use the ChildWindowFromPoint function for a nonrestrictive search.
我是2001 July的msdn。
上面有个例子,好好看看:
Interface from Running Object Table
A running object table (ROT) tells what object instances are active. By querying this table, you can accelerate the process of connecting a client to an object when the object is already running. Before programs can access TOM interfaces through the running object table, a TOM instance with a window needs to register in the ROT using a moniker. You construct the moniker from a string containing the hexadecimal value of its HWND. The following code sample shows how to do this.
// This TOM implementation code is executed when a new windowed
// instance starts up.
// Variables with leading underscores are members of this class.
OLECHAR szBuf[10]; // Place to put moniker
MONIKER *pmk;
wsprintf(szBuf, "%x", _hwnd);
CreateFileMoniker(szBuf, &pmk);
OleStdRegisterAsRunning(this, pmk, &_dwROTcookie);
....................
// Accessibility Client:
// Find hwnd for window pointed to by mouse cursor.
GetCursorPos(&pt);
hwnd = WindowFromPoint(pt);
// Look in ROT (running object table) for an object attached to hwnd