Código: Seleccionar todo

'-----------------------------------------------------------
' Function : [GetTitleActiveApp]
' Type     : [SNIPPET]
' Autor    : [The Swash]
' DateTime : [31/03/2010]
'-----------------------------------------------------------
Option Explicit

'User32 Lib Apis
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long

'SendMessage Constants
Const WM_GETTEXT = &HD
Const WM_GETTEXTLENGTH = &HE

Public Function GetTitleActiveApp() As String
Dim hRet     As Long
Dim hSpace   As Long
Dim sBuffer  As String

  hRet = GetForegroundWindow
  If hRet <> 0 Then
   hSpace = SendMessage(hRet, WM_GETTEXTLENGTH, 0&, 0&) + 1
   If hSpace > 0 Then
    sBuffer = Space$(hSpace)
    Call SendMessage(hRet, WM_GETTEXT, hSpace, sBuffer)
   End If
  End If
  
  GetTitleActiveApp = Trim(sBuffer)
     
End Function
Call:

Código: Seleccionar todo

MsgBox GetTitleActiveApp
En tu ventana
Y en tu ventana, gritas al cielo pero lo dices callada..
Muy bueno amigo. seguro que nos será útil....
Spyren Private Crypter-Binder [Autoit]
Crypter Online 0/35 (Terminado)
Responder

Volver a “Otros lenguajes”