请问如何 将 shell 调用的程序界面显示在 当前 的mid窗口内呢?
解决方案 »
- 问个SQL语句的基础语法问题,在线等啊。
- 我想用waveInOpen函数,但总提示32号错误(不支持指定的格式或无法解释指定的格式。请使用“能力”功能来确定所支持的格式)为什么,如何
- 大家帮忙把这个dephi程序转换成VB语言,就6.0吧.我不懂dephi的
- 原理探讨:对象的创建,生存周期和执行效率的问题
- 远程数据库增量添加数据问题
- 数组下标越界,为何?谁给看一下
- 有方法获取窗体的状态信息吗?
- 我用VB6生成的dll,不能加入到注册表,出现如下提示, 无法导入ppp.dll,指定的文件不是注册脚本。你在注册表编辑器中只能导入二进位注册文件,高手指点谢谢
- 有过实际编程经验的人请进(关于建筑工程预结算)
- VB+中专生能找到工作吗?
- 请问如何在richtextbox里面实现如word里面一样的有回车标记的功能
- 我用了SELTEXT是RICHTEXTBOX中的字体发生了改变,可是随后输入的字符也随着改变,如何,不随着改变呢?
Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As Long) As Long
Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long' Return the window handle for an instance handle.
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
Private Calc_OldParent&
Private Notepad_Hwnd&
Private Calc_Hwnd&
Private Sub mnuClose_Click()
Unload Me
End SubPrivate Sub mnuOpenCalc_Click()
Dim pid As Long
Dim buf As String
Dim buf_len As Long
Dim styles As Long pid = Shell("calc.exe", vbNormalFocus)
If pid = 0 Then
MsgBox "Error starting program"
Exit Sub
End If Calc_Hwnd& = InstanceToWnd(pid) Calc_OldParent& = SetParent(Calc_Hwnd&, Me.hwnd) mnuOpenCalc.Enabled = False
mnuResCalc.Enabled = True
End SubPrivate Sub mnuOpenNotepad_Click()
Dim pid As Long
Dim buf As String
Dim buf_len As Long
Dim styles As Long pid = Shell("notepad.exe", vbNormalFocus)
If pid = 0 Then
MsgBox "Error starting program"
Exit Sub
End If Notepad_Hwnd& = InstanceToWnd(pid) Notepad_OldParent& = SetParent(Notepad_Hwnd&, Me.hwnd) mnuOpenNotepad.Enabled = False
mnuResNotepad.Enabled = True
End SubPrivate Sub mnuResCalc_Click()
SetParent Calc_Hwnd&, Calc_OldParent& mnuOpenCalc.Enabled = True
mnuResCalc.Enabled = False
End SubPrivate Sub mnuResNotepad_Click()
SetParent Notepad_Hwnd&, Notepad_OldParent& mnuOpenNotepad.Enabled = True
mnuResNotepad.Enabled = False
End Sub