Well I get it to go to the right line, but now when I open up my dialog box to get the line number, selecting the line doesnt work. It works perfectly fine when I dont open up the dialog box. Why is this?
Here is the code of my function:
Code:
int lineNum;
do
{
lineNum = DialogBox(GetModuleHandle(0), MAKEINTRESOURCE(IDD_GOTO), m_hTextBox, GoToProc);
}while(lineNum > SendMessage(m_hTextBox, EM_GETLINECOUNT, 0, 0) || lineNum < 0);
if (lineNum == 0) // If user pressed cancel
return;
lineNum--; // Make EM_SETSEL select the right line.
int pos = SendMessage(m_hTextBox, EM_LINEINDEX, lineNum, 0);
SendMessage(m_hTextBox, EM_SETSEL, pos, pos);