[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to change Working offline to working online

Posted on 2004-11-19
6
Medium Priority
?
1,960 Views
Last Modified: 2013-11-20
Hi to all.

I'm working on some application with Visual C++.
I need to download file from ftp server.

I'm using this code:

"
CInternetSession mysession;
CFtpConnection* pFtpConn = mysession.GetFtpConnection("ftp server", "username", "password");
pFtpConn->GetFile("name of the file", "name of the file", FALSE))
"

Everything works fine when "Work offline" in Internet explorer is unchecked. (File->Work offline in IE).
but when  work offline is checked  it does't work.

Can I change work offline to work online from my application and how.

I hope you understand my quastion.
Thanks in advance.


0
Comment
Question by:KukiPei
  • 3
  • 2
6 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 1050 total points
ID: 12632517
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12635562
Maybe this WinInet API function could be useful:

http://msdn.microsoft.com/library/en-us/wininet/wininet/internetcheckconnection.asp

Notice you have to include "wininet.h" and must link Wininet.lib
You can use it as:
InternetCheckConnection(NULL,FLAG_ICC_FORCE_CONNECTION,0);
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12635603
Also you can try with CInternetConnection::SetOption() function member with INTERNET_OPTION_IGNORE_OFFLINE flag.
It will work with IE5 - IE6 only

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cinternetsession.3a3a.setoption.asp
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:KukiPei
ID: 12635721
I tryed

InternetCheckConnection(NULL,FLAG_ICC_FORCE_CONNECTION,0);

but it doesn't work.

Also I tryed INTERNET_OPTION_IGNORE_OFFLINE

code:
CInternetSession mysession;
mysession.SetOption(INTERNET_OPTION_IGNORE_OFFLINE, 1);

but it gives me an error message:
error C2065: 'INTERNET_OPTION_IGNORE_OFFLINE' : undeclared identifier

I'm using Visual c++ 6.0
OS Windows 2000
IE 6

I included "wininet.h" and link Wininet.lib

0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 450 total points
ID: 12635768
Use:
#define INTERNET_OPTION_IGNORE_OFFLINE 77

Good luck,
Jaime.
0
 

Author Comment

by:KukiPei
ID: 12635883
Now I don't have any error messages, but when I start application I get

Debug Assertion Failed!

dialog with abort , retry, ignore.

Maybe I'm using  CInternetSession::SetOption()  wrong.

code is the same:
CInternetSession mysession;
mysession.SetOption(INTERNET_OPTION_IGNORE_OFFLINE, 1);
 
Thanks for trying to help me.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question