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


//声明:

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;
//效果图:
WinAPI: GetParent - 获取指定窗口的父窗口句柄

你可能感兴趣的:(api)