Click here to Skip to main content
15,912,578 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralODBC Probelm Pin
SamirSood18-Sep-02 19:39
SamirSood18-Sep-02 19:39 
GeneralRe: ODBC Probelm Pin
jmkhael18-Sep-02 21:55
jmkhael18-Sep-02 21:55 
GeneralMemory Management in Microsoft Tree Control Pin
chepuri_uk18-Sep-02 19:32
chepuri_uk18-Sep-02 19:32 
Questionhow to? Pin
imran_rafique18-Sep-02 16:29
imran_rafique18-Sep-02 16:29 
AnswerRe: how to? Pin
Chris Losinger18-Sep-02 17:04
professionalChris Losinger18-Sep-02 17:04 
AnswerRe: how to? Pin
Nish Nishant18-Sep-02 18:46
sitebuilderNish Nishant18-Sep-02 18:46 
AnswerRe: how to? Pin
Pavel Klocek18-Sep-02 22:45
Pavel Klocek18-Sep-02 22:45 
Generaladding text to RichEdit box ! Pin
Hadi Rezaee18-Sep-02 16:12
Hadi Rezaee18-Sep-02 16:12 
Hello there,
I used to below function to add string to RichEdit box, it works fine on Win98 or WinXP ... but it has bug in Win2000 !

Function:


void CResultDialog::AddText(CString str, COLORREF rgb, BOOL bold, BOOL italic, BOOL underline)
{
// get current length from rich text box ...
int nCurLen = m_Rich.GetTextLength();

// hide selected text !
m_Rich.HideSelection(TRUE, FALSE);

// move the cursor to end of rich control ...
m_Rich.SetSel(nCurLen, nCurLen);

// attach the new string to the last of rich edit ...
m_Rich.ReplaceSel(str);

int nStartPos = nCurLen;
int nEndPos = m_Rich.GetTextLength();

// configure the character format !
CHARFORMAT2 cf;

cf.cbSize = sizeof(CHARFORMAT2);
cf.dwMask = CFM_COLOR | CFM_BOLD | CFM_UNDERLINE | CFM_ITALIC;
cf.dwEffects = (unsigned long)~(CFE_ITALIC | CFE_UNDERLINE | CFE_BOLD | CFE_AUTOCOLOR);
cf.crTextColor = rgb;
cf.dwEffects |= underline ? CFE_UNDERLINE : cf.dwEffects;
cf.dwEffects |= bold ? CFE_BOLD : cf.dwEffects;
cf.dwEffects |= italic ? CFE_ITALIC : cf.dwEffects;

// select added text ...
m_Rich.SetSel(nStartPos, nEndPos);

// use character format !
m_Rich.SetSelectionCharFormat(cf);

m_Rich.SetSel(-1, -1);
}



I used this function in here:

AddText( "Company: ", RGB(255, 0, 0), TRUE, FALSE, FALSE );
AddText( "Microsoft", RGB(0, 0, 0), TRUE, FALSE, FALSE );
AddText( "\nContact: ", RGB(255, 0, 0), TRUE, FALSE, FALSE );
AddText( "Billi", RGB(0, 0, 0), TRUE, FALSE, FALSE );
AddText( "\nWeb: ", RGB(255, 0, 0), TRUE, FALSE, FALSE );
AddText( "www.m$.com", RGB(0, 0, 0), TRUE, FALSE, FALSE );

It has bug in Win2000,
The bug is colors on the text ...
I think it's because my enter character in my strings ...
Win98 or WinXP count enter character in for getting lenght but Win2000 doesn't it, or vice versa !

How can i solve it ??



My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html

Hadi Rezaie
GeneralRe: adding text to RichEdit box ! Pin
Stephane Rodriguez.18-Sep-02 20:49
Stephane Rodriguez.18-Sep-02 20:49 
QuestionFarsi language in VC++ .NET ? Pin
Hadi Rezaee18-Sep-02 15:50
Hadi Rezaee18-Sep-02 15:50 
AnswerRe: Farsi language in VC++ .NET ? Pin
Anonymous18-Sep-02 16:30
Anonymous18-Sep-02 16:30 
QuestionCan we search SQL with not empty string & COleDateTime format? Pin
Anh18-Sep-02 15:30
Anh18-Sep-02 15:30 
AnswerRe: Can we search SQL with not empty string & COleDateTime format? Pin
Le centriste18-Sep-02 15:44
Le centriste18-Sep-02 15:44 
GeneralRe: SQL search COleDateTime format failed! Pin
ATC18-Sep-02 17:53
ATC18-Sep-02 17:53 
GeneralRe: SQL search COleDateTime format failed! Pin
Le centriste18-Sep-02 19:00
Le centriste18-Sep-02 19:00 
Generalbuttons Pin
Shotgun18-Sep-02 14:58
Shotgun18-Sep-02 14:58 
GeneralRe: buttons Pin
BlackSmith18-Sep-02 23:43
BlackSmith18-Sep-02 23:43 
GeneralInstalling VS.Net alongside VC++ 6.0 Pin
unregistered18-Sep-02 13:15
unregistered18-Sep-02 13:15 
GeneralRe: Installing VS.Net alongside VC++ 6.0 Pin
Paul Ingles18-Sep-02 13:18
Paul Ingles18-Sep-02 13:18 
GeneralRe: Installing VS.Net alongside VC++ 6.0 Pin
adamUK18-Sep-02 21:31
adamUK18-Sep-02 21:31 
GeneralPointer to class memeber func Pin
BlackSmith18-Sep-02 12:20
BlackSmith18-Sep-02 12:20 
GeneralRe: Pointer to class memeber func Pin
Chris Losinger18-Sep-02 12:27
professionalChris Losinger18-Sep-02 12:27 
GeneralRe: Pointer to class memeber func Pin
Axter19-Sep-02 3:07
professionalAxter19-Sep-02 3:07 
GeneralRe: Pointer to class memeber func Pin
Axter18-Sep-02 18:07
professionalAxter18-Sep-02 18:07 
GeneralRe: Pointer to class memeber func Pin
BlackSmith19-Sep-02 2:59
BlackSmith19-Sep-02 2:59 

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.