How to auto open an Internet connection

How to auto open an Internet connection

Postby Otto » Thu Oct 08, 2009 10:09 pm

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
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to auto open an Internet connection

Postby Antonio Linares » Fri Oct 09, 2009 4:31 pm

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
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How to auto open an Internet connection

Postby Otto » Fri Oct 09, 2009 8:29 pm

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
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to auto open an Internet connection

Postby Antonio Linares » Fri Oct 09, 2009 10:09 pm

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
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How to auto open an Internet connection

Postby Otto » Sun Oct 11, 2009 10:39 pm

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
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to auto open an Internet connection

Postby Daniel Garcia-Gil » Sun Oct 11, 2009 11:49 pm

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
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: How to auto open an Internet connection

Postby Otto » Mon Oct 12, 2009 1:22 pm

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

Re: How to auto open an Internet connection

Postby Otto » Tue Oct 13, 2009 8:24 am

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: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to auto open an Internet connection

Postby Otto » Tue Oct 13, 2009 1:51 pm

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
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: How to auto open an Internet connection

Postby Antonio Linares » Thu Oct 15, 2009 5:38 am

Otto,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How to auto open an Internet connection

Postby Otto » Thu Oct 15, 2009 7:49 am

********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 4 guests