看了老半天,终于明白你的意思了,你是让按钮按过之后,编辑框仍然有焦点,并且仍然是原来的选中状态。好办,在代码中加上下面示例中那句就OKCEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1); DWORD dwSelection;dwSelection = pEdit->GetSel(); // save the original selection state pEdit->SetSel(0, -1, TRUE); pEdit->Copy();pEdit->SetFocus();//此处加上这句pEdit->SetSel(dwSelection, TRUE);
DWORD dwSelection;dwSelection = pEdit->GetSel(); // save the original selection state
pEdit->SetSel(0, -1, TRUE);
pEdit->Copy();pEdit->SetFocus();//此处加上这句pEdit->SetSel(dwSelection, TRUE);
试过了,还是不行。
pEdit->Copy();
pEdit->SetFocuse();
pEdit->SetSel;
或::SetWindowLong(cEdit, GWL_STYLE, GetWindowLong(cEdit,GWL_STYLE)|ES_NOHIDESEL);