How to change a Window Owner using its handle

廉价感情. 提交于 2019-11-30 13:06:37
Joel Lucsy

I think you're looking for is to P/Invoke SetWindowLongPtr(win32window, GWLP_HWNDPARENT, formhandle)

Google Search

Yes! I've already have a P/Invoke import of SetWindowLongPtr (which is x64 safe). And using Reflector I searched upon the Form.Owner property ( i.e. the get_Owner(Form value) method ) and managed to change the owner with

SetWindowLongPtr(childHdl, -8, OwnerHdl)

I was looking what the -8 (0xFFFFFFFFFFFFFFF8) meant before I could post the solution here, but Joel has already pointed it out.

Thanks!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!