How to auto open an Internet connection

Post Reply
User avatar
Otto
Posts: 6403
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 24 times
Been thanked: 2 times
Contact:

How to auto open an Internet connection

Post 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Antonio Linares
Site Admin
Posts: 42520
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: How to auto open an Internet connection

Post 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 ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Otto
Posts: 6403
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 24 times
Been thanked: 2 times
Contact:

Re: How to auto open an Internet connection

Post 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Antonio Linares
Site Admin
Posts: 42520
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: How to auto open an Internet connection

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Otto
Posts: 6403
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 24 times
Been thanked: 2 times
Contact:

Re: How to auto open an Internet connection

Post 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: How to auto open an Internet connection

Post by Daniel Garcia-Gil »

Hi Otto.

Put it to end of main function

Code: Select all | Expand

#pragma BEGINDUMP

#include <windows.h>

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

#pragma ENDDUMP
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
Otto
Posts: 6403
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 24 times
Been thanked: 2 times
Contact:

Re: How to auto open an Internet connection

Post by Otto »

Hello Daniel, hello Antonio,
I inserted the following msginfo's.

Code: Select all | Expand


   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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
Posts: 6403
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 24 times
Been thanked: 2 times
Contact:

Re: How to auto open an Internet connection

Post 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
Posts: 6403
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 24 times
Been thanked: 2 times
Contact:

Re: How to auto open an Internet connection

Post by Otto »

I missed the function GprsConnect().
Now all is working.

GprsConnect needs cellcore.lib.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Antonio Linares
Site Admin
Posts: 42520
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: How to auto open an Internet connection

Post by Antonio Linares »

Otto,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Otto
Posts: 6403
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 24 times
Been thanked: 2 times
Contact:

Re: How to auto open an Internet connection

Post by Otto »

********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Post Reply