|
Sounds good. I put "nothing" in the string and the call behaved as it did before.
BTW: The InternetOpen(...) appears to return a valid handle.
A call to:
HINTERNET status = InternetConnect(...);
returns a NULL handle. Calling GetLastError() returnes zero, and calling InternetGetLastResponseInfo(...) returns zero with nothing in the string.
It should fail at this point, but is should return a valid error code. Any thoughts on that?
If not, thank you for the first response.
Thanks for your time
|
|
|
|
|
bkelly13 wrote: A call to:
HINTERNET status = InternetConnect(...);
returns a NULL handle.
What does the code look like?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
bkelly13 wrote: A call to:
HINTERNET status = InternetConnect(...);
returns a NULL handle. Calling GetLastError() returnes zero, and calling InternetGetLastResponseInfo(...) returns zero with nothing in the string.
It should fail at this point
Why should it fail?
As mark points out we can't know without the parameters for InternetConnect(). But let's get this out of the way, are you behind a firewall?
led mike
|
|
|
|
|
The code looks like this:
m_InternetConnectHandle = <br />
InternetConnect( m_InternetOpenHandle, <br />
m_IPAddress, <br />
INTERNET_DEFAULT_FTP_PORT,<br />
m_UserName,<br />
m_Password , <br />
INTERNET_SERVICE_FTP, <br />
NULL,
NULL );
<br />
if( m_InternetConnectHandle == NULL )<br />
{ <br />
m_dwErrorValue = GetLastError();<br />
m_ErrorMessage.Format( _T("InternetConnect failed, error %d"), m_dwErrorValue );<br />
AfxMessageBox( m_ErrorMessage, MB_OK );<br />
return;<br />
}
At the time it should have failed because I was trying to access my computer which does not have an FTP site. (Waiting for someone else to get the FTP server ready.) Since then the server was set up and the code works. I still don't know what to do with the last to arguments of the connection function, but is seems to be working.
BTW: The code format looks good in the preview, but not in the posted message. Sorry about that.
Thanks for your time
|
|
|
|
|
When I execute the code below I get:
ERROR_WINHTTP_CANNOT_CONNECT
12029
Returned if connection to the server failed.
link[^]
which is what I would expect since I am behind a firewall which will not allow an FTP connection.
HINTERNET h = InternetOpen( NULL, INTERNET_OPEN_TYPE_DIRECT,NULL,NULL, 0L);
HINTERNET hC = InternetConnect( h, _T("bogus.com"), INTERNET_DEFAULT_FTP_PORT,
NULL,NULL, INTERNET_SERVICE_FTP, WININET_API_FLAG_SYNC, NULL);
if( !hC)
{
msg.Format(_T("Error Number: %d"), GetLastError());
AfxMessageBox( msg);
}
led mike
|
|
|
|
|
I'm not sure how you got a return value of 0 from GetLastError()
when InternetConnect() failed...I get
12029
ERROR_INTERNET_CANNOT_CONNECT
The attempt to connect to the server failed.
For those missing parameters...
dwFlags: There's only one for FTP (INTERNET_FLAG_PASSIVE).
If you don't know what it does then passing 0 is fine.
dwContext: This value will get passed to any WinINET callbacks
you use for the handle acquired. If you're not doing any asynchronous
stuff, then NULL is fine. Typically (in C++) an object pointer is used
so the static callback function(s) have a pointer to an object which is
the context of the callback call.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm trying to load xml documents via the archive (Getting CFile from that for binary data) that gets passed into my CDocument::Serialize method. However, if there is a content or schema problem, I want to throw an exception so the OnOpenDocument method will catch it, return FALSE, etc...
The constants I have to choose from in CFileException::ThrowErrno leave alot to be desired. There is nothing to describe "invalid file content" or something like that.
What should I do in the serialize method to indicate a file content error? (i.e. XML is not well formed)
|
|
|
|
|
bob16972 wrote: The constants I have to choose from in CFileException::ThrowErrno leave alot to be desired.
Maybe you want to create your own exception?
led mike
|
|
|
|
|
I just noticed CException has those two virtual functions.
I guess I should have caught that earlier. If I derive from CException and customize the virtual functions, I'm guessing I should be good to go.
I slapped myself upside the head (twice) for you.
Thanks for the help.
|
|
|
|
|
can anybody tell me how to implement RIS (Remote installation Services ) through windows APIs ..
vineesh
|
|
|
|
|
vineeshV wrote: can anybody tell me how to implement RIS
What does that mean? You want to implement your own proprietary remote installation service?
led mike
|
|
|
|
|
Instructions
Please read the following instructions (related project code) carefully:
You'll be expected to observe good programming standards.
• Project code must follow C++ syntax
• Data used in each project must be retrieve and saved in Text Files
• Your project may cover the concepts learnt in CS201 particularly
1. Structures
2. Dynamic memory allocation
3. Text Files
4. Classes , Friend functions ,Function overloading
• You must include a comment explaining the purpose of every variable you use in your program.
• You must use meaningful, suggestive, self-explanatory variable names.
• Precede every major block of your code with a comment explaining its purpose.
• Indent the code properly for making it more understandable
It should be clear that your project will not get any credit if:
o The project is submitted after due date.
o The submitted project does not open or file corrupt.
o The project is copied.
Note: You have to submit Source code (.cpp) , executable file (.exe) and text files (.txt) of your project.
Objective
The objective of project is to enhance your knowledge and sharpen your analytical and programming abilities so that you can work in a professional environment.
Project Title: Daewoo (a Bus service) Reservation System
Project Description:
This program is supposed to simulate a Reservation System of Daewoo. Using this program, Daewoo ticket reservation agency assistant can perform different tasks related to ticket reservation.
The Daewoo Reservation System will ask the user for the following information :
• Name of passenger
• Departure City
• Destination City
• Date of travel
• Time of travel
• Number of tickets
The Daewoo Reservation System should have the following features:
1. Make Reservation-to reserve ticket/tickets for a passenger and indicate his/her seat number.
2. Modify reservation-to modify the already made reservation
3. Cancel reservation-to cancel a particular reservation
4. Search reservation- to search reservation information of a particular passenger by
a) Passenger name
b) Date of travel
5. Exit –to exit from application
Daewoo Reservation System should also support persistence for passenger ticket reservation records
Supporting simple persistence by any application requires handling of two scenarios
• On start up of application-data (passenger ticket reservation records) must be read from file.
• On end/finish up of application -data (passenger ticket reservation records) must be saved in file.
|
|
|
|
|
Soundz urgentz.
Aasia Naz wrote: Please read the following instructions (related project code) carefully:
Why would I do that?
|
|
|
|
|
Michael Schubert wrote:
Why would I do that?
because:
Michael Schubert wrote: Soundz urgentz.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Somehow, I'm unable to balance this one. Heavier low votes.
|
|
|
|
|
Don't bother: I accept gladly 1.0 votes on humorous posts (or on personal-opinion-based ones). My concerns are about 1.0 votes, without explanations, on technical posts.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Well said, but I still hate the univoters (who do it without reasoning). I wish they could get a life, which they apparently don't seem to have.
|
|
|
|
|
nobody here is going to do your homework for you
|
|
|
|
|
So you ask a public forum to do your assignment, right ?
how much are you willing to pay for us to do something you're supposed to be able to do yourself ?
|
|
|
|
|
Aasia Naz wrote: The objective of project is to enhance your knowledge and sharpen your analytical and programming abilities so that you can work in a professional environment.
You know, asking people to do your homework certainly does not meet the objective of this project.
This is CS201 - a second level course I presume. Is it really that baffling to you ? If so I would seriously consider another area of study.
|
|
|
|
|
Oh my god You didn't even try to mask it. You simply copy/pasted the question that was asked to you without even bothering to adapt it to your public...
It's a real pity that you forgot to put the adress of the guy for which you had to do the work
|
|
|
|
|
Aasia Naz wrote: It should be clear that your project will not get any credit if:
o The project is submitted after due date.
o The submitted project does not open or file corrupt.
o The project is copied.
seems that i wont do this because i care about your grades.
|
|
|
|
|
Your request is in processing.
|
|
|
|
|
I have a really simple question which I cannot seem to find the answer to...
If I allocate memory like this:
char * pArray = (char*)malloc(123);
Then I free it with:
free(pArray);
And the same with:
char * pArray = new char[123];
And
delete[] pArray;
But how would I free an array created like:
WCHAR pwszRealPath[MAX_PATH];
The best answer I can find is that I don't but I would like to know why.
|
|
|
|
|
__DanC__ wrote: how would I free an array created like:
WCHAR pwszRealPath[MAX_PATH];
such an array is created on the stack, and not on the heap.
so basically, no need to free it
it will be destroyed when going out of scope, of at program termination if static/global...
|
|
|
|