就是让窗口有键盘输入的焦点,也就是要让窗口的标题栏为高亮的状态。

解决方案 »

  1.   

    在2K/XP下我们可以用 AttachThreadInput 和SetForegroundWindow来有效的获取焦点。//捕捉并设置当前焦点窗口为我们的窗口
    AttachThreadInput(
        GetWindowThreadProcessId(
            ::GetForegroundWindow(),NULL),
        GetCurrentThreadId(),TRUE);//置我们的为焦点窗口
    SetForegroundWindow();
    SetFocus(); //释放thread
    AttachThreadInput(
        GetWindowThreadProcessId(
            ::GetForegroundWindow(),NULL),
        GetCurrentThreadId(),FALSE);