| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 940 人关注过本帖
标题:怎样使程序在指定窗体中显示?
只看楼主 加入收藏
思考
Rank: 1
等 级:新手上路
威 望:1
帖 子:66
专家分:0
注 册:2007-9-29
收藏
 问题点数:0 回复次数:4 
怎样使程序在指定窗体中显示?
怎样使程序在指定窗体中显示?以前看见过,找不到了
搜索更多相关主题的帖子: 窗体中 
2008-08-17 15:58
思考
Rank: 1
等 级:新手上路
威 望:1
帖 子:66
专家分:0
注 册:2007-9-29
收藏
得分:0 
解决了
2008-08-17 17:16
xly8666
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-9-17
收藏
得分:0 
怎么做到的。。我也想过这个问题。。共享一下。。谢了啊。。
2008-09-17 18:38
我是菜鸟哦
Rank: 6Rank: 6
等 级:贵宾
威 望:22
帖 子:921
专家分:209
注 册:2007-5-4
收藏
得分:0 
对,分享一下呗

偶是菜鸟鸟偶惧WHO?!!!!
2008-09-17 18:47
三断笛
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:31
帖 子:1621
专家分:1617
注 册:2007-5-24
收藏
得分:0 
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-09-17 23:06
快速回复:怎样使程序在指定窗体中显示?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.036370 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved