查看: 11  |  回复: 0
  VB6 得到当前窗口的标题,子程序 GetActiveWindowTitle(ByVal ReturnParent As Boolean)
楼主
发表于 昨天 15:21

新建From1(窗体),新建Command1(按钮CommandButton),代码:

Private Sub Command1_Click()
    MsgBox GetActiveWindowTitle(True)
End Sub

Private Function GetActiveWindowTitle(ByVal ReturnParent As Boolean) As String
   Dim I As Long
   Dim j As Long
   
   I = GetForegroundWindow   
   
   If ReturnParent Then
      Do While I <> 0
         j = I
         I = GetParent(I)
      Loop
   
      I = j
   End If
   
   GetActiveWindowTitle = GetWindowTitle(I)
End Function

可以得到当前窗口的标题。

您需要登录后才可以回帖 登录 | 立即注册
【本版规则】请勿发表违反国家法律的内容,否则会被冻结账号和删贴。
用户名: 立即注册
密码:
2020-2024 MaNongKu.com