VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get Text Method by Project SP

by Salman Paji (5 Submissions)
Category: Windows API Call/Explanation
Compatability: VB Script
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

A Simple API Method Of Getting Text From Your Selected Window...

API Declarations
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessageString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Const WM_GETTEXT = &HD

Rate Get Text Method by Project SP

Private Function ProjectSPGetText(Window2GetTextFrom As Long) As String
Dim GetBanner As String * 256
If Window2GetTextFrom <> 0 Then
Call SendMessageString(Window2GetTextFrom, WM_GETTEXT, 256, GetBanner)
'Gets The Text, And Saves The Text in a String Called : GetBanner
DoEvents
'This Make Sure That The GetText Method Is Completed Before The Next Step
ProjectSPGetText = GetBanner
'Then This Shows The Saved String From The GetText Method And Shows in The Text Box, Or You Can Also Use a RichTextBox
Else
MsgBox "The Room Window Or Control Is Not Open...", vbInformation
'If The Room is Not Open, This Messege Will Popup as a Information
End If
End Function

Download this snippet    Add to My Saved Code

Get Text Method by Project SP Comments

No comments have been posted about Get Text Method by Project SP. Why not be the first to post a comment about Get Text Method by Project SP.

Post your comment

Subject:
Message:
0/1000 characters