Search Tools Links Login

Get Text Method by Project SP


Visual Basic 6, or VB Classic

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

Original Author: Salman Paji

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

Code

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

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 113 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.