Click here to Skip to main content
16,005,491 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDumb CFile question.. Pin
RobJones31-Mar-03 4:42
RobJones31-Mar-03 4:42 
GeneralRe: Dumb CFile question.. Pin
Pavel Klocek31-Mar-03 4:56
Pavel Klocek31-Mar-03 4:56 
GeneralMy bad.. Pin
RobJones31-Mar-03 5:06
RobJones31-Mar-03 5:06 
GeneralRe: My bad.. Pin
Chris Meech31-Mar-03 5:19
Chris Meech31-Mar-03 5:19 
GeneralRe: My bad.. Pin
RobJones31-Mar-03 5:48
RobJones31-Mar-03 5:48 
GeneralRe: My bad.. Pin
Pavel Klocek31-Mar-03 5:27
Pavel Klocek31-Mar-03 5:27 
GeneralRe: Dumb CFile question.. Pin
Brigsoft31-Mar-03 7:16
Brigsoft31-Mar-03 7:16 
GeneralRe: Dumb CFile question.. Pin
RobJones31-Mar-03 8:23
RobJones31-Mar-03 8:23 
I use SetRTF to stream an RTF string into a RichEdit control or view.. It's declared like this..

// in the .h
void SetRTF(CString sRTF);
static DWORD CALLBACK CBStreamIn(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);

// in the .cpp
void CMyView::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 CMyView::CBStreamIn(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
	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 );
	}

	return 0;
}


Rob

Whoever said nothing's impossible never tried slamming a revolving door!
GeneralChanging backcolor of editbox in an activex! Pin
ZarrinPour31-Mar-03 4:26
ZarrinPour31-Mar-03 4:26 
GeneralRe: Changing backcolor of editbox in an activex! Pin
RobJones31-Mar-03 4:54
RobJones31-Mar-03 4:54 
GeneralRe: Changing backcolor of editbox in an activex! Pin
Alvaro Mendez31-Mar-03 5:11
Alvaro Mendez31-Mar-03 5:11 
GeneralDistinguishing issuing edit box Pin
ns31-Mar-03 4:20
ns31-Mar-03 4:20 
GeneralRe: Distinguishing issuing edit box Pin
Alvaro Mendez31-Mar-03 5:19
Alvaro Mendez31-Mar-03 5:19 
GeneralRe: Distinguishing issuing edit box Pin
ns31-Mar-03 5:28
ns31-Mar-03 5:28 
GeneralRe: Distinguishing issuing edit box Pin
Alvaro Mendez31-Mar-03 6:02
Alvaro Mendez31-Mar-03 6:02 
GeneralWow!!!! THank you!!!! Pin
ns31-Mar-03 6:54
ns31-Mar-03 6:54 
GeneralRe: Wow!!!! THank you!!!! Pin
Alvaro Mendez31-Mar-03 7:24
Alvaro Mendez31-Mar-03 7:24 
Generalmulti display Pin
Paul JOACHIM31-Mar-03 3:27
Paul JOACHIM31-Mar-03 3:27 
GeneralRe: multi display Pin
Cedric Moonen31-Mar-03 3:45
Cedric Moonen31-Mar-03 3:45 
GeneralRe: multi display Pin
Paul JOACHIM31-Mar-03 4:28
Paul JOACHIM31-Mar-03 4:28 
GeneralErratum Pin
Paul JOACHIM31-Mar-03 20:51
Paul JOACHIM31-Mar-03 20:51 
Generalplaying and audio "wav" file Pin
si_6931-Mar-03 3:21
si_6931-Mar-03 3:21 
GeneralRe: playing and audio "wav" file Pin
Alvaro Mendez31-Mar-03 5:23
Alvaro Mendez31-Mar-03 5:23 
GeneralRe: playing and audio "wav" file Pin
Brigsoft31-Mar-03 7:21
Brigsoft31-Mar-03 7:21 
GeneralCleaning my memory wenn shutting down programm Pin
Willem B31-Mar-03 2:48
Willem B31-Mar-03 2: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.