1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Setting Keyboard Focus on a TEdit Control

Discussion in 'MFC' started by nbaztec, Oct 2, 2010.

  1. nbaztec

    nbaztec New Member

    Oct 2, 2010
    Likes Received:
    Trophy Points:
    I basically have a InputQuery Box with a TEdit control. I obtain the handles(HWND) of both the Box & the Control.

    My only issue is that when the InputBox is displayed the TEdit control isn't focused by default, I have to press a key to make it take keyboard focus.

    Is there anyway (PostMessage?) through which I can give the focus to TEdit Control. Originally the Window has the control since if I press Down Arrow, the Move,Close Menu appears on the InputBox.

    P.S. I've tried WM_ACTIVATE, SETFOCUS,WM_KEYDOWN('A'). None work however the KEYDOWN does print an 'A' in the TEdit control however the keyboard focus is still not belonging to it.

    Nisheeth Barthwal

Share This Page