downloading files from http server

hi! i've got following problem: i have to download a .dat file from http 
server. I'm trying to do this using CHttpFile. When the file has extension 
like .htm or html evetithing works fine, but when m change the extension to 
..dat the program throws exception (place: pFile->SeekToEnd() - i'm doing this 
to get file size). How to correct this kind error?
0
menkaur (5)
8/14/2004 7:57:01 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
829 Views

Similar Articles

[PageSpeed] 39

How about using URLDownloadToFile? Its rather straightforward.

--
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com


"menkaur" <menkaur@discussions.microsoft.com> wrote in message
news:22491173-E754-4958-B181-9E70028C74D2@microsoft.com...
> hi! i've got following problem: i have to download a .dat file from http
> server. I'm trying to do this using CHttpFile. When the file has extension
> like .htm or html evetithing works fine, but when m change the extension
to
> .dat the program throws exception (place: pFile->SeekToEnd() - i'm doing
this
> to get file size). How to correct this kind error?


0
ajaykalra (6842)
8/14/2004 1:31:40 PM
Cool function, but I'm getting the same problem.
Following code works write:

int _tmain(int argc, _TCHAR* argv[])
{
	if(URLDownloadToFile(NULL,
		"http://localhost/myfile.htm",
		"myfile.dat",
		NULL,NULL)!=S_OK)
	{
		MessageBox(0,"Failed!","",0);
	}
	return 0;
}

and this code failes:

int _tmain(int argc, _TCHAR* argv[])
{
	if(URLDownloadToFile(NULL,
		"http://localhost/myfile.dat",
		"myfile.dat",
		NULL,NULL)!=S_OK)
	{
		MessageBox(0,"Failed!","",0);
	}
	return 0;
}

may be there is somethisng in iis configuration, but i can't see enything.
0
menkaur (5)
8/15/2004 4:11:02 AM
may be you know: is there a function like URLDownloadToFile to save my file 
on ftp server?
0
menkaur (5)
8/15/2004 4:15:02 AM
Reply:

Similar Artilces:

RNDIS .INF file signing process
I would like to know what is the best procedure to follow up, in order to sign our .INF file that uses the RNDIS Windows driver. The idea is to eliminate the prompt-message raised at installation time by Windows saying that the driver was not validated by Windows Logo Program.The .INF file points only to already installed .sys Windows files for RNDIS. Thank You! ...

Project Server file versions
In Project Server 2007 is there a way to save off snapshots of a schedule? Currently we check our schedules into Sharepoint, which has file revision history built in, but Project Server 2007 doesn't seem to have a similar capability. I realize I can use baselining to track differences between points in a project history, but let's say for example I make a series of updates to a schedule, publish that project into Project Server, only to find out later that the situation has changed and I need to back out all those changes. How would I get back? I suppose one soluti...

Lost File Share #3
Before 15 January, I had 2 PC's set to share a calendar (via email). However, on 15 January, one of the PC's received the following message: "Oulook caused invalid page fault in module fldpub.dll at 015f:4c51a697". I went to the support page and printed the resolutions for that error. However, since then, the calendar does not share. How can I share (via email) again? One of the PC's is a laptop and is only connected to the network during the day (that is why I am/was sharing the calendar via email versus putting the calendar on the shared drive of the net...

2008 Terminal Server on SBS2003 domain
I’m trying to implement a 2008 Terminal Server on an SBS 2003 domain. I found that the connect server wizard did not work. I manually added the 2008 server to the sbs2003 domain. I setup and configured terminal service licensing with no problems I setup all applications with no problems. However, when we started testing from a remote office we receive an error - The security database on the server does not have a computer account for this workstation trust relationship. Could anyone help with this issue? me wrote: >I’m trying to implement a 2008 Terminal Server on an SBS ...

Outlook 2003
Here's the problem: Every tiem I open Outlook it displays an error message that my Exchange server is unavailable. What I know: I know the Exchange server is up & running without any problems. The desktop computer is on the network and can browse and ping different devices. DNS is resolving names properly. Does anyone know what I can do to fix this? ...

Connection to server in outlook
How do I fix the error in outlook 2003 that says "A connection to the server could not be established". Thanks Check your server settings and use the Test Account Settings option. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After furious head scratching, sovitj5 asked: | How do I fix the error in outlook 2003 that says "A connection to the | server could not be established". | | Thanks I got th...

where can I find CWinApp file in a regular dll (not extension) wizard created project
Hi. I created a dll using the regular (not extension) dll wizard in vc++ 6.0. I was wondering where I can find this CWinApp file so I can put initialization code and exit code in it? I don't see it in the file view and of course I am not very experienced with this ide. thanks for probably the obvious. Jeff Kish If it is not an MFC DLL, it probably doesn't have a CWinApp class. Find In Files is a useful tool to know about. Look for DllMain. See what it does on entry. If it doesn't call InitInstance, then you don't have a CWinApp class. joe On Wed, 02 May 2007 1...

Restoring Backup pst files
I backed up my Outlook files and want to bring them back into Outlook. I attempted to import them from the backup location only to be informed that I don't have permission to do this. The whole point of backing them up was to restore them after a recent upgrade of my OS. Can anyone advise me how this can be done. I need to access the emails and contacts. Do not use the import feature. Simply copy back the pst-file from you backup location to a convenient place such as My Documents\Outlook. If this is from a read only location such a CD or DVD, make sure the "Read Onl...

Rename crm server
Hello, I have one little question. Is there some problems with crm when I rename computer name of crm server? Thanks a lot Renaming your crm server (stand alone CRM server) should be ok. Besure to update the DNS and any network settings in your environment depending on the previous server name. Your Outlook and Web client also needs to be updated. Worst case scenaro - uninstall/reinstall CRM server keeping existing database. Frank Lee Workopia, Inc. www.workopia.com "Fanda Koudel" wrote: > Hello, I have one little question. Is there some problems with crm when I > r...

import fixed-length text file into excel
- 2 2299 Del Pietro M Wintervill NC 1:18:26 2:44:0 2:44:11 6:16 - 1 2045 Robert Marchinko M Salisbury NC 1:15:34 2:31:1 2:31:20 5:47 I have a text file where each field starts at same column and of th same length in each record. I tried cut&Paste, I tried opening it in excel as a tab delimited file I tried as a fixed-length file None of these worked. Data came in scrambled or into scrunched columns If the data were a table then cut&paste works great. What's the secret in loading above 2 records into Excel? I couldn' simulate the look ...

Download messages
In Outlook Express, there used to be an option not to download email messages for a specific account. Is it possible to do this with Outlook 2002? TIA, Pete If you *never* want to download messages from that account to Outlook, you can edit your Send/Receive Groups so that the account in question is in a "Receive Only" group. -- Jocelyn Fiorello MVP - Outlook *** Messages sent to my e-mail address will NOT be answered -- please reply only to the newsgroup to preserve the message thread. *** In news:uya0g31vDHA.2308@TK2MSFTNGP11.phx.gbl, Night Owl wrote: > In Outlook Ex...

saving an imported file as xl template
I have an excel template and i imported data from another application how do i save it to that template? I do this everyday. Thanks Dakota Are you looking for a macro suggestion? If yes, then try recording a macro when you do it once. Post back with some more details if you get stuck. dakota wrote: > > I have an excel template and i imported data from another > application how do i save it to that template? I do this > everyday. > > Thanks > Dakota -- Dave Peterson ec35720@msn.com ...

File Sharing
I have been trying to set up a folder to share on my home network. I go through the procedure and click done, but the folder does not show up as being shared. (I do not get the little icon on the folder). When I try to see it from the other computer it is not there. The printers are all there, and the windows preset folder are there. I disabled password and made sure that file and print sharing were enabled. The only computer I am having the problem with is the VISTA computer. The XP and Win7 work fine. Where am I going wrong? Thanks in advance Chris "Chris...

Web Browser Control on MFC View will crash application when view is destroied after loading XML file
This is a multi-part message in MIME format. ------=_NextPart_000_0006_01C61216.9AE57FB0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Dynamically create an web browser control and put it on a view in a MDI = application. Navigate the control to a XML file on the local machine, = with style sheets in the same directory. Then, after closing the view, = the application will crash in about 2 minutes. And it consistantly = throws an exception at this line in wincore.cpp // call original wndproc for default handling if (bCallDefault) lRes...

How to copy a file from a disk to a specified sector of another di
Hi, I want to perform the following operations given below. 1. Read a file from a disk 2. Write the same file to another disk 3. In the second disk the written file should be on the same cylinder/track/sector as it is on the first disk. Hoping to get a reply soon. TIA. regards, Jahfer V P. you can't do this at a file level. Thanks Vipin "Jahfer V P" <Jahfer V P@discussions.microsoft.com> wrote in message news:846B7A49-C2FC-405C-8B96-4CF48356717A@microsoft.com... > Hi, > > I want to perform the following operations given below. > > 1. Read a file fro...

Saving e-mails on server
I am having a problem with my e-mails being saved on the server of my internet provider. When that file is full, I do not receive any e-mails. I have gone onto providers website and deleted the 152 or so messages. One would think that would fix the problem, but no soap. I am told that my Outlook is set up to save these messages to the server? Any thoughts or suggestions? Or if you really do want them on the server because you check your email from multiple PCs, just leave the box checked but then check one of the other boxes for Delete after XX days or Delete when you delete the m...

Archive file size #2
Yesterday, I decided to split my archive file that is around 1.2gb size. So I created a new archive file (old archive.pst), and archived archive.pst to that. It all seemed to work, but the size of the original file is to all intents and purposes the same! How can that be? I thought archiving MOVED the files rather than copying them. Can anyone tell me what is going on and how to reduce the size of my original archive file? Many thanks rdc You need to compact the PST file after removing items out of it. This is done by right clicking on the top folder ("personal folders&q...

Excel Link to another Excel file and formulas
I have a formula that I want to "fill" down through my spreadsheet ='I:\filepath\[filename.xls]worksheet!$B$5 When I fill the formula down it does not change the reference. e.g. ='I:\filepath\[filename.xls]worksheet!$B$6 ='I:\filepath\[filename.xls]worksheet!$B$7 ='I:\filepath\[filename.xls]worksheet!$B$8 Everything remains as referencing $B$5 How can I get around this issue? Thanks, RICK The problem is that your use of an absolute reference is holding the cell reference constant. Try changing the $B$5 to: $B5 if you want to keep the column set as B as you...

slow outlook after changed adress of exchange server
after we have migrated accounts from one to another mailserver the outlook2000 clients (after changing te settings) are very slow and sometimes they even hang. I supose there are some cached settings....but can's find them. Who can helpme out. P.S. deleting the profile and making a new one works, but there must be another way.... ...

How to send a Publisher file via e-mail
I would like to be able to send flyers (made with Publisher 2000) via e-mail to our clients but many recipients do not have publisher in order to open the attachment. does anyone have any suggestions? PDF is the way to do it. No other satisfactory method. -- Might be the simplistic answer but.... Convert then to PDF first. ther's no reader available for Publisher but Adobe Acrobat is free everywhere. -- Best Regards, Bill Frost. Liverpool. U.K. (Outgoing mail Virus checked by Norton AV 2002) "Cathy" <anonymous@discussions.microsoft.com> wrote in message news:E21...

OWA use HTTP and HTTPS
Hello, I want to know if it`s possible to use both connection methods. Maby some user cant use the secure way so there most be another way. is it possible to use asswel the unsecure way as the secure way? Thnx, Jos On 4 Oct 2006 23:45:24 -0700, "Josvds" <josvds@gmail.com> wrote: >Hello, > >I want to know if it`s possible to use both connection methods. >Maby some user cant use the secure way so there most be another way. > >is it possible to use asswel the unsecure way as the secure way? > >Thnx, >Jos There shouldn't be any reason a user ca...

Unable to save an attachment to note in CRM
CRM has been deployed for about 8 months at our company. We previously had no problem attaching notes. Beginning today, we receive the following error when attempting to add an attachment to a note: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The page cannot be displayed The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access. -------------------------------------------------------------------------------- Please try the following: Contact the Web site administrator if you believe that this request should be allowed. Make sure that the...

SBS2008 Premium
Many apologies, I've probably asked this before, but I don't recall getting a full answer. We've a customer who has purchased SBS2008 Premium. We've used the second server copy to install as a DC at another branch site. We want to use the SQL Server that comes as part of the Premium package to install onto an existing seperate server at the main site which was not part of the SBS2008 Premium package. Are we allowed to do this ? or will it allow us to do this even ? Will the SBS 2008 client CAL's cover this ? They are covering this as part of the SBS2...

importing wab file
how do i import my address book which is a wab file into the contacts of microsoft outlook? ed Outlook cannot import WAB files. You would have to import a wab into OE on the same partition. Then you can import from OE into Outlook. -- Russ Valentine [MVP-Outlook] "ed" <anonymous@discussions.microsoft.com> wrote in message news:03bb01c3dd9e$1cf8bb20$a401280a@phx.gbl... > how do i import my address book which is a wab file into > the contacts of microsoft outlook? > > ed ...

Automated download
How do I schedule MS Money 2004 to download bank statements daily? In microsoft.public.money, KLomax wrote: >How do I schedule MS Money 2004 to download bank >statements daily? Read about "background banking" in Help. ...