Page 1 of 1

How to auto open an Internet connection

PostPosted: Thu Oct 08, 2009 10:09 pm
by Otto
I try with

hInternet = INTERNETOPEN( "http://www.microsoft.com", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )

but I always get back 0 and the connection is not established.

Thanks in advance and best regards,
Otto

Re: How to auto open an Internet connection

PostPosted: Fri Oct 09, 2009 4:31 pm
by Antonio Linares
Otto,

Are you using the emulator or a real device ?

Are you able to open i.e. www.google.com from the internet explorer ?

Re: How to auto open an Internet connection

PostPosted: Fri Oct 09, 2009 8:29 pm
by Otto
Hello Antonio,
I am useing a real device and I am able to open internet from the internet explorer.
Thanks in advance
Otto

Re: How to auto open an Internet connection

PostPosted: Fri Oct 09, 2009 10:09 pm
by Antonio Linares
Otto,

Please call MsgInfo( GetLastError() ) to retrieve the specific error message

http://msdn.microsoft.com/en-us/library/aa385096(VS.85).aspx

Re: How to auto open an Internet connection

PostPosted: Sun Oct 11, 2009 10:39 pm
by Otto
Hello Antonio,

What do I have to link to resolve getLasterror?
Thanks in advance
Otto

ftp1.c
ftp1.obj : error LNK2001: unresolved external symbol HB_FUN_GETLASTERROR
ftp1.exe : fatal error LNK1120: 1 unresolved externa
ls

Re: How to auto open an Internet connection

PostPosted: Sun Oct 11, 2009 11:49 pm
by Daniel Garcia-Gil
Hi Otto.

Put it to end of main function

Code: Select all  Expand view
#pragma BEGINDUMP

#include <windows.h>

HB_FUNC( GETLASTERROR )
{
   hb_retnl( (LONG) GetLastError() );
}

#pragma ENDDUMP

Re: How to auto open an Internet connection

PostPosted: Mon Oct 12, 2009 1:22 pm
by Otto
Hello Daniel, hello Antonio,
I inserted the following msginfo's.

Code: Select all  Expand view

   hInternet = INTERNETOPEN( "http://www.microsoft.com", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
    MSGINFO( str(GetLastError() ) + "    1" )
 
   IF hINTERNET = 0
      MSGINFO("INTERNETOPEN ERREUR CONNEXION INTERNET envoi sortant")
      RETURN .F.
  ENDIF
 
hConnect = INTERNETCONNECT( hInternet, "ftp.test.info", INTERNET_INVALID_PORT_NUMBER, "user", "pw", INTERNET_SERVICE_FTP, 0, 0 )
 
MSGINFO( str(GetLastError() ) + "    2" )
   IF hConnect = 0
      MSGINFO("INTERNETCONNECT ERREUR Création CONNEXION FTP envoi sortant ... Abandon transmission ")
      RETURN .F.
   ENDIF
MSGINFO( str(GetLastError() ) + "    3" )
 



If internet is closed I get following error codes:
msginfo 1 |0
msginfo 2 |12007
msginfo 3 | not reached

then I switch to opera9 and open a homepage and switch back to my own program:

msginfo 1 |0
msginfo 2 |183
msginfo 3 | 120
and the file is send.

Best regards,
Otto

Re: How to auto open an Internet connection

PostPosted: Tue Oct 13, 2009 8:24 am
by Otto
Only as an information that the setup of the handy is correct.

I tested with the CMHELPER sample (cpp) from Mobile 6 SDK.
This sample opens the connection.
Program Files\Windows Mobile 6 SDK\Samples\PocketPC\CPP\MFC\CMHELPER

Best regards,
Otto

Re: How to auto open an Internet connection

PostPosted: Tue Oct 13, 2009 1:51 pm
by Otto
I missed the function GprsConnect().
Now all is working.

GprsConnect needs cellcore.lib.

Best regards,
Otto

Re: How to auto open an Internet connection

PostPosted: Thu Oct 15, 2009 5:38 am
by Antonio Linares
Otto,

Would you mind to post the modified example source code ? thanks :-)

Re: How to auto open an Internet connection

PostPosted: Thu Oct 15, 2009 7:49 am
by Otto