Click here to Skip to main content
15,908,673 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: URLDownloadToFile, Cancel Button Pin
jkirkerx15-Nov-11 17:19
professionaljkirkerx15-Nov-11 17:19 
GeneralRe: URLDownloadToFile, Cancel Button Pin
jkirkerx16-Nov-11 11:01
professionaljkirkerx16-Nov-11 11:01 
GeneralRe: URLDownloadToFile, Cancel Button Pin
enhzflep16-Nov-11 13:40
enhzflep16-Nov-11 13:40 
GeneralRe: URLDownloadToFile, Cancel Button Pin
jkirkerx17-Nov-11 6:15
professionaljkirkerx17-Nov-11 6:15 
GeneralRe: URLDownloadToFile, Cancel Button Pin
enhzflep17-Nov-11 19:45
enhzflep17-Nov-11 19:45 
GeneralRe: URLDownloadToFile, Cancel Button Pin
jkirkerx18-Nov-11 6:33
professionaljkirkerx18-Nov-11 6:33 
GeneralRe: URLDownloadToFile, Cancel Button Pin
enhzflep18-Nov-11 14:15
enhzflep18-Nov-11 14:15 
GeneralRe: URLDownloadToFile, Cancel Button Pin
jkirkerx18-Nov-11 17:05
professionaljkirkerx18-Nov-11 17:05 
I have the create thread working now. just went simple on it.

I already had the progress bar and status text working, now the new thread launches the download, and the cancel button responds to my click. I know how to stop the Download Callback with E_ABORT, I just need to figure out how to send that message to the progress loop.

After that, I need to figure out how to destroy the thread on cancel, or when the download is complete, _endthread,
but I'm not sure if I need to close the handle, and the WaitForObject.

Getting there. Still experimenting with it, so it's not finalized.


C#
///////////////////////////////////////////////////////////////////////////////////////////
    // Ready for Take Off
    hThread = (HANDLE)_beginthreadex(NULL, 0, SQL_SoftwareDownload, NULL, 0, (unsigned *)&thread_id);

    return resultCode;
}

unsigned int __stdcall SQL_SoftwareDownload(void *) {

    int iReturn = 0;
    HRESULT hr = E_FAIL;

    callback = new SQL_Servers_BindCallback;
    callback->m_MDIChild = hSQL_Servers_Download;
    callback->m_Progress_Text = lbl_SQL_Server_Download_Status;
    callback->m_Progress_Bar = pb_SQL_Server_Download_Status;
    callback->b_Downloading = TRUE;

    hr = URLDownloadToFile(NULL, szUrl, szFileName, 0, callback);
    if (hr == S_OK)
        iReturn = 1;

    return iReturn;

}

AnswerRe: URLDownloadToFile, Cancel Button Pin
Chuck O'Toole18-Nov-11 17:25
Chuck O'Toole18-Nov-11 17:25 
GeneralRe: URLDownloadToFile, Cancel Button Pin
jkirkerx18-Nov-11 18:02
professionaljkirkerx18-Nov-11 18:02 
GeneralRe: URLDownloadToFile, Cancel Button Pin
enhzflep18-Nov-11 20:28
enhzflep18-Nov-11 20:28 
GeneralRe: URLDownloadToFile, Cancel Button Pin
jkirkerx19-Nov-11 7:15
professionaljkirkerx19-Nov-11 7:15 
GeneralRe: URLDownloadToFile, Cancel Button Pin
enhzflep19-Nov-11 15:00
enhzflep19-Nov-11 15:00 
GeneralRe: URLDownloadToFile, Cancel Button Pin
jkirkerx19-Nov-11 17:52
professionaljkirkerx19-Nov-11 17:52 
GeneralRe: URLDownloadToFile, Cancel Button Pin
enhzflep20-Nov-11 0:56
enhzflep20-Nov-11 0:56 
GeneralRe: URLDownloadToFile, Cancel Button Pin
jkirkerx20-Nov-11 18:06
professionaljkirkerx20-Nov-11 18:06 
QuestionProblem with MSDN Preview Handler Recipe Pin
AndrewG123115-Nov-11 13:26
AndrewG123115-Nov-11 13:26 
QuestionOT - question for real COM / RS232 guru Pin
Vaclav_15-Nov-11 10:33
Vaclav_15-Nov-11 10:33 
AnswerRe: OT - question for real COM / RS232 guru Pin
Richard MacCutchan15-Nov-11 22:00
mveRichard MacCutchan15-Nov-11 22:00 
GeneralRe: OT - question for real COM / RS232 guru Pin
Vaclav_16-Nov-11 2:50
Vaclav_16-Nov-11 2:50 
GeneralRe: OT - question for real COM / RS232 guru Pin
Richard MacCutchan16-Nov-11 3:19
mveRichard MacCutchan16-Nov-11 3:19 
RantSmart pointers Pin
Pascal Ganaye15-Nov-11 6:15
Pascal Ganaye15-Nov-11 6:15 
GeneralRe: Smart pointers Pin
Erudite_Eric15-Nov-11 7:33
Erudite_Eric15-Nov-11 7:33 
GeneralRe: Smart pointers Pin
JackDingler15-Nov-11 11:23
JackDingler15-Nov-11 11:23 
GeneralRe: Smart pointers Pin
Stefan_Lang17-Nov-11 4:42
Stefan_Lang17-Nov-11 4:42 

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.