How to change Working offline to working online

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.


KukiPeiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jaime OlivaresSoftware ArchitectCommented:
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
Jaime OlivaresSoftware ArchitectCommented:
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

KukiPeiAuthor Commented:
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
Jaime OlivaresSoftware ArchitectCommented:
Use:
#define INTERNET_OPTION_IGNORE_OFFLINE 77

Good luck,
Jaime.
0
KukiPeiAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.