怎样把编辑框中的光标移动到编辑框中字符的最后面?

有两种方法:1. 通过窗口的句柄发送End消息。

if (m_pAcountEdit->IsFocused())

{

HWND hwnd = ::GetFocus();

::SendMessage(hwnd, WM_KEYDOWN, VK_END, 0);

}

2. 通过SetSel函数。

if (m_pPassWordEdit->IsFocused())

{

int length = m_pPassWordEdit->GetText().GetLength();

m_pPassWordEdit->SetSel(length, length);

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章