CInternetSession::OpenURL don't report wrong http URL

Hi,

I used OpenURL to download a binary file by http.
To my surprise, even if the url is wrong, it return pfile.
Is there a way to know the wrong url?

Thank you

My codes:
  try
  {
 pfile = (CInternetFile*)m_pInetSession->OpenURL(url.data(), 1,
  INTERNET_FLAG_TRANSFER_BINARY, "Accept: */*\r\n\r\n", -1);

   if (pfile) return pfile;

  }
  catch (CInternetException* pEx)
  {
   bSuccess = false;
    TCHAR sz[1024];
    pEx->GetErrorMessage(sz, 1024);
    tech=sz;
    pEx->Delete();
  }



0
Kelvin_gl (33)
8/27/2005 2:21:25 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
1026 Views

Similar Articles

[PageSpeed] 19

"Kelvin" <Kelvin_gl@yahoo.com.cn> wrote in message 
news:eSqKa2qqFHA.1564@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I used OpenURL to download a binary file by http.
> To my surprise, even if the url is wrong, it return pfile.
> Is there a way to know the wrong url?
>
> Thank you
>
> My codes:
>  try
>  {
> pfile = (CInternetFile*)m_pInetSession->OpenURL(url.data(), 1,
>  INTERNET_FLAG_TRANSFER_BINARY, "Accept: */*\r\n\r\n", -1);
>
>   if (pfile) return pfile;
>
>  }

I believe if you examine the contents of pFile, you will see that you got an 
html file that says "File not found" or whatever the server decides to give 
back to you.

The way I check for an error after OpenURL returns is:

  // Check HTTP header to make sure we didn't open an HTML file that says 
"File not found!"
  CHAR szBuffer[80];
  DWORD dwLen = sizeof(szBuffer);
     if ( !m_hInternetFile ||
          !HttpQueryInfo ( m_hInternetFile, HTTP_QUERY_STATUS_CODE, 
szBuffer, &dwLen, NULL) ||
          atoi (szBuffer) >= 300 )
    {
        // There was a problem opening the file
    }

Cheers,
David
http://www.dcsoft.com


0
dc2983 (3206)
8/27/2005 6:17:05 PM
Reply:

Similar Artilces:

VBA code for my report
Hi, I would like to use a modified version of this VBA code for my report, but I’m not sure how. The code is from the 2007 sample Northwind db. It runs in the Quarterly report. Private Sub Report_Open(Cancel As Integer) On Error GoTo ErrorHandler Dim strSQL As String If IsNull(TempVars![Display]) Or IsNull(TempVars![Group By]) Or IsNull(TempVars![Year]) Then DoCmd.OpenForm "Sales Reports Dialog" Cancel = True Exit Sub End If strSQL = "TRANSFORM CCur(Nz(Sum([Sales]),0)) AS X" strSQL = strSQL & " SELECT [" &am...

Receiving error message when trying to view Reports in MS CRM 1.2
When I click on the link Reports (metrics,Statistics) I receive the error: An error has occurred. For more information, contact your system administrator. MS CRM 1.2 running on Windows 2003 I have full rights on this machine so I don't think it's a permissions issue. I have an account on the SQL server as well. Any ideas? Steve, what is your event log error? Are all the crystal services running? Mike "Steve Fitzgerald" <sf@mnetsys.com> wrote in message news:f1885463.0402180745.3ce6654@posting.google.com... > When I click on the link Reports (metrics,Statistics...

Count number of pages of a report
I have report that I need to have the number of pages counted and then the number placed in a text box on a form. I am able to do this using the below code in the report. The problem is first the report has be previewed or printed before it performs this operation. Can I get the number of pages of the report without having to print or preview it and the user seeing this happen? i.e. It does not matter if the report is opened or previewed as long as the user does not see this. Thanks for any help. My code is below: Private Sub Report_Page() Dim intPage As Integer intPage =...

Quarterly and Fiscal Year Report Creation
Hello All, I am in the process of making an awards database for my company. I need to create reports for the Fiscal Year(Oct-Sept) and Quarterly Reports. I have the employees name, Supervisors Name, Recommender's Name, the Awards Name and the Award Amount. I also have when the Award was requested, when it was received back from HR and when it was Presented to the Employee (dates) I would need to create a report for who received what award by quarter and the total amount given out for the quarter. This situation would be the same for the year also. I need to know how to set fiscal ye...

Split shares don't show up in report
I recently installed Money 2005 Standard and have entered details about stocks and later recorded that they were split. For eg. intially I had entered purchase of 1 share for $10 and then recorded the split at 1:1. The account register still shows number of shares as 1 and price as $10s. The account summary also shows that I have just 1 share and not 2. Any help? Same answer to same question. "TomDick" <TomDick@discussions.microsoft.com> wrote in message news:F2FC2358-A296-4A97-AB78-C02665A0BC37@microsoft.com... >I recently installed Money 2005 Standard and have ent...

Crystal Reports Viewer 9 in Microsoft Acess 2003 how does it work?
I had a crystal report that i need to include in Microsoft Access data base, but i don't find any information in help. How can i do that? Thanks Gersam ...

RPC over HTTP problem
I am running an exchange 2003 server in a mixed mode environment (both Exchange and domain environments) and one of the DCs is a windows 2003 DC. I follow the instructions from Microsoft web site to set it up and could not make it to work as it connects only to TCP/IP instead of HTTPS. The only things I could think of probably because I am running in a mixed mode windows 2000 ? or is it because I havenot converted my Exchange 2003 to native mode? Regards Steven Are all of your DC/GCs Windows 2003? (This is a must.) Are you using a certificate from an internal CA or 3rd party to secure...

Reporting/linking across databases
Is this something I can do? I am an intermediate user at best. I can create queries and reports, but know no macros or SQL. I'm sick of having to copy and paste a report 3 times over between DBs. What are my options? Thanks! Maybe you should explain why you need multiple DBs with the same reports. -- Duane Hookom Microsoft Access MVP "Karina M ;)" wrote: > Is this something I can do? I am an intermediate user at best. I can create > queries and reports, but know no macros or SQL. I'm sick of having to copy > and paste a report 3 times over between DBs. W...

Sale Items and reports
Hello, I am new to POS I have been working with it for about six months BUT I am not near as high level as some of you guys.... I believe I can not have a custom report in POS 2.0 but can I not get a report of all the items I have marked "on sale"? That would seem like a standard report to me....or there would be some way of doing it.....Any help would be appreciated.... Where are you tracking the words "on sale"....on the description field? If so, try filtering the report for "contains" ON SALE in the description field - hope this helps... "Biff S...

http://www.coolcampus.8k.com #3
http://www.coolcampus.8k.com ...

Paid Out Report #2
Looking for a report to show paid outs. I saw some old post but can't open them in my newsreader. Any help would be appreciated. Tom This is a multi-part message in MIME format. ------=_NextPart_000_0C49_01C79D8D.73FDC930 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0C4A_01C79D8D.73FDC930" ------=_NextPart_001_0C4A_01C79D8D.73FDC930 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Tom, Find one attached --=20 Jeff=20 Check Point Software =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3...

When the report's parameter query returns an error because of null
I have a report that generates mailing labels for birthday mailing cards. Its record source is a parameter query that asks for the birthday month numeral. The problem is that when there aren't any records for a birthday month, the report opens up with an error. Instead of the report displaying this error, I would like a message box to pop up that says "No records found for this month". How would I go about doing that? Thanks for your help. On Sat, 8 Mar 2008 15:55:20 -0800 (PST), vegathena@gmail.com wrote: >I have a report that generates mailing labels for birthday mailin...

Customer Mainteance Report\Smartlist
Hi there, Due to closing and reopening\closing a fiscal year our Customer last year to date, and year to date amounts are set to 0.00...although life to date is correct. This is also happens when using smart list, customer ytd, last year to dat and life to date fields. When we go into the summary, the last ytd amounts are all there...although they are not showing in these 2 other areas...which are used extensively for our reporting. I am going to run a check links and am not sure of any other utility\procedure other than restoring from a backup that can be run??? Any suggestions?? ...

How to Reconcile Two OnOpen Conditions in a Report?
We have a form frmStudentMarks with a date already in a textbox. We use a macro "macDateControl" with the Windows Mode "Masked" that opens that frmStudentMarks. With that macro we had not to write the date when we had to open a rptStudentMailAddress report. But now we have a module which needs to write =LabelSetup() on the property OnOpen of that report. So how to reconcile these two OnOpen conditions together? Any help will be appreciated. Thank you. ...

importing report from mde to mdb
This is our scenerio: Our previous db person used both ends mdb and mde to make changes, creating some reports, forms and so on so forth. My problem now: How can I import report/form from mde to mdb and vice- versa. As you guess I can't make the changes from mdb and run mde; because there are some reports on the mde end. Thanks a lot "nemony" <anonymous@discussions.microsoft.com> wrote in message news:011501c4fe57$82d3e070$a301280a@phx.gbl... > This is our scenerio: > > Our previous db person used both ends mdb and mde to make > changes, creating some re...

SOP batch posted to wrong month! Ouch
We had a batch erroneously posted to the wrong month (person forgot to change the posting date for the batch). Is there some way to reverse/correct this - it has posted to GL also. Ideally, I would like to get the GL fixed of course, and also the salesperson records (and any others I'm not thinking of). Thanks for any advice. Neil Hi Neil, You can't really 'correct' the problem - what you have to do is reverse the effects. In the sales module you need to void the trx which will cascade up to the other modules. Then you need to reenter the transactions correctly....

reports smart list
Smartlist employee payroll report shows a column for citizen: answered "yes or no". All of my Employees have no under their name. When I enter a new employee, I don't find anywhere where it asks about citizenship. Would this information be found in set-up or w-2 records? This information is from teh Human resources module and can be found by going to: Cards >> Payroll >> Employee >> Human Resources button -or- Cards >> Human Resources >> Employee >> Employee >> Human Resources button Fliehigh "Pamela" wrote: > Smar...

Why is the chart data wrong when I hover over it in Excel 2007?
In Excel 2007, the line and scatter charts do not display the correct x,y values when the cursor is hovered over a data point. Excel 2003 displayed the correct x,y values. Is there a way to correct this problem in the 2007 version? spearl - "Hover" values are correct for me for both Line and XY Scatter chart types in Excel 2007 SP2. To check for SP2, choose Office Button | Excel Options | Resources | About .... If it's not SP2, to get the updates, choose Office Button | Excel Options | Resources | Check for Updates - Mike http://www.MikeMiddleton.com "NonTe...

Reporting frustration
I have been using CRM for over three years. Beginning with V 1.2 and now 3.0. The reporting function to generate, post and read with V1.2 was much simpler. With 3.0 the SDK states: "Prerequisites To make use of the information provided in the Report Writers Guide, the following knowledge and experience is needed: Knowledge of how to write reports for SQL Server Reporting Services. Knowledge of the SQL language and of SQL Server 2000 or SQL Server 2005. Experience writing Reporting Services reports within the Report Designer component of Microsoft Visual Studio .NET 2003." ...

http accounts won't work
They used to work on my other system till HD went. Installed everything new and two or more hotmail accounts won't work. it times out or "A connection to the server could not be established. http://services.msn.com/svcs/hotmail/httpmail.asp is now in offline mode" if you go to file to connect to the hotmail account then it times out. I have set this up with windows xp service pack 1 and 2. any help would be appreciated. ...

Consequences of changing the base table for PivotTable Reports
After creating several PivotTable reports, I found that I needed to add a new column to the original base table. As a result, I lost the column to the right of the newly inserted column. Is there anyway that I can redefine the range of the base table, to include the added and shifted columns, without rebuilding each entire PivotTable report from scratch? Can you pick a column that always has data? And can you use row, too. I used column A for my columns and Row 1 for my headers (no gaps in either). Then Insert|name|define Give it a nice name (myPTRange) and give it a formula like...

Date displayed in Wrong langauge
This is exactly what happened: I used MS Office X and everything has been alright One day all the date / time began to display in German I brought MS Office 2004 and installed it Same goes, all date / time display in German. My Mac has locale / language etc all set properly to English. Anybody has any idea? Thx Eno On 3/28/05 10:59 PM, in article 1112079571.332610.11520@z14g2000cwz.googlegroups.com, "eno tsin" <enotsin@hotmail.com> wrote: > > I used MS Office X and everything has been alright > One day all the date / time began to display in German > I brough...

Writing Reports with local time reflected
Hi! I've been writing reports for CRM3 and all of my time stamps are being reported in GMT (as they should be). Does anyone have any advice for generating reports with these times reflected in the users local time zone? I'd like to write reports for users in different time zones, but have the times show up (for example activities) as they would have occured in local time. Thanks! Hi Sam, I'm no expert, but I would assume the reports are being generated on the SQL reporting server, which is where the time is calculated. I would imagine you could prompt the user for whic...

Crystal Reports 8.5 & APS
I just attained CR 8.5 developer and installed it on my workstation, but I can't seem to figure out how to connect. I do File >> Log on APS, and I put in the admin login and password and under the APS field I've tired the crm server and sql server and nothing works. Theres also a drop down, Logon using Enterprise or NT, and I've tried all combinations and I can't get that to work. Any help will be greatly apprecicated thx, Gary hehe once again I jumped the gun...... totally forgot about that 5th CD.....installed that on my workstation, works like a charm. -Gary &...

Sales Report #3
Hi All Is there any sales report to show detailes like Store-total Sales-Cash Sales-Credit-Span-customer- Change Item/customer -Discount. Cash Sales-Credit-Span: is tender type. Change Item/customer : like one customer change item and total amount for backing item 200$ (e.g). Is there any one he have report like that? Thanks for help M. Own ...