Link to home
Start Free TrialLog in
Avatar of Member_3480671
Member_3480671

asked on

URLDownloadToFile, wrong URL?

I tried to download the following page using URLDownloadToFile:
http://www.postbank.nl/ing/pp/page/stockexchange/quotes/index/pb/0,2830,1859_270652,00.html
I entered the URL in the internet explorer and I get the right page on screen.
In my program, however, no file is created by the call:
URLDownloadToFile(NULL, URLtoaccess, filename, 0, NULL);
with the specified URL in URLtoaccess and a valid file name in filename.
My code works fine with other links I tried; therefor, is something wrong with the URL?

Thanks in advance, Stuart
Avatar of _corey_
_corey_

Please post the section of code downloading the URL and the HRESULT value returned by URLDownloadToFile().

corey
Avatar of Member_3480671

ASKER

I use this code:
int Function(char *URLname, char *filename){
switch(URLDownloadToFile(NULL, URLname, filename, 0, NULL)){
       case E_OUTOFMEMORY:
      SetDlgItemText(hwndDlg,ID_TERRORS,"Errors: insufficient memory.");
      return 0;
      case E_UNEXPECTED:
      SetDlgItemText(hwndDlg,ID_TERRORS,"Errors: unknown.");
                return 0;
}
return 1;
}

The return value of Function() is 1, but no file is being created.
The code works with others URLs, like "http://www.beurs.nl". You don't believe anything's
wrong with this URL, even though it's loaded by the internet explorer?
Please, help me!
I increased the value to 100 points, it's pretty urgent...

Stuart
I don't really know.  Try catching the exact return value, maybe it's not S_OK for some reason.

corey
here is the error I get when I try it. Even if I put Google into the url.

// MessageId: MK_E_SYNTAX
//
// MessageText:
//
//  Invalid syntax
//
#define MK_E_SYNTAX                      _HRESULT_TYPEDEF_(0x800401E4L)
ASKER CERTIFIED SOLUTION
Avatar of chris rrr
chris rrr
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial