一个"子"窗体"a", 不是 MIDChild
可以在多个 "父" 窗体中打开它, 当然不是同时 -->   a.show 1,ME  在窗体 "a" 中如何判断它的 "父窗体" 名称

解决方案 »

  1.   

    Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As LongPrivate Sub Command1_Click()
    Dim hwd As Long
    Dim MyStr As String
    MyStr = String(100, Chr$(0))
    hwd = GetParent(Command1.hwnd)  ' 得到父窗口句柄
    GetWindowText hwd, MyStr, 100   ' 得到父窗口标题
    MyStr = Left$(MyStr, InStr(MyStr, Chr$(0)) - 1)
    MsgBox MyStr
    End Sub
      

  2.   

    有点不明白,   我在  B 窗体中  a.show 1, me  这样的方式打开 a 窗体   然后我想在 a 窗体中判断 B 窗体的名称,   如何我在 a 窗体中放一个按钮 command1    hwd = GetParent(Command1.hwnd)  这样得到只是 a 窗体的句柄呀