Click here to Skip to main content
16,017,852 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: scrolling window from left to right Pin
jhwurmbach20-Feb-07 1:21
jhwurmbach20-Feb-07 1:21 
QuestionSockets Pin
Johan Pretorius19-Feb-07 23:15
Johan Pretorius19-Feb-07 23:15 
AnswerRe: Sockets Pin
AkiraOne19-Feb-07 23:35
AkiraOne19-Feb-07 23:35 
AnswerRe: Sockets Pin
led mike20-Feb-07 5:45
led mike20-Feb-07 5:45 
Questioninvalidate rectangle Pin
rushiraj.jhala19-Feb-07 22:42
rushiraj.jhala19-Feb-07 22:42 
AnswerRe: invalidate rectangle Pin
prasad_som19-Feb-07 22:54
prasad_som19-Feb-07 22:54 
AnswerRe: invalidate rectangle Pin
prasad_som21-Feb-07 19:50
prasad_som21-Feb-07 19:50 
QuestionRichEdit Control Error Pin
Suresh H19-Feb-07 21:59
Suresh H19-Feb-07 21:59 
Hello all,

I have a Rich edit control in my win 32 App.

I am passing one word to rich edit control and I want to change the color of that word in all the places where it occurs in the Rich control.

I am trying with this code

void ColorWords(char* word,HWND hwnd)<br />
{<br />
	CHARFORMAT2 cf;<br />
	memset(&cf, 0, sizeof(CHARFORMAT2));<br />
	cf.cbSize = sizeof(CHARFORMAT2);<br />
	cf.dwMask = CFM_BOLD;<br />
	cf.dwEffects = CFE_BOLD;<br />
	COLORREF clr =RGB(255, 10, 15) ;<br />
	cf.dwMask =CFM_COLOR;<br />
    	cf.crTextColor = clr;<br />
<br />
<br />
     FINDTEXTEX findText;<br />
     int foundCount = 0;<br />
     int foundPos = 0;<br />
     int wordLen = lstrlen(word);<br />
 <br />
	 findText.chrg.cpMin = 0;<br />
	 findText.chrg.cpMax = -1;<br />
	 findText.lpstrText = word;<br />
<br />
	//Handle to the Rich edit box<br />
    HWND hwndRichEdit = GetDlgItem(hwnd, IDC_FILECONT);<br />
 foundPos=SendMessage(hwndRichEdit,EM_FINDTEXT,FR_WHOLEWORD,(LPARAM)&findText);<br />
<br />
   while (foundPos != -1)<br />
   {<br />
	SendMessage(hwndRichEdit,EM_EXSETSEL,0,(LPARAM)foundPos + wordLen);<br />
        SendMessage(hwndRichEdit,EM_GETCHARFORMAT,SCF_SELECTION,(LPARAM)cf);<br />
	findText.chrg.cpMin = foundPos + wordLen;		<br />
foundPos =SendMessage(hwndRichEdit,EM_FINDTEXT,FR_WHOLEWORD,(LPARAM)&findText);<br />
   }<br />
}


I am getting the below error can u please tell me what is error ??

Error :-

error C2440: 'type cast' : cannot convert from 'struct CHARFORMAT2A' to 'long'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.

GeneralRe: RichEdit Control Error Pin
Suresh H19-Feb-07 22:26
Suresh H19-Feb-07 22:26 
GeneralRe: RichEdit Control Error Pin
Suresh H19-Feb-07 22:54
Suresh H19-Feb-07 22:54 
GeneralRe: RichEdit Control Error Pin
Suresh H19-Feb-07 23:34
Suresh H19-Feb-07 23:34 
AnswerRe: RichEdit Control Error Pin
Hamid_RT19-Feb-07 23:08
Hamid_RT19-Feb-07 23:08 
GeneralRe: RichEdit Control Error Pin
Suresh H19-Feb-07 23:38
Suresh H19-Feb-07 23:38 
QuestionCapturing "Delete button down" from keyboard Pin
harsh_296119-Feb-07 20:52
harsh_296119-Feb-07 20:52 
AnswerRe: Capturing "Delete button down" from keyboard Pin
Hamid_RT19-Feb-07 20:57
Hamid_RT19-Feb-07 20:57 
GeneralRe: Capturing "Delete button down" from keyboard Pin
bosfan19-Feb-07 22:00
bosfan19-Feb-07 22:00 
GeneralRe: Capturing "Delete button down" from keyboard Pin
Hamid_RT19-Feb-07 23:08
Hamid_RT19-Feb-07 23:08 
GeneralRe: Capturing "Delete button down" from keyboard Pin
bosfan20-Feb-07 0:23
bosfan20-Feb-07 0:23 
GeneralRe: Capturing &quot;Delete button down&quot; from keyboard Pin
bosfan20-Feb-07 0:27
bosfan20-Feb-07 0:27 
GeneralRe: Capturing &quot;Delete button down&quot; from keyboard Pin
harsh_296120-Feb-07 0:55
harsh_296120-Feb-07 0:55 
GeneralRe: Capturing &quot;Delete button down&quot; from keyboard Pin
bosfan20-Feb-07 1:05
bosfan20-Feb-07 1:05 
GeneralRe: Capturing &quot;Delete button down&quot; from keyboard Pin
harsh_296120-Feb-07 18:57
harsh_296120-Feb-07 18:57 
GeneralRe: Capturing &quot;Delete button down&quot; from keyboard Pin
Hamid_RT20-Feb-07 1:12
Hamid_RT20-Feb-07 1:12 
GeneralRe: Capturing "Delete button down" from keyboard Pin
harsh_296120-Feb-07 22:32
harsh_296120-Feb-07 22:32 
QuestionDeleting selected items from list control Pin
harsh_296119-Feb-07 20:48
harsh_296119-Feb-07 20:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.