joseramonbravo said:
Thank you for you advice.
Following your advice I coded:
--------------------------------------------------
BOOL CDialog_Newchat::OnInitDialog()
{
CDialog::OnInitDialog();
CEdit* p;
p= (CEdit*)this->GetDlgItem(IDC_NEWCHAT);
p->SetCapture();
... etc
----------------------------------------
and this solved the error but didn't bring the desired effect of putting
next to come keyboard input into the CEdit control unless a
left-mouse-click
on any place of the window application was made.
I have tried simple solutions ( SetFocus(), DoClick(), etc) but none
have worked.
Any further help?
SetCapture deals with the mouse, while SetFocus deals with the keyboard.
The thing is that while the active application can give focus away to any
window, no inactive application can steal the focus. This is very desirable
behavior from a user's perspective. I hated what happened in previous
versions of Windows: when I'm typing away in a window and some messagebox
pops up, it would dissappear as soon as I hit the spacebar, before I even
realized it was there. Also now when you try to activate your application,
Windows flashes the taskbar instead, that's also to keep asynchronous
notifications from disturbing work.
You can hook keyboard input system-wide, it's just a lot more effort.
But ask yourself, if your user is typing a Word document when the chat
window appears and reaches the end of the line without noticing the new
dialog, do you want those last few words+ENTER key to go to your dialog? Of
course not. Even worse, what if they had just copied something large and
embarassing, and now hit Ctrl+V, ENTER. That would be very bad for your
program to intercept.