开发者

GetFirstChild in win32?

I use EnumChildWindows to get all the Child windows from the main HWND window , But i would like to get only the first child of the given HWND window.

BOOL CALLBACK EnumChildProc ( HWND hwndChild, LPARAM lParam)
{
  // logic to call only once 开发者_开发百科
}

Is it correct ? or any other simple way ?

~UK


BOOL CALLBACK EnumChildProc ( HWND hwndChild, LPARAM lParam)
{
  // process first child window
  return FALSE;
}

Alternatively, HWND top_child = GetWindow(thisWindow, GW_CHILD);


Sure:

BOOL CALLBACK EnumChildProc ( HWND hwndChild, LPARAM lParam)
{
    /* do what you want with the first HWND */

    return FALSE; // stops enumeration.
}

See MSDN for full details, but the relevant line is this:

Return Value

BOOL

To continue enumeration, the callback function must return TRUE; to stop enumeration, it must return FALSE.


GetWindow(...,GW_CHILD) will give you the window at the top of the z-order which I assume is what you are after

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜