|
-
Oct 24th, 2001, 09:29 AM
#1
Thread Starter
PowerPoster
WM_GETEXT/WM_SETEXT problems
Which message is being used when I retrieve the contents of a Text Box using Normal Vb commands?
I tried subclassing, but it doesn't sends WM_GETTEXT message to the TextBox. Instead, it sends a message with a value of 4110. This message is also sent only once untill you change the contents of the text Box.
-
Oct 24th, 2001, 11:36 AM
#2
I tried to check it with Spy++ and I didn't get anything. This is probably because the VB methods all retrieve the text from the TextBox's address space directly, rather than having a 3rd party message to do it form them.
-
Oct 24th, 2001, 01:02 PM
#3
Thread Starter
PowerPoster
But atleast once it sends a message with a value of 4110. This happens only for the first time or if you change the contents of the text box.
-
Oct 24th, 2001, 01:52 PM
#4
There are no constants that deal with WM_ or EM_ values that are 4110 (&H100E).
Here are the ones I can find:
Const SPI_GETHOTTRACKING = &H100E
Const LOCALE_SMONTHNAME13 = &H100E
Assume: this HAS to be a constant + another value.
A lot of these kinds of constants are
WM_USER + something - but these are in wParam usually.
WM_USER is &H400 (1024 DEC) - so maybe we are looking for &HC0E (3086). There isn't one that is &HC0E....
What I did to get this:
Use the APIViewer 2001 from allapi.net. Save the Win32api file as a text file, and search through it with an editor.
This is coming in as the wMsg param right? Or are we missing something?
-
Oct 24th, 2001, 02:22 PM
#5
Thread Starter
PowerPoster
Yes, this is definitely coming in wMsg Param. To confirm once again, I am posting the code that I used to get the value
VB Code:
'In a Form
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Const GWL_WNDPROC = (-4)
Private lngRV As Long
Private Sub Command1_Click()
Debug.Print Text1.Text
End Sub
Private Sub Form_Load()
lngPrevWndProc = SetWindowLong(Text1.hWnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call SetWindowLong(Text1.hWnd, GWL_WNDPROC, lngPrevWndProc)
End Sub
'In a standard module
Option Explicit
Public lngPrevWndProc As Long
Private Const WM_GETTEXT = &HD
Private Const WM_SETTEXT = &HC
Private Const EM_GETLINE = &HC4
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Public Function WindowProc(ByVal hw As Long, ByVal uMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Select Case uMsg
Case EM_GETLINE
Debug.Print hw & ";" & uMsg & ";" & lParam & ";" & wParam
Case WM_GETTEXT
Debug.Print hw & ";" & uMsg & ";" & lParam & ";" & wParam
Case WM_SETTEXT
Debug.Print hw & ";" & uMsg & ";" & lParam & ";" & wParam
Case 4110
Debug.Print hw & ";" & uMsg & ";" & lParam & ";" & wParam
Case Else
WindowProc = CallWindowProc(lngPrevWndProc, hw, uMsg, wParam, lParam)
Debug.Print hw & ";" & uMsg & ";" & lParam & ";" & wParam
End Select
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|