The GetParent function retrieves a handle to the specified window's parent or owner.

To retrieve a handle to a specified ancestor, use theGetAncestorfunction.

//该函数返回的是指定子窗口的父窗口的句柄,其中,参数hWnd为子窗口的句柄

 

Syntax

HWND GetParent(      

    HWND hWnd );

Parameters

hWnd[in] Handle to the window whose parent window handle is to be retrieved.  

举个例子来说:你在对话框中添加了一个Edit的控件,通过GetDlgItem( int ID)你能获得该控件的句柄,如果你想获得该对话框的句柄,就能以GetParent( GetDlgItem(ID))来实现,也就是说,获得的是子窗口所在的父窗口的句柄。

相关文章:

  • 2021-10-14
  • 2022-02-19
  • 2021-12-25
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2021-10-20
  • 2022-01-31
相关资源
相似解决方案