Results 1 to 5 of 5

Thread: WM_GETEXT/WM_SETEXT problems

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288

    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.

  2. #2
    Megatron
    Guest
    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.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    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.

  4. #4
    jim mcnamara
    Guest
    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?

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    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:
    1. 'In a Form
    2. Option Explicit
    3.  
    4. Private Declare Function GetWindowLong Lib "user32" Alias _
    5. "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
    6.  
    7. Private Declare Function SetWindowLong Lib "user32" Alias _
    8. "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
    9. ByVal dwNewLong As Long) As Long
    10.  
    11. Private Const GWL_WNDPROC = (-4)
    12.  
    13. Private lngRV As Long
    14.  
    15. Private Sub Command1_Click()
    16.     Debug.Print Text1.Text
    17. End Sub
    18.  
    19.  
    20. Private Sub Form_Load()
    21.     lngPrevWndProc = SetWindowLong(Text1.hWnd, GWL_WNDPROC, AddressOf WindowProc)
    22. End Sub
    23.  
    24. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    25.     Call SetWindowLong(Text1.hWnd, GWL_WNDPROC, lngPrevWndProc)
    26. End Sub
    27.  
    28. 'In a standard module
    29. Option Explicit
    30.  
    31. Public lngPrevWndProc As Long
    32.  
    33. Private Const WM_GETTEXT = &HD
    34. Private Const WM_SETTEXT = &HC
    35. Private Const EM_GETLINE = &HC4
    36.  
    37.  
    38. Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
    39. (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, _
    40. ByVal wParam As Long, ByVal lParam As Long) As Long
    41.  
    42. Public Function WindowProc(ByVal hw As Long, ByVal uMsg As Long, ByVal wParam As Long, _
    43. ByVal lParam As Long) As Long
    44.  
    45.     Select Case uMsg
    46.         Case EM_GETLINE
    47.             Debug.Print hw & ";" & uMsg & ";" & lParam & ";" & wParam
    48.         Case WM_GETTEXT
    49.             Debug.Print hw & ";" & uMsg & ";" & lParam & ";" & wParam
    50.         Case WM_SETTEXT
    51.             Debug.Print hw & ";" & uMsg & ";" & lParam & ";" & wParam
    52.         Case 4110
    53.             Debug.Print hw & ";" & uMsg & ";" & lParam & ";" & wParam
    54.            
    55.         Case Else
    56.             WindowProc = CallWindowProc(lngPrevWndProc, hw, uMsg, wParam, lParam)
    57.                 Debug.Print hw & ";" & uMsg & ";" & lParam & ";" & wParam
    58.     End Select
    59.    
    60. 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
  •  



Click Here to Expand Forum to Full Width