Click here to Skip to main content
15,914,221 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCString memory Pin
trimtrom31-Dec-02 12:00
trimtrom31-Dec-02 12:00 
GeneralCOM Server problem Pin
Anonymous31-Dec-02 10:49
Anonymous31-Dec-02 10:49 
Questionplz help? Pin
imran_rafique31-Dec-02 9:32
imran_rafique31-Dec-02 9:32 
AnswerRe: plz help? Pin
Jeremy Falcon31-Dec-02 10:49
professionalJeremy Falcon31-Dec-02 10:49 
Generaldocument of IE on Win2K Pin
Tili31-Dec-02 8:18
Tili31-Dec-02 8:18 
GeneralRe: document of IE on Win2K Pin
Michael Dunn31-Dec-02 9:11
sitebuilderMichael Dunn31-Dec-02 9:11 
GeneralRe: document of IE on Win2K Pin
Stephane Rodriguez.31-Dec-02 9:18
Stephane Rodriguez.31-Dec-02 9:18 
GeneralRichEdit stream in problem... Pin
RobJones31-Dec-02 7:51
RobJones31-Dec-02 7:51 
Hello,
I have an application where I stream out a rich text string, send it across a socket.. On the receiving side the string is streamed into the Rich edit view.. Here is my stream in function.. It works fine on win 2k but the stream in doesn't work right on win 98, I lose the fonts and the color.. It does stream in the text.. Does anyone see anything wrong with the code or know why this wouldn't work on 98?

void CMonitorView::SetRTF(CString sRTF)
{
	// Read the text in
	EDITSTREAM es;
	es.dwError = 0;
	es.pfnCallback = CBStreamIn;
	es.dwCookie = (DWORD) &sRTF;
	GetRichEditCtrl().StreamIn(SF_RTF | SFF_SELECTION, es);	
}

DWORD CALLBACK CMonitorView::CBStreamIn(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
	/* OLD WAY ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	CString *pstr = (CString *) dwCookie;
	if (pstr->GetLength() < cb)
	{
		*pcb = pstr->GetLength();
		memcpy(pbBuff, (LPCSTR) *pstr, *pcb);
		pstr->Empty();
	}
	else
	{
		*pcb = cb;
		memcpy(pbBuff, (LPCSTR) *pstr, *pcb);
		*pstr = pstr->Right(pstr->GetLength() - cb);
	}
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	END OF OLD WAY ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
.
	// NEW WAY TRYING TO FIX 9X + (UNICODE)
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	CString *pstr = (CString *)dwCookie;
	USES_CONVERSION;
	if( pstr->GetLength() < cb )
	{
		*pcb = pstr->GetLength();
		memcpy(pbBuff, T2CA((LPCTSTR)*pstr), *pcb );
		pstr->Empty();
	}
	else
	{
		*pcb = cb;
		memcpy(pbBuff, T2CA((LPCTSTR)*pstr), *pcb );
		*pstr = pstr->Right( pstr->GetLength() - cb );
	}
	// END OF NEW WAY
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	

	/* YET ANOTHER WAY TO TRY ~~~~~~~~~~~~~~~~~~~~~~~~~~
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	CString *psBuffer = (CString *)dwCookie;

	if (cb > psBuffer->GetLength())
		cb = psBuffer->GetLength();

	for (int i = 0; i < cb ; i++)
		*(pbBuff+i) = psBuffer->GetAt(i);

	*pcb = cb;
	*psBuffer = psBuffer->Mid(cb);

	END OF YET ANOTHER WAY TO TRY ~~~~~~~~~~~~~~~~~~~~~~
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

	return 0;
}


Thanks,
Rob
GeneralRe: RichEdit stream in problem... Pin
Gary R. Wheeler1-Jan-03 4:18
Gary R. Wheeler1-Jan-03 4:18 
GeneralRe: RichEdit stream in problem... Pin
RobJones1-Jan-03 4:42
RobJones1-Jan-03 4:42 
GeneralTyring to get the icon of the desktop or "My Documents" or... Pin
mynab31-Dec-02 5:18
mynab31-Dec-02 5:18 
GeneralRe: Tyring to get the icon of the desktop or "My Documents" or... Pin
mynab31-Dec-02 23:31
mynab31-Dec-02 23:31 
QuestionTransparent with Mouse Events? Pin
ups31-Dec-02 2:44
ups31-Dec-02 2:44 
AnswerRe: Transparent with Mouse Events? Pin
Mike Nordell31-Dec-02 9:28
Mike Nordell31-Dec-02 9:28 
GeneralRe: Transparent with Mouse Events? Pin
ups31-Dec-02 17:09
ups31-Dec-02 17:09 
GeneralRe: Transparent with Mouse Events? Pin
Mike Nordell1-Jan-03 4:56
Mike Nordell1-Jan-03 4:56 
GeneralRe: Transparent with Mouse Events? Pin
ups1-Jan-03 14:37
ups1-Jan-03 14:37 
GeneralIncrease volume of wav file generated by SAPI. Pin
S.Maharajan31-Dec-02 1:26
S.Maharajan31-Dec-02 1:26 
Generaledk.h / edkguid.lib Pin
skallestad31-Dec-02 1:11
skallestad31-Dec-02 1:11 
GeneralWho can give me a Shell32.dll( 5.0 ) Pin
TianYang31-Dec-02 0:48
TianYang31-Dec-02 0:48 
GeneralRe: Who can give me a Shell32.dll( 5.0 ) Pin
TianYang31-Dec-02 1:31
TianYang31-Dec-02 1:31 
GeneralRe: Who can give me a Shell32.dll( 5.0 ) Pin
Michael Dunn31-Dec-02 7:54
sitebuilderMichael Dunn31-Dec-02 7:54 
GeneralRe: Who can give me a Shell32.dll( 5.0 ) Pin
Jeremy Falcon31-Dec-02 10:52
professionalJeremy Falcon31-Dec-02 10:52 
GeneralRe: Who can give me a Shell32.dll( 5.0 ) Pin
16-Nov-03 19:39
suss16-Nov-03 19:39 
Generalformatting output (CString .Format...) Pin
Joan M31-Dec-02 0:06
professionalJoan M31-Dec-02 0:06 

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.