首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

MFC中的SetFocus如何用

2012-04-15 
MFC中的SetFocus怎么用哪位大侠能不能帮我看看这个问题我在基本对话框里有个Edit输入框,我想在程序运行时

MFC中的SetFocus怎么用
哪位大侠能不能帮我看看这个问题
我在基本对话框里有个Edit输入框,我想在程序运行时光标就在上面闪烁
定义了一个CEdit变量ctrlinfo1 我在OnInitDialog()中用了ctrlinfo1.SetFocus()
但是运行程序仍然没有光标闪烁,是不是我还差什么东西没有加上去啊???

[解决办法]
OnInitialDialog在改变了FOCUS的情况下要返回FALSE。

C/C++ code
BOOL CMFCTestDlg::OnInitDialog(){    CDialogEx::OnInitDialog();    // Set the icon for this dialog.  The framework does this automatically    //  when the application's main window is not a dialog    SetIcon(m_hIcon, TRUE);            // Set big icon    SetIcon(m_hIcon, FALSE);        // Set small icon    // TODO: Add extra initialization here    return TRUE;  // return TRUE  unless you set the focus to a control} 

热点排行