Link to home
Start Free TrialLog in
Avatar of KukiPei
KukiPei

asked on

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.


ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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);
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
Avatar of KukiPei
KukiPei

ASKER

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

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of KukiPei

ASKER

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.