none
How do I go about using SendMessage or such to retrieve the contents of a Windows Form box which Spy++ calls a VSFlexGrid8L RRS feed

  • Question

  • This works for some, but it doesn't work for VSFlexGrid8L boxes for some reason...

                       NumText = SendMessage(myControl, WM_GETTEXT, 50, Handle1)

                       str = Marshal.PtrToStringUni(Handle1)

    I also tried this which gives a ptr, but I don't know if I am on the right track...

                       ptr = GetWindowLong(myControl, GWL_STYLE)         '  "Window Styles"

     

    Thanks for any leads!

    cellurl

    Tuesday, September 25, 2012 4:18 PM

Answers

All replies

  • There are two different type of controls.  The older Active X controls and the newer Form Controls.  I suspect that the older Active X Controls work with the Windows interface., but not the new Forms Controls.  Not 100% sure.

    jdweng

    Tuesday, September 25, 2012 6:44 PM
  • Q: Do I have to find the rectangle size first??

       Dim b As IntPtr = Marshal.AllocHGlobal(100)
       Dim myrect As New RECT
       Dim asdf As New HandleRef(b, hWnd) '? is this right?          

       result = GetWindowRect(asdf, myrect)

    Thanks for helping!





    • Edited by carterson3 Tuesday, September 25, 2012 7:48 PM
    Tuesday, September 25, 2012 7:46 PM
    • Marked as answer by carterson3 Monday, October 8, 2012 1:50 PM
    Tuesday, September 25, 2012 8:47 PM
  • Q: Do I have to find the rectangle size first??

       Dim b As IntPtr = Marshal.AllocHGlobal(100)
       Dim myrect As New RECT
       Dim asdf As New HandleRef(b, hWnd) '? is this right?          

       result = GetWindowRect(asdf, myrect)

    Thanks for helping!





    Hi Carterson,

    Welcome to the MSDN Forum.

    According to the PInvoke declaration, yes, it is correct.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, September 26, 2012 11:38 AM
    Moderator