Click here to Skip to main content
15,903,385 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Status bar Pin
Michael Dunn5-Aug-03 17:52
sitebuilderMichael Dunn5-Aug-03 17:52 
GeneralUpdateRgn Doesn't work Pin
sdfdsfa5-Aug-03 17:09
sdfdsfa5-Aug-03 17:09 
GeneralRe: UpdateRgn Doesn't work Pin
Michael Dunn5-Aug-03 17:54
sitebuilderMichael Dunn5-Aug-03 17:54 
Generalruler in a plain text editor Pin
skea5-Aug-03 16:57
skea5-Aug-03 16:57 
QuestionHow to install application without VC environment when using DataGrid control Pin
chq125-Aug-03 16:42
chq125-Aug-03 16:42 
QuestionHow do i register a COM object (Direct X filter) from a applicatoin program? Pin
Member 4048135-Aug-03 15:07
Member 4048135-Aug-03 15:07 
AnswerRe: How do i register a COM object (Direct X filter) from a applicatoin program? Pin
Andrew Walker5-Aug-03 17:42
Andrew Walker5-Aug-03 17:42 
GeneralCan’t find text in a Rich Edit, using API Pin
Aidman5-Aug-03 14:45
Aidman5-Aug-03 14:45 
Hi, all Smile | :)

I am experiencing a problem with the Rich Edit box (version 1.0) using regular Win32 API (no MFC). I am trying to write a function that will search through a specified range of content in the control (the text). I am using the SendMessage() function with the EM_FINDTEXTEX flag and the FINDTEXTEX structure. But the problem is that it can’t seem to find any matches. For ex. I have set the control with the text “is there any matches?” and I set the function to search for the word “any” but won’t find any thing. The function has been written to return the number of matches it finds, the following code is the function I have written. Can anyone please help me figure out the problem?

int FindText(HWND hEdit, char *Text, CHARRANGE *Range) {
	FINDTEXTEX TextSearch;
	int MatchCount = 0;
	int MatchFound;

	TextSearch.chrg = *Range;
	TextSearch.lpstrText = Text;
	TextSearch.chrgText.cpMin = -1;

	while (1) {
		MatchFound = SendMessage(hEdit, EM_FINDTEXTEX, FR_WHOLEWORD, (LPARAM) &TextSearch);

		if (TextSearch.chrgText.cpMin != -1) {
			MatchCount++;
			
			if (MatchFound != -1) 
				TextSearch.chrg.cpMin = MatchFound;
			else break;
		} else break;
	}

	return MatchCount;
}


Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
QuestionHow to open random files? Pin
DaveE9th5-Aug-03 14:17
DaveE9th5-Aug-03 14:17 
AnswerRe: How to open random files? Pin
kochhar5-Aug-03 14:39
kochhar5-Aug-03 14:39 
GeneralRe: How to open random files? Pin
DaveE9th5-Aug-03 23:37
DaveE9th5-Aug-03 23:37 
GeneralRe: How to open random files? Pin
kochhar6-Aug-03 5:25
kochhar6-Aug-03 5:25 
GeneralSound question Pin
DaveE9th5-Aug-03 14:14
DaveE9th5-Aug-03 14:14 
GeneralUML Pin
Alexander M.,5-Aug-03 13:26
Alexander M.,5-Aug-03 13:26 
GeneralRe: UML Pin
Anonymous5-Aug-03 21:18
Anonymous5-Aug-03 21:18 
GeneralLayered Service Provider (LSP) Pin
Kuniva5-Aug-03 13:07
Kuniva5-Aug-03 13:07 
GeneralProblems making a LIB file Pin
JMPAC5-Aug-03 13:02
JMPAC5-Aug-03 13:02 
GeneralMFC is NOT good OOP Pin
Rohde5-Aug-03 12:58
Rohde5-Aug-03 12:58 
GeneralRe: MFC is NOT good OOP Pin
Andrew Walker5-Aug-03 13:36
Andrew Walker5-Aug-03 13:36 
GeneralRe: MFC is NOT good OOP Pin
jhwurmbach5-Aug-03 21:26
jhwurmbach5-Aug-03 21:26 
GeneralRe: MFC is NOT good OOP Pin
Ryan Binns6-Aug-03 1:33
Ryan Binns6-Aug-03 1:33 
GeneralRe: MFC is NOT good OOP Pin
QuiJohn6-Aug-03 3:25
QuiJohn6-Aug-03 3:25 
GeneralRe: MFC is NOT good OOP Pin
Ryan Binns6-Aug-03 3:37
Ryan Binns6-Aug-03 3:37 
GeneralRe: MFC is NOT good OOP Pin
Nemanja Trifunovic6-Aug-03 5:36
Nemanja Trifunovic6-Aug-03 5:36 
GeneralRe: MFC is NOT good OOP Pin
Ryan Binns6-Aug-03 18:40
Ryan Binns6-Aug-03 18:40 

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.