Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VBScript code to extract Window title

VBScript code to extract Window title

Scheduled Pinned Locked Moved Visual Basic
tools
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    B L Praveen
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • B B L 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

      J Offline
      J Offline
      jstark110
      wrote on last edited by
      #2

      You can use FindWindow function within user32.dll. It will return window name and handle. I am not sure how to impliment it

      B 1 Reply Last reply
      0
      • J jstark110

        You can use FindWindow function within user32.dll. It will return window name and handle. I am not sure how to impliment it

        B Offline
        B Offline
        B L Praveen
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups