Results 1 to 5 of 5

Thread: Help With WM_SETTEXT and SendMessage API

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    On The Internet
    Posts
    10

    Question Help With WM_SETTEXT and SendMessage API

    How would i use WM_SETTEXT with SendMessage????? I currently have the code:


    Code:
    retval& = SendMessage(me.hWnd, WM_SETTEXT, 0&, "Hello")
    but that warrants no effect( and yes i have the API Declared with The Const )
    Last edited by Spaz; Jul 13th, 2001 at 02:42 PM.
    AvengerX
    AKA
    Spaz

    11 Years Old

  2. #2
    Megatron
    Guest
    You need to pass "Hello" ByVal (by value).

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    On The Internet
    Posts
    10

    Thumbs up Thanx

    Thanks for the Help, Worked Fine ( without the ByVal i would get a string of 3 cryptic characters )
    AvengerX
    AKA
    Spaz

    11 Years Old

  4. #4
    Megatron
    Guest
    Your welcome.

    The reason you were getting those crypting characters was because WM_SETTEXT is taking the actual value. When you pass an address, it think the address number is the value.

  5. #5
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    It might work better if you ignore those "X As Any" and "X As SomeUDT" parameters, and change them to "ByVal X As Long", and then send in VarPtr(something), or StrPtr(somestring), since it's operating on the addresses anyway. Then you don't have to stick ByVal in front of any parameter you use in a function where it appears As Any in the declaration. There could be cases where the function might allow for you to pass in NULL under certain conditions, and if the param itself is a UDT, you may not want to have to include the type for the param. The only one I can think of as an example is CreateDC. One of the params is a DEVMODE struct, but if you just want to create a display DC, you give it NULL. If you change the param to "ByVal lpDevmode As Long", you can just give it 0 in that position, and it won't think you're trying to give it an initialization struct. And then you don't need to include the DEVMODE type in the module (since it's not even needed for making up a display DC).
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

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