读书人

MFC中的SetFocus如何用

发布时间: 2012-04-15 18:39:21 作者: rapoo

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} 

读书人网 >C++

热点推荐