Click here to Skip to main content
16,007,504 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralTask Bar Funtionality Replication Pin
gekoscan27-Jul-02 9:57
gekoscan27-Jul-02 9:57 
GeneralRe: Task Bar Funtionality Replication Pin
Michael P Butler27-Jul-02 10:16
Michael P Butler27-Jul-02 10:16 
Generalmessage encapsulation Pin
detect27-Jul-02 8:16
detect27-Jul-02 8:16 
GeneralRe: message encapsulation Pin
detect29-Jul-02 4:35
detect29-Jul-02 4:35 
QuestionHow To Write Code To Change The Printer Resolution Pin
ooosawaddee327-Jul-02 7:43
ooosawaddee327-Jul-02 7:43 
AnswerRe: How To Write Code To Change The Printer Resolution Pin
l a u r e n28-Jul-02 0:35
l a u r e n28-Jul-02 0:35 
GeneralRe: How To Write Code To Change The Printer Resolution Pin
Branislav28-Jul-02 4:38
Branislav28-Jul-02 4:38 
Generalindex not within bounds? Help !! Pin
nss27-Jul-02 7:18
nss27-Jul-02 7:18 
I tried:
<br />
void CTrain1View::OnReadin() <br />
{<br />
	CString sWriteText; //Where the text will be streamed from<br />
	sWriteText="Rich text is shown here in sample project";<br />
<br />
	// This is hard-coded for example purposes. It is likely this would<br />
	// be read from file or another source.<br />
	EDITSTREAM es;<br />
	es.dwCookie = (DWORD)&sWriteText; // Pass a pointer to the CString to the callback function<br />
	es.pfnCallback = MEditStreamInCallback; // Specify the pointer to the callback function<br />
<br />
	m_richedit.StreamIn(SF_RTF,es); // Perform the streaming<br />
}<br />
<br />
<br />
<br />
  DWORD __stdcall MEditStreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)<br />
{<br />
	CString *psBuffer = (CString *)dwCookie;<br />
<br />
	if (cb < psBuffer->GetLength()) cb = psBuffer->GetLength();<br />
<br />
	for (int i=0;i<cb;i++)<br />
	{<br />
		*(pbBuff+i) = psBuffer->GetAt(i);<br />
	}<br />
<br />
	*pcb = cb;<br />
<br />
	*psBuffer = psBuffer->Mid(cb);<br />
<br />
	return 0;<br />
}<br />
<br />

but this did not populate the richedit control. Instead it crashed precisely at :
    for (int i=0;i<cb;i++)<br />
{<br />
    *(pbBuff+i) = psBuffer->GetAt(i);<br />
}<br />


In the debug window I could see that the entire string was retrieved, and it entered the for loop even after that. Then crashed. so is it an indexing problem? How to fix it?

Thanks,
ns
GeneralRe: index not within bounds? Help !! Pin
nss27-Jul-02 8:01
nss27-Jul-02 8:01 
GeneralRe: index not within bounds? Help !! Pin
Ravi Bhavnani27-Jul-02 8:02
professionalRavi Bhavnani27-Jul-02 8:02 
GeneralRe: index not within bounds? Help !! Pin
nss27-Jul-02 8:40
nss27-Jul-02 8:40 
Generalyikes! It did it again!! Pin
nss27-Jul-02 8:42
nss27-Jul-02 8:42 
GeneralRe: yikes! It did it again!! Pin
nss27-Jul-02 8:43
nss27-Jul-02 8:43 
GeneralRe: yikes! It did it again!! Pin
Ravi Bhavnani27-Jul-02 8:45
professionalRavi Bhavnani27-Jul-02 8:45 
GeneralRe: yikes! It did it again!! Pin
Ravi Bhavnani27-Jul-02 8:44
professionalRavi Bhavnani27-Jul-02 8:44 
General\n in TRACE() Pin
Ravi Bhavnani27-Jul-02 8:58
professionalRavi Bhavnani27-Jul-02 8:58 
GeneralRe: index not within bounds? Help !! Pin
Bill S27-Jul-02 8:47
professionalBill S27-Jul-02 8:47 
GeneralRe: index not within bounds? Help !! Pin
nss28-Jul-02 6:54
nss28-Jul-02 6:54 
Generaltrying out your idea Pin
nss28-Jul-02 7:34
nss28-Jul-02 7:34 
GeneralRe: index not within bounds? Help !! Pin
Anonymous28-Jul-02 4:49
Anonymous28-Jul-02 4:49 
GeneralPort Numbers Pin
Waleed Eissa27-Jul-02 6:31
Waleed Eissa27-Jul-02 6:31 
GeneralRe: Port Numbers Pin
Anders Molin27-Jul-02 7:42
professionalAnders Molin27-Jul-02 7:42 
QuestionTimer Function Prototype ? Pin
hongheo7627-Jul-02 5:51
hongheo7627-Jul-02 5:51 
AnswerRe: Timer Function Prototype ? Pin
Michael Dunn27-Jul-02 6:09
sitebuilderMichael Dunn27-Jul-02 6:09 
AnswerRe: Timer Function Prototype ? Pin
includeh1027-Jul-02 7:10
includeh1027-Jul-02 7:10 

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.