VBScript code to extract Window title
-
I need a script to get the name or path on a active window opened.This i need to run on a Pop-up Web page opened to display an Image.This image i have uploaded to this site. The Pop-up window does not include a Address to copy the path. I need a VBscript to automatically get the title so the i can put it in clip board.
Praveen
-
I need a script to get the name or path on a active window opened.This i need to run on a Pop-up Web page opened to display an Image.This image i have uploaded to this site. The Pop-up window does not include a Address to copy the path. I need a VBscript to automatically get the title so the i can put it in clip board.
Praveen
-
You can use FindWindow function within user32.dll. It will return window name and handle. I am not sure how to impliment it
The VB code below tries to get the Window title character for the First Active Window. I have error Poping up on my screen when I run this. Error "No Creatable Public Component detected" " MSDN Collection Doesn't Exits" What i need to do to get ride of this error? Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, _ ByVal wCmd As Long) As Long Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _ (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Public Declare Function GetWindowThreadProcessId Lib "user32" _ (ByVal hwnd As Long, lpdwprocessid As Long) As Long Private Sub Command1_Click() Dim tempHWin As Long Dim StringDisplay As String Dim CountOfBytes As Integer Dim Buffer As String Dim Instnace As Long tempHWin = FindWindow(vbNullString, vbNullString) Buffer = Space$(128) CountOfBytes = GetWindowText(tempHWin, Buffer, Len(Buffer)) Instance = ProcIDFromWnd(tempHWin) StringDisplay = StringDisplay & Left$(Buffer, CountOfBytes) & tempHWin & Instance Text1 = StringDisplay End Sub Function ProcIDFromWnd(ByVal hwnd As Long) As Long Dim idProc As Long ' Get PID for this HWnd GetWindowThreadProcessId hwnd, idProc ' Return PID ProcIDFromWnd = idProc End Function
Praveen