现在的位置: 首页 > 综合 > 正文

WinAPI: GetParent – 获取指定窗口的父窗口句柄

2012年12月01日 ⁄ 综合 ⁄ 共 398字 ⁄ 字号 评论关闭
//声明:
GetParent(
  hWnd: HWND {窗口句柄}
): HWND;     {返回父窗口句柄}

//举例: procedure TForm1.Button1Click(Sender: TObject); var h1,h2: HWND; begin h1 := GetParent(Button1.Handle); h2 := Panel1.Handle; ShowMessage(IntToStr(h1)); {590862} ShowMessage(IntToStr(h2)); {590862} h1 := GetParent(Panel1.Handle); h2 := Self.Handle; ShowMessage(IntToStr(h1)); {459824} ShowMessage(IntToStr(h2)); {459824} ShowMessage(IntToStr(GetParent(Handle))); {0} end;
//效果图:



抱歉!评论已关闭.