VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



FIND WINDOW BY ENTERING TITLE

by Md.Mafuzul Islam Mafuz (7 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 14th February 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

FIND WINDOW BY ENTERING TITLE

API Declarations


'FIND WINDOW BY ENTERING TITLE. '
'MD.MAFUZUL ISLAM MAFUZ '
'WEB:www.mafuz.com '
'E-mail:[email protected] '
'BANGLADESH '


'FINDWINDOW:>>The FindWindow function retrieves the
'handle to the top-level window whose class name and
'window name match the specified strings. This function
'does not search child windows.
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

'SETWINDOWTEXT:>>The SetWindowText function changes the
'text of the specified window's title bar (if it has one).
'If the specified window is a control, the text of the
'control is changed.
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long


Rate FIND WINDOW BY ENTERING TITLE



Private Sub Form_Load()
'::::::::::::::::::::::::::::::
'YOU HAVE TO RUN CONTROL PANEL:
'::::::::::::::::::::::::::::::

'STRING TYPE VARIABLE
Dim WinName As String 'WINDOW'S TITLE
Dim SetText As String 'TO KEEP THE WINDOW'S NEW TITLE

'ENTER THE TITLE OF WINDOW TO FIND
WinName = InputBox("Enter a window Title to find out", "Find", "Control Panel")

'ENTER THE NEW CAPTION/TITLE FOR THE WINDOW
'TO CHANGE TITLE
SetText = InputBox("Enter a new window Title", "Title", "One World One Sky")

'FINDWINDOW
'>>FindWindow(lpClassName,// pointer to class name
'            lpWindowName // pointer to window name)
res = FindWindow(vbNullString, WinName)
     If res = 0 Then
        MsgBox "Could not find:" & WinName
     End If
     
'CHANGE TITLE
'>>SetWindowText(hWnd,  // handle of window or control
'                lpString    // address of string)
Call SetWindowText(res, SetText)
End Sub


Download this snippet    Add to My Saved Code

FIND WINDOW BY ENTERING TITLE Comments

No comments have been posted about FIND WINDOW BY ENTERING TITLE. Why not be the first to post a comment about FIND WINDOW BY ENTERING TITLE.

Post your comment

Subject:
Message:
0/1000 characters