![]() |
![]() OCAU News - Wiki - QuickLinks - Pix - Sponsors |
|
|||||||
| Notices |
|
Sign up for a free OCAU account and this ad will go away! Search our forums with Google: |
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Member
Join Date: Mar 2007
Posts: 1,880
|
Code:
int len = GetWindowTextLength(GetDlgItem(hwnd, IDC_SENDBOX)); LPSTR buffer=(LPSTR)GlobalAlloc(GPTR, len + 1); SendMessage(GetDlgItem(hwnd, IDC_SENDBOX),WM_GETTEXT,(WPARAM)len+1,(LPARAM)buffer); MessageBoxA(hwnd,buffer,"you typed",0); comPort->txString(buffer); comPort->txChar(0); return true; } The problem seems to lie in The SendMessage line, but i don't understand where i went wrong. |
|
|
|
| Join OCAU to remove this ad! |
|
|
#2 |
|
Member
Join Date: Mar 2007
Posts: 1,880
|
not many winapi programmer's out there huh? lol.
Dayum i really wish i could figure this out, it would be so helpful in debugging. (figured out my debugging stuff for my uP. though i still want to finish this project). It's going to be a lightweight serial-only, communicator. I've already got port selection and TX'ing down, i just need to get input from the user (into that buffer), and recieve it. Then i'll add baud/parity etc etc. Anyone on OCAU is free to use the program. (i'm making it cause hyperterminal is buggy, and now hard-locks my pc). Last edited by bojo; 24th January 2008 at 11:06 PM. |
|
|
|
|
|
#3 |
|
Member
Join Date: Mar 2007
Posts: 1,880
|
well by using malloc instead of globalalloc, it kinda works.
Though i have jibberish like hell. |
|
|
|
|
|
#4 | |
|
Member
Join Date: Nov 2005
Location: Bankstown, NSW
Posts: 29
|
Quote:
try getting the result of your SendMessage() e.g. LRESULT lRes = SendMessage(blah); what does that return? can't pin point any obvious problems based on what you've posted. what's "hwnd"? is that a valid window handle? is that the handle to the dialog that contains your text box?? its a bit hard to debug looking at a few lines of code...so many things could go wrong.. i'm happy to have a look at it if you want to post/PM the source code/project. anyway, good luck. |
|
|
|
|
|
|
#5 |
|
Member
Join Date: Mar 2007
Posts: 1,880
|
Killer i perservered. figured out the example i chose to base it off was for a dialog.
Slightly modified the commands and now we are golden. Rx'ing to come and then i'll release an alpha, for the one person who-ever reads this |
|
|
|
|
|
#6 |
|
RIP
Join Date: Jun 2003
Location: Melbourne
Posts: 3,452
|
Are you trying to read a password field?
I'm not sure that you can read password fields with a program like this. |
|
|
|
|
|
#7 |
|
Member
Join Date: Mar 2007
Posts: 1,880
|
I was just trying to read the data from a control/window. (editbox).
Figured it out, for some reason i was treating it as a dialog when it wasn't. Nutted it all out but. The only problem i'm having is when i "capture" VK_RETURN, i get a terminal bell (beep). Freaking annoying, i know it's being cause by the box being 1 line/ 2 end of line if multiline. But i have no idea how to remove it. It seems that the VK_RETURN is always passed through, even if i "capture" it and do nothing about it. Even if i change the behaviour to a button for "SEND", i'm still going to have this problem, VK_RETURN at end of textbox = terminal beep. Anyone have any creative ideas?. I thought it might exist in the callback function, but changing it's return values hasn't had much effect. Things i've tried are, return 0, return true, return false, return default behaviour. All things beep damnit!!! |
|
|
|
![]() |
| Bookmarks |
|
Sign up for a free OCAU account and this ad will go away! |
| Thread Tools | |
|
|