How would i use WM_SETTEXT with SendMessage?????:confused: :confused: :confused: I currently have the code:
but that warrants no effect( and yes i have the API Declared with The Const )Code:retval& = SendMessage(me.hWnd, WM_SETTEXT, 0&, "Hello")
Printable View
How would i use WM_SETTEXT with SendMessage?????:confused: :confused: :confused: I currently have the code:
but that warrants no effect( and yes i have the API Declared with The Const )Code:retval& = SendMessage(me.hWnd, WM_SETTEXT, 0&, "Hello")
You need to pass "Hello" ByVal (by value).
Thanks for the Help, Worked Fine ( without the ByVal i would get a string of 3 cryptic characters )
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.
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).