Re: rs232-[B]
Thankyou William,
I will try this as soon as I can!
Quick question:
While I was trying stuff to solve the question in this post, I realized that
the WM_KEYDOWN handler did not pick up my keystrokes on my second window.
I have a WM_KEYDOWN handler in my main window, and when I press say F1 key,
I can trap it with a break point, but when I am in my second window, which is
a 2nd WindProc, I cannot trap the WM_KEYDOWN messages.
here is the basic code:
===================================WndProc.CPP
LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
....other code...
switch(message)
{
case WM_KEYDOWN:
switch(wParam) //**********Break point recognized at debug time
{
case VK_F2:
ShowWindow(hdCW1,SW_HIDE);
break;
}
return 0;
case WM_COMMAND:
if (LOWORD(wParam) == WindowButtons[1].MW_btC_ID) //If Button #1
{
hdCW1 = CreateWindow( //Create Child window #1
szCW1_ClassName,szCW1_Name,
WS_CHILD | WS_CAPTION | WS_SYSMENU,
150,50,400,300,hwnd,(HMENU)CW1_ID,
(HINSTANCE) GetWindowLong(hwnd,GWL_HINSTANCE),NULL);
ShowWindow(hdCW1,SW_SHOW); //Show child window #1
}
return 0;
....other code....
===============================================
And here is the code pertaining to the child window, pressing F1 key does
not get trapped by break point in this window?
===================================WndProc_CW1.CPP
LRESULT CALLBACK WndProc_CW1 (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
....other code...
case WM_KEYDOWN:
switch (wParam) //Break point here! Break point NOT recognized at
debug time
{
case 0: //Dummy case
break;
}
return 0;
....other code....
=================================================
Its like as if when I am in my child window and I press say F1 key, the
WM_KEYDOWN message is not sent, and even if I have a break point on the
following line:
switch (wParam)
debug doesn't stop on that line, it goes right through as if I had no break
point ????
If you have any ideas, please get back!
All help appreciated!
Thanks
--
Best regards
Robert
"William DePalo [MVP VC++]" wrote:
"Robby" <Robby@discussions.microsoft.com> wrote in message
news:6B4DB6A5-AD45-4F43-B508-64B41A92C645@microsoft.com...
Success!
Congratulations.
My question is, given the code shown above for the *PC end*, how would
VC++
, by using code, send an "enter" or a "13" in this case?
A pretty thorough explanation is here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang98/html/_pluslang_c.2b2b_.string_literals.asp
I might write something like this
char szControl[] = {13, 0};
MySerial.Write(szControl);
Regards,
Will