Click here to Skip to main content
15,915,702 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VTBL Pin
ThatsAlok23-Nov-07 18:14
ThatsAlok23-Nov-07 18:14 
Questionconvert ascii to csv Pin
japena0323-Nov-07 9:31
japena0323-Nov-07 9:31 
QuestionRe: convert ascii to csv Pin
Maximilien23-Nov-07 9:38
Maximilien23-Nov-07 9:38 
AnswerRe: convert ascii to csv Pin
japena0324-Nov-07 9:14
japena0324-Nov-07 9:14 
AnswerRe: convert ascii to csv Pin
ThatsAlok23-Nov-07 18:15
ThatsAlok23-Nov-07 18:15 
GeneralRe: convert ascii to csv Pin
japena0324-Nov-07 9:15
japena0324-Nov-07 9:15 
Questioncmak Connection Manager Administration Kit Pin
Klive823-Nov-07 5:29
Klive823-Nov-07 5:29 
QuestionCHTMLView->Load from Stream does not work in the 2nd call Pin
sdancer7523-Nov-07 4:26
sdancer7523-Nov-07 4:26 
Hi, I used the microsoft's example to load a simple HTML file from a stream.It works fine but when I make a second call to the following method it shows a white screen.



for example :



TestPage("a.htm") --> it works

TestPage("b.htm") --> it shows a white screen have only the code.



What's wrong here ?





void CMemHTMLView::TestPage(CString filename)<br />
{<br />
<br />
Navigate2( _T("about:blank"), NULL, NULL, NULL, NULL ); <br />
<br />
LPSTREAM pStream; <br />
HRESULT hr; <br />
HGLOBAL hSource = NULL; <br />
char * source; <br />
<br />
FILE *stream;<br />
long lFileStreamSize;<br />
<br />
<br />
<br />
<br />
<br />
 if ( (stream = fopen( filename, "rb" )) == NULL )<br />
  {<br />
   AfxMessageBox("error");<br />
   return;<br />
<br />
  }<br />
<br />
 // obtain file size:<br />
 fseek (stream , 0 , SEEK_END);<br />
 lFileStreamSize = ftell (stream);<br />
 rewind (stream);<br />
<br />
<br />
 source = (char*) malloc (sizeof(char)*lFileStreamSize);<br />
<br />
 fread (source,sizeof( char ) ,lFileStreamSize,stream);<br />
<br />
 fclose(stream);<br />
<br />
<br />
<br />
 if (hSource) <br />
 { <br />
 GlobalFree(hSource); <br />
 } <br />
 <br />
 hSource = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE | GMEM_NODISCARD,  strlen(source)+1 ); <br />
 <br />
 // copy source into global mem <br />
 void * p=GlobalLock(hSource); <br />
 <br />
 memcpy((char *)p, source,lFileStreamSize ); <br />
 GlobalUnlock(hSource); <br />
 <br />
 hr = CreateStreamOnHGlobal(hSource, TRUE, &pStream); <br />
 <br />
 IDispatch* pHtmlDoc = NULL; <br />
 IPersistStreamInit* pPersistStreamInit = NULL; <br />
 <br />
 // Retrieve the document object. <br />
 pHtmlDoc = this->GetHtmlDocument(); <br />
 <br />
 // Query for IPersistStreamInit. <br />
 hr = pHtmlDoc->QueryInterface( IID_IPersistStreamInit,  (void**)&pPersistStreamInit ); <br />
 if ( SUCCEEDED(hr) ) <br />
 { <br />
 // Initialize the document. <br />
 hr = pPersistStreamInit->InitNew(); <br />
 if ( SUCCEEDED(hr) ) <br />
 { <br />
 // Load the contents of the stream. <br />
 hr = pPersistStreamInit->Load(pStream); <br />
 } <br />
 pPersistStreamInit->Release(); <br />
 } <br />
Refresh(); <br />
<br />
free (source);<br />
<br />
}


sdancer75

AnswerRe: CHTMLView->Load from Stream does not work in the 2nd call Pin
Shog924-Nov-07 9:48
sitebuilderShog924-Nov-07 9:48 
GeneralRe: CHTMLView->Load from Stream does not work in the 2nd call Pin
sdancer7526-Nov-07 1:44
sdancer7526-Nov-07 1:44 
QuestionCompile time directive for checking compiler options? Pin
dstaikos23-Nov-07 3:55
dstaikos23-Nov-07 3:55 
JokeRe: Compile time directive for checking compiler options? Pin
Florin Crişan25-Nov-07 21:11
Florin Crişan25-Nov-07 21:11 
QuestionSysAllocString Pin
George_George23-Nov-07 3:04
George_George23-Nov-07 3:04 
GeneralRe: SysAllocString Pin
Matthew Faithfull23-Nov-07 3:41
Matthew Faithfull23-Nov-07 3:41 
GeneralRe: SysAllocString Pin
George_George23-Nov-07 5:27
George_George23-Nov-07 5:27 
GeneralRe: SysAllocString Pin
Matthew Faithfull23-Nov-07 5:38
Matthew Faithfull23-Nov-07 5:38 
GeneralRe: SysAllocString Pin
George_George23-Nov-07 20:07
George_George23-Nov-07 20:07 
GeneralRe: SysAllocString Pin
Matthew Faithfull24-Nov-07 6:44
Matthew Faithfull24-Nov-07 6:44 
GeneralRe: SysAllocString Pin
George_George25-Nov-07 3:42
George_George25-Nov-07 3:42 
AnswerRe: SysAllocString Pin
Matthew Faithfull25-Nov-07 12:24
Matthew Faithfull25-Nov-07 12:24 
AnswerRe: SysAllocString Pin
Florin Crişan23-Nov-07 4:29
Florin Crişan23-Nov-07 4:29 
GeneralRe: SysAllocString Pin
George_George23-Nov-07 5:26
George_George23-Nov-07 5:26 
GeneralRe: SysAllocString Pin
Iain Clarke, Warrior Programmer23-Nov-07 5:49
Iain Clarke, Warrior Programmer23-Nov-07 5:49 
GeneralRe: SysAllocString Pin
George_George23-Nov-07 20:10
George_George23-Nov-07 20:10 
GeneralRe: SysAllocString Pin
Iain Clarke, Warrior Programmer24-Nov-07 11:34
Iain Clarke, Warrior Programmer24-Nov-07 11:34 

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.