使用窗口句柄作为 VB6 窗体的所有者 [英] Use a window handle as an owner for a VB6 form

查看:30
本文介绍了使用窗口句柄作为 VB6 窗体的所有者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Form2.Show vbModeless, Form1 的 Win32 等效项是什么,它允许我将所有者(而不是父项)设置为任意 hWnd 并设置默认位置等?
据我所知,这只能在创建窗口时设置.

解决方案

我不确定您要完成什么,但我认为您可能正在寻找 SetParent 函数.

>

Declare Function SetParent Lib "user32.dll" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

hWndChild 是子窗口的句柄.
hWndNewParent 是新父级的句柄.传递 null(如果我没记错的话是 0)以使桌面成为所有者.

您可以在此处找到有关它的更多信息.

What is the Win32 equivalant of Form2.Show vbModeless, Form1 that allows me to set the owner (not the parent) to an arbitrary hWnd and set the default position, etc?
As far as I'm aware, this can only be set when creating a window.

解决方案

I'm not sure what you are trying to accomplish, but I think you might be looking for the SetParent function.

Declare Function SetParent Lib "user32.dll" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

hWndChild is the handle to the child window.
hWndNewParent is the handle to the new parent. Pass null (0 if I remember correctly) to make the desktop the owner.

You can find more information about it here.

这篇关于使用窗口句柄作为 VB6 窗体的所有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆