Click here to Skip to main content
16,004,944 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: smpt server Pin
gamitech9-Jun-04 10:11
gamitech9-Jun-04 10:11 
GeneralRe: smpt server Pin
Anonymous9-Jun-04 18:01
Anonymous9-Jun-04 18:01 
GeneralMultiple Documents in a Single View (HELP!) Pin
Charlie Curtis9-Jun-04 8:44
Charlie Curtis9-Jun-04 8:44 
GeneralRe: Multiple Documents in a Single View (HELP!) Pin
Andrew Quinn AUS9-Jun-04 9:16
Andrew Quinn AUS9-Jun-04 9:16 
GeneralHELP MEEEEEEEEEEEEEEEEEEEEEEEEEEEE Pin
Renjith Ramachandran9-Jun-04 8:42
Renjith Ramachandran9-Jun-04 8:42 
GeneralRe: HELP MEEEEEEEEEEEEEEEEEEEEEEEEEEEE Pin
Harold Bamford9-Jun-04 12:21
Harold Bamford9-Jun-04 12:21 
GeneralRe: HELP MEEEEEEEEEEEEEEEEEEEEEEEEEEEE Pin
Renjith Ramachandran9-Jun-04 19:01
Renjith Ramachandran9-Jun-04 19:01 
GeneralDownloading a file into segments trouble... Pin
BlackKettle9-Jun-04 8:32
BlackKettle9-Jun-04 8:32 
I am developing a program much like FlashGet or GetRight...
It successfully downloads files but when I got to the part making it
download the files into segments, I got myself in trouble...I use
synchronous downloading, but after I start the 5 segments, just 2 of them
pass the part "HttpSendRequest" and starts downloading their parts but the
other 3 just stay there and waits for something even after the other 2
threads finish their work....after a while they either start downloading,
either fail - as they got no response(it timed out)...
After walking over the net I found that there is asynchronous downloading
too, and I'm forced to try it since the way I do it(HttpSendRequest and
InternetOpenUrl fails too) doesn't work...
I open a internet session with the async flag, then I set a status
callback function for the session. Then I call InternetOpenUrl, and I got
a NULL handle. Then I check weather the last error is ERROR_IO_PENDING and
if so I make the thread to wait for a event. That event is being signalled
by the Status Callback when it got a STATUS_RESPONSE_COMPLETE status, and
in the struct passed in the dwContext value of InternetOpenUrl(its a
struct) I set up the handle to the file.

But here's the problem...
After the thread waits for the event to get signalled, the status callback
receives just 1 status - STATUS_HANDLE_CREATED and then just crashes...
the code where it crashes is indicated in wininet.dll with a Access
Violation
!
Here's source code:
	PSTATUSCALLBACK hStatusCallback;<br />
	hStatusCallback.nSegment = pSegment->m_nSegment;<br />
	hStatusCallback.strFileName = pSegment->szFileName;<br />
	hStatusCallback.strFilePath = pSegment->szFileName;<br />
	hStatusCallback.strUrl = pSegment->szURL;<br />
<br />
	HINTERNET hSession = InternetOpen("Agent",<br />
		INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC);<br />
	InternetSetStatusCallback( hSession,<br />
(INTERNET_STATUS_CALLBACK)InternetCallbackFunc );<br />
	HINTERNET hInetFile = InternetOpenUrl( hSession, CString(szURL,<br />
strlen(szURL)), NULL, 0, <br />
      INTERNET_FLAG_RELOAD | INTERNET_FLAG_PRAGMA_NOCACHE | <br />
      INTERNET_FLAG_NO_CACHE_WRITE, (LPARAM)&hStatusCallback );<br />
	if(hInetFile == NULL && GetLastError() == ERROR_IO_PENDING) {<br />
		if(WaitForSingleObject(hErrorEvent, INFINITE) == WAIT_OBJECT_0) {<br />
			ResetEvent(hErrorEvent);<br />
			hInetFile = hStatusCallback.hInetFile;<br />
			MessageBox(NULL, "Got handle", "info", MB_OK);<br />
		}else<br />
			MessageBox(NULL, "Error during waiting for the Error event!", "ERROR",<br />
MB_OK | MB_ICONERROR);<br />
	}

GeneralDetecting when a window is created Pin
Tim James Reynolds9-Jun-04 8:28
Tim James Reynolds9-Jun-04 8:28 
GeneralRe: Detecting when a window is created Pin
palbano9-Jun-04 9:53
palbano9-Jun-04 9:53 
GeneralRe: Detecting when a window is created Pin
Tim James Reynolds10-Jun-04 2:39
Tim James Reynolds10-Jun-04 2:39 
GeneralRe: Detecting when a window is created Pin
gamitech9-Jun-04 9:54
gamitech9-Jun-04 9:54 
GeneralRe: Detecting when a window is created Pin
Tim James Reynolds10-Jun-04 2:50
Tim James Reynolds10-Jun-04 2:50 
GeneralRe: Detecting when a window is created Pin
Tim James Reynolds10-Jun-04 3:52
Tim James Reynolds10-Jun-04 3:52 
QuestionWhat's the message when I leave a non modal dialog? Pin
doctorpi9-Jun-04 7:59
doctorpi9-Jun-04 7:59 
AnswerRe: What's the message when I leave a non modal dialog? Pin
David Crow9-Jun-04 8:15
David Crow9-Jun-04 8:15 
AnswerRe: What's the message when I leave a non modal dialog? Pin
BlackKettle9-Jun-04 8:22
BlackKettle9-Jun-04 8:22 
GeneralProcessing Arrow Keys in a Modeless Dialog (DLL) Pin
Justin Cooke9-Jun-04 6:08
Justin Cooke9-Jun-04 6:08 
GeneralRe: Processing Arrow Keys in a Modeless Dialog (DLL) Pin
mangellj9-Jun-04 9:55
mangellj9-Jun-04 9:55 
GeneralRe: Processing Arrow Keys in a Modeless Dialog (DLL) Pin
Justin Cooke10-Jun-04 10:46
Justin Cooke10-Jun-04 10:46 
Generalcan't delete all items from CListBox Pin
kfaday9-Jun-04 5:47
kfaday9-Jun-04 5:47 
GeneralRe: can't delete all items from CListBox Pin
palbano9-Jun-04 5:53
palbano9-Jun-04 5:53 
GeneralRe: can't delete all items from CListBox Pin
kfaday9-Jun-04 6:14
kfaday9-Jun-04 6:14 
GeneralRe: can't delete all items from CListBox Pin
walster9-Jun-04 7:36
walster9-Jun-04 7:36 
GeneralRe: can't delete all items from CListBox Pin
Ravi Bhavnani9-Jun-04 9:04
professionalRavi Bhavnani9-Jun-04 9:04 

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.