| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付买域名,送MP3、MP4
高端软件开发 = 年薪十万不是梦赛孚耐:软件保护加密专家身份认证令牌USB KEY买空间,免费送域名(厦门中资源)
共有 284 人关注过本帖
标题:怎样使程序在指定窗体中显示?
收藏  订阅  推荐  打印 
思考
Rank: 2
等级:注册会员
威望:1
帖子:62
积分:738
注册:2007-9-29
怎样使程序在指定窗体中显示?

怎样使程序在指定窗体中显示?以前看见过,找不到了
搜索更多相关主题的帖子: 窗体中  
2008-8-17 15:58
思考
Rank: 2
等级:注册会员
威望:1
帖子:62
积分:738
注册:2007-9-29

解决了
2008-8-17 17:16
xly8666
Rank: 1
等级:新手上路
帖子:1
积分:114
注册:2008-9-17

怎么做到的。。我也想过这个问题。。共享一下。。谢了啊。。
2008-9-17 18:38
我是菜鸟哦
Rank: 12Rank: 12Rank: 12
等级:版主
威望:11
帖子:676
积分:7582
注册:2007-5-4

对,分享一下呗

偶是菜鸟鸟偶惧WHO?!!!!
2008-9-17 18:47
三断笛
Rank: 12Rank: 12Rank: 12
等级:版主
威望:9
帖子:928
积分:10263
注册:2007-5-24

Public Declare Function SetParent Lib "USER32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Function InstanceToWnd(ByVal target_pid As Long) As Long
    Dim test_hwnd As Long
    Dim test_pid As Long
    Dim test_thread_id As Long

    ' Get the first window handle.
    test_hwnd = FindWindow(ByVal 0&, ByVal 0&)

    ' Loop until we find the target or we run out
    ' of windows.
    Do While test_hwnd <> 0
        ' See if this window has a parent. If not,
        ' it is a top-level window.
        If GetParent(test_hwnd) = 0 Then
            ' This is a top-level window. See if
            ' it has the target instance handle.
            test_thread_id = GetWindowThreadProcessId(test_hwnd, test_pid)

            If test_pid = target_pid Then
                ' This is the target.
                InstanceToWnd = test_hwnd
                Exit Do
            End If
        End If

        ' Examine the next window.
        test_hwnd = GetWindow(test_hwnd, GW_HWNDNEXT)
    Loop
End Function

Sub RunSubExe(hwnd As Long, FileName As String)
    Dim Exe_Hwnd As Long
    Dim Exe_OldParent As Long
    Dim pid As Long
    Dim buf As String
    Dim buf_len As Long
    Dim styles As Long
    On Error Resume Next
    pid = Shell(FileName, vbNormalFocus)
    If pid = 0 Then
        MsgBox "打开程序错误!", vbExclamation, "提示"
        Exit Sub
    End If
    Exe_Hwnd = InstanceToWnd(pid)
    Exe_OldParent = SetParent(Exe_Hwnd, hwnd)
End Sub

滚滚红尘中的白痴..........
2008-9-17 23:06
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.050028 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved