Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RichEdit control breaks when call GetSel()

Status
Not open for further replies.

ahoodin7

Programmer
Jun 16, 2004
72
0
0
US
<<Windows XP PRO MSVC 6.0 Pentium II 866 512 MB RAM>>

I am using a richedit control in my project.


code:-------------------------------------------------------------------------

void CRichTextEdtDlg::OnChangeRichedit()
{
long top=0, bot=0;
CHARRANGE cr;
if (m_fileloaded == true)
{
m_cRichEdt.GetSel(top,bot);
//....................error is in above code.
}
}
-------------------------------------------------------------------------------


I get a First-chance exception in AerProgram.exe (NTDLL.DLL): 0xC0000005: Access Violation in the GetSel() member function.

WINCTRL4.CPP:


code:-------------------------------------------------------------------------
void CRichEditCtrl::GetSel(long& nStartChar, long& nEndChar) const
{
ASSERT:):IsWindow(m_hWnd));
CHARRANGE cr;
::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr);
nStartChar = cr.cpMin;
nEndChar = cr.cpMax;
}
-------------------------------------------------------------------------------


SendMessage is blowing up. Why would SendMessage Blow up in a RichEdit control?

Also could it be that I somehow have the wrong version of riched32.dll?

ahoodin
 
Looks interesting, but could you step the with debugger into function GetSel and see what is exactlly the line where you get error?

Ion Filipski
1c.bmp
 
Ion,

I have done this and this is the line that I got the error:

::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr);

does that help?

Asher
 
Thanks Ion,
Will look forward to hearing from u,
Asher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top