欢迎光临:
  
  非常感谢您光临枕善居。本站是一个免费的基于VB,VB.NET源代码交流的平台,为大家提供优质的专业的源代码,如果您有需要,本站可以帮助在业余时间里给您寻找代码。当然,如果您有好的代码也可以在本站发布,共享给大家。
专业VB和.NET源码、编程开发教程、图标资源、USB电脑遥控器、智能家电控制开关....更多东东请进入我的淘宝小店--->
VB及.NET新源码2011(3DVD,控件+资源) 智能多路控制(串口编程开关) 带源码!


06-04
09

容器窗体示例

本示例演示把指定名称的任意窗体包容进来.
Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long
    
Private Const GWL_STYLE = (-16)
Private Const WS_CLIPSIBLINGS = &H4000000
Private Const WS_VISIBLE = &H10000000

Private Sub Form_Load()
    Dim Handle As Long, Ret As Long
    '获取窗体句柄
    Handle = FindWindow(vbNullString, "TheWorld") '示例手工输入窗体标题,可以参阅本站程序自动获取
    Ret = SetWindowLong(Handle, GWL_STYLE, WS_VISIBLE Or WS_CLIPSIBLINGS)
    '插入指定的窗体
    SetParent Handle, Me.hwnd
End Sub


界面:
图片来自:
网站:枕善居VB及.NET源码博客
网址http://www.mndsoft.com/blog/


相关日志:
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
评论: 6 | 引用: 0 | 查看次数: 6279

回复回复aaa111aaa [2006-08-27 16:08:22 |  | del]
好呀!
回复回复Registry [2006-04-14 22:09:42 |  | del]
清提供源代码下载!Thanks!!!
回复回复比卡超 [2006-04-14 20:46:43 |  | del]
自动获取??本站哪里有示例??
回复回复Mndsoft [2006-04-12 09:55:49 |  | del]
父窗体用的操作系统的主题界面,不是VB编写的[7]
回复回复g82tt [2006-04-12 04:32:35 |  | del]
请问楼主~那个父窗体用的是什么皮肤控件啊?能发一个给我吗?
fssoft2006@gmail.com
先谢谢啦!
回复回复7311398 [2006-04-09 13:56:18 |  | del]
主要的都是SetParent这个子窗体API!
发表评论
您没有权限发表评论!