im newbie.. =) i want make a serial port emulator like Hyper terminal, use Richedit control. if i receive a character from another port, i must put the char on the Richedit. but i have i problem. my riched client was all deleted..! and only ONE charactor put on the riched.. my source code like it.. (receive a char from COM2 and put COM1 rich edit <- my app) its only receive thread proc.. ; ThreadProc proc invoke SetCommMask,hCom,EV_RXCHAR @@: invoke ClearCommError,hCom,addr ReturnCode,addr comstat .if(comstat.cbInQue) mov nsaCount,0 invoke WaitCommEvent,hCom,addr CommEvent,NULL invoke ReadFile,hCom,addr ReceiveBuffer,comstat.cbInQue,addr nsaCount,NULL invoke SetWindowText,hRich,addr ReceiveBuffer .endif loop @b ret ThreadProc endp ; may be .. i need SendMessage func, rather than SetWindowText func.. but i cant use that.. need help..........
Posted on 2001-07-03 02:45:00 by c][obo
c][obo, You're nearly there, but think about what SetWindowText does - it sets the text of the window to what you tell it. What you need is AppendWindowText - but before you go looking for it, I'm afraid it doesn't exist. There are two ways of doing this, the first, an probably easiest, is to send a WM_CHAR message using the character received to the RichEdit control, simple. But it has it's drawbacks, if you receive 10K/sec from you program, you're going to make RichEdit jump through the WM_CHAR hoop 10,000 times, it will be really slow..... Instead, you could use GetWindowText, to retrieve the text from the window, append you new text to this, using lstrcmp, then do a SetWindowText with the whole new buffer. umbongo
Posted on 2001-07-03 03:53:00 by umbongo
umbongo, I'm sure, you mean lstrcat instead of lstrcmp :D
Posted on 2001-07-03 13:44:00 by bazik