Re: WM_GETTEXT -> EDITBOX wont get the string?

Tech-Archive recommends: Fix windows errors by optimizing your registry



I noticed that you use a buffer 'char s', but SendMessage returns the number
of TCHARs for that message type. Is there any chance you are compiled
Unicode?

Also, why not just use CWnd::SetWindowText() or CWnd::GetWindowText(). Then
you could just use a CString for your buffer and save yourself a lot of
trouble.

Tom

".rhavin grobert" <clqrq@xxxxxxxx> wrote in message
news:1159508915.158127.302550@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi there;-)

i've read alot of editbox-issues from one app to another, but im still
stuck;-[

i've the following situation in my app:
app-dialog brings up dll-dialog consisting of some stuff and a TabCtrl
with 4 pages.
one of them has an editbox were i just entered "foo". (i dont want to
post what i really
entered after 4 hours of trial-and-error;-)

if i do a...
,------------------
| std::string st = "test";
| ::SendMessage(hWnd, WM_SETTEXT, 0, (long) st.c_str());
| char s[50];
| s[::SendMessage(hQWnd, WM_GETTEXT, 50,(long) s)]=0;
`------------------
...on the Editbox i get "test" in s[]. (i expected this:) ...but if i
do just the...
,------------------
| char s[50];
| s[::SendMessage(hQWnd, WM_GETTEXT, 50,(long) s)]=0;
`------------------
...i get nothing. (s = 00 cc cc cc ...)

perhaps it's just because my OS doesnt like me anymore, but
perhaps someone could explain wat's going on here?
spy++ shows me the correct handle and also tells me that the
message was processed (it also shows me that it just returned
0 while i can still read that "foo" in the box.

thx for the fish,
-.rhavin
_____________
mfc app + dll vc6 WinXPpro



.



Relevant Pages