it is possible check the level of the wireless ?
I use win ce 50/6.1 HTc TYNT II
// FTP sample developed by Enrico Maria Giordano
#include "Fwce.ch"
#define FILE_ATTRIBUTE_READONLY 1
#define FILE_ATTRIBUTE_HIDDEN 2
#define FILE_ATTRIBUTE_SYSTEM 4
#define FILE_ATTRIBUTE_DIRECTORY 16
#define FILE_ATTRIBUTE_ARCHIVE 32
#define FILE_ATTRIBUTE_NORMAL 128
#define FILE_ATTRIBUTE_TEMPORARY 256
//
// access types for InternetOpen()
//
#define INTERNET_OPEN_TYPE_PRECONFIG 0 // use registry configuration
#define INTERNET_OPEN_TYPE_DIRECT 1 // direct to net
#define INTERNET_OPEN_TYPE_PROXY 3 // via named proxy
#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 // prevent using java/script/INS
//
// manifests
//
#define INTERNET_INVALID_PORT_NUMBER 0 // use the protocol-specific default
#define INTERNET_DEFAULT_FTP_PORT 21 // default for FTP servers
#define INTERNET_DEFAULT_GOPHER_PORT 70 // " " gopher "
#define INTERNET_DEFAULT_HTTP_PORT 80 // " " HTTP "
#define INTERNET_DEFAULT_HTTPS_PORT 443 // " " HTTPS "
#define INTERNET_DEFAULT_SOCKS_PORT 1080 // default for SOCKS firewall servers.
//
// service types for InternetConnect()
//
#define INTERNET_SERVICE_FTP 1
#define INTERNET_SERVICE_GOPHER 2
#define INTERNET_SERVICE_HTTP 3
//
// flags for FTP
//
#define INTERNET_FLAG_TRANSFER_ASCII 1
#define INTERNET_FLAG_TRANSFER_BINARY 2
//----------------------------------------------------------------------------//
function Main()
local oWnd, oTmr
DEFINE WINDOW oWnd TITLE "Timers" ;
DEFINE TIMER oTmr INTERVAL 500 ACTION (oTmr:DeActivate(),oWnd:Say( 10, 17, Time() ), upload(),oTmr:Activate() )
ACTIVATE TIMER oTmr
ACTIVATE WINDOW oWnd ON INIT (oWnd:SetSize( 200, 200, .T. ));
ON CLICK MsgInfo( "Click!" )
oTmr:End()
return nil
//----------------------------------------------------------------------------//
FUNC upload()
LOCAL hInternet, hConnect
local aInfo := {}
LOCAL I := 0
aInfo := Directory( CurDir() + "\*.TXT" )
if Len( aInfo ) > 0
hGprs:=GprsConnect()
hInternet = INTERNETOPEN( "216.117.77.7", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
IF hINTERNET = 0
MSGINFO("ERREUR CONNEXION INTERNET envoi sortant")
RETURN .F.
ENDIF
// hConnect = INTERNETCONNECT( hInternet, "216.117.77.7", INTERNET_INVALID_PORT_NUMBER, "testinfo", "test", INTERNET_SERVICE_FTP, 0, 0 )
hConnect = INTERNETCONNECT( hInternet, "ftp.test.info", INTERNET_INVALID_PORT_NUMBER, "testinfo", "test", INTERNET_SERVICE_FTP, 0, 0 )
//msginfo( " hInternet " + str(hInternet) +" hConnect " + str( hConnect))
IF hConnect = 0
MSGINFO("ERREUR Création CONNEXION FTP envoi sortant ... Abandon transmission ")
RETURN .F.
ENDIF
//? FTPGETFILE( hConnect, "Your remote file", "Your local file", 0, FILE_ATTRIBUTE_ARCHIVE, 0, 0 )
//? FTPPUTFILE( hConnect, "Your local file", "Your remote file", 0, 0 )
// IF file(CurDir() + "\test.txt")=.t.
// msginfo("Datei vorhanden")
// ENDIF
aInfo := Directory( CurDir() + "\*.TXT" )
FOR I := 1 TO Len( aInfo )
msginfo( aInfo[I,1])
//msginfo( FTPPUTFILE( hConnect, CurDir() +"\"+ aInfo[I,1], "/testinfo/STB1/"+aInfo[I,1], 0, 0 ))
if FTPPUTFILE( hConnect, CurDir() +"\"+ aInfo[I,1], "/testinfo/STB1/"+aInfo[I,1], 0, 0 )=.t.
/*
DLL32 FUNCTION FtpPutFile( hFTP AS LONG,
cFileName AS LPSTR,
cDestFile AS LPSTR,;
n1 AS LONG,
n2 AS LONG )
*/
ferase ( CurDir() +"\"+aInfo[I,1])
else
msginfo("konnte nicht gesendet werden: " + aInfo[I,1])
endif
NEXT
INTERNETCLOSEHANDLE( hConnect )
INTERNETCLOSEHANDLE( hInternet )
//msginfo("OK")
endif
RETURN NIL
#pragma BEGINDUMP
#include "windows.h"
#include "wininet.h"
#include "hbapi.h"
#include "initguid.h"
#include "connmgr.h"
LPWSTR AnsiToWide( LPSTR );
HB_FUNC (GPRSCONNECT)
{
// By Pawel
HANDLE phWebConnection = NULL;
DWORD pdwStatus = 0;
//Comprobamos si ya estamos conectados.
ConnMgrConnectionStatus (phWebConnection, &pdwStatus);
if (pdwStatus == CONNMGR_STATUS_CONNECTED)
{
hb_retnl( (long) 0 );
}
else
{
//No estamos conectados.
//CONNECTIONINFO es la estructura que
//le indica al Connection manager como nos queremos conectar.
CONNMGR_CONNECTIONINFO sConInfo;
memset (&sConInfo,0, sizeof (CONNMGR_CONNECTIONINFO));
sConInfo.cbSize = sizeof (CONNMGR_CONNECTIONINFO);
sConInfo.dwParams = CONNMGR_PARAM_GUIDDESTNET; //Queremos usar parametros "GuisDesNet"
sConInfo.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE; //Esta es la prioridad mas alta.
sConInfo.dwFlags = CONNMGR_FLAG_PROXY_HTTP;
sConInfo.bExclusive = TRUE ; //Permitimos compartir la conexion con otras aplicaciones.
sConInfo.bDisabled = FALSE;
sConInfo.guidDestNet = IID_DestNetInternet;
if (ConnMgrEstablishConnection (&sConInfo, &phWebConnection) == S_OK)
{
unsigned int k;
for( k = 0; k < 8; k ++)
{
ConnMgrConnectionStatus(phWebConnection,&pdwStatus);
if (pdwStatus == CONNMGR_STATUS_CONNECTED)
{
hb_retnl( (long) phWebConnection );
}
if (pdwStatus == CONNMGR_STATUS_CONNECTIONCANCELED || pdwStatus == CONNMGR_STATUS_WAITINGCONNECTIONABORT)
{
hb_retnl( (long) -1 );
}
Sleep (2500);
}
hb_retnl( (long) phWebConnection );
}
else
{
hb_retnl( (long) -1 );
}
}
}
HB_FUNC (GPRSRELEASE)
{
HANDLE hCon= NULL;
ConnMgrReleaseConnection( ( HANDLE ) hb_parnl( 1 ),2 );
}
HB_FUNC( INTERNETOPEN )
{
LPWSTR cAgent = AnsiToWide( hb_parc( 1 ) );
LPWSTR cProxyName = AnsiToWide( hb_parc( 3 ) );
LPWSTR cProxyBypass = AnsiToWide( hb_parc( 4 ) );
HINTERNET hInternet = InternetOpen( cAgent, hb_parnl( 2 ), cProxyName, cProxyBypass, hb_parnl( 5 ) );
hb_xfree( cAgent );
hb_xfree( cProxyName );
hb_xfree( cProxyBypass );
hb_retnl( ( LONG ) hInternet );
}
HB_FUNC( INTERNETCLOSEHANDLE )
{
hb_retl( InternetCloseHandle( ( HINTERNET ) hb_parnl( 1 ) ) );
}
HB_FUNC( INTERNETCONNECT )
{
LPWSTR cServerName = AnsiToWide( hb_parc( 2 ) );
LPWSTR cUserName = AnsiToWide( hb_parc( 4 ) );
LPWSTR cPassword = AnsiToWide( hb_parc( 5 ) );
HINTERNET hInternet = InternetConnect( ( HINTERNET ) hb_parnl( 1 ), cServerName, ( INTERNET_PORT ) hb_parnl( 3 ), cUserName, cPassword, hb_parnl( 6 ), hb_parnl( 7 ), hb_parnl( 8 ) );
hb_xfree( cServerName );
hb_xfree( cUserName );
hb_xfree( cPassword );
hb_retnl( ( LONG ) hInternet );
}
HB_FUNC( FTPGETFILE )
{
LPWSTR cRemoteFile = AnsiToWide( hb_parc( 2 ) );
LPWSTR cNewFile = AnsiToWide( hb_parc( 3 ) );
hb_retl( FtpGetFile( ( HINTERNET ) hb_parnl( 1 ), cRemoteFile, cNewFile, hb_parl( 4 ), hb_parnl( 5 ), hb_parnl( 6 ), hb_parnl( 7 ) ) );
hb_xfree( cRemoteFile );
hb_xfree( cNewFile );
}
HB_FUNC( FTPPUTFILE )
{
LPWSTR cLocalFile = AnsiToWide( hb_parc( 2 ) );
LPWSTR cNewRemoteFile = AnsiToWide( hb_parc( 3 ) );
hb_retl( FtpPutFile( ( HINTERNET ) hb_parnl( 1 ), cLocalFile, cNewRemoteFile, hb_parnl( 4 ), hb_parnl( 5 ) ) );
hb_xfree( cLocalFile );
hb_xfree( cNewRemoteFile );
}
#pragma ENDDUMP
// Testing the FiveWin new Internet Classes
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local oWnd, oTmr
DEFINE WINDOW oWnd TITLE "Timers"
DEFINE TIMER oTmr INTERVAL 10000 ACTION (oTmr:DeActivate(),oWnd:Say( 10, 17, Time() ), upload(),oTmr:Activate() ) of oWnd
ACTIVATE TIMER oTmr
ACTIVATE WINDOW oWnd ;
ON CLICK MsgInfo( "Click!" )
oTmr:End()
return nil
//----------------------------------------------------------------------------//
FUNC upload()
local oInternet := TInternet():New()
local oFTP := TFTP():New( "ftp.test.info", oInternet,"testinfo", "test" )
local aFiles
LOCAL handle
local cFile := ""
if ! Empty( oFTP:hFTP )
/*
DLL32 FUNCTION FtpSetCurrentDirectory(
hFTP AS LONG,
cDirName AS LPSTR ) ;
AS BOOL PASCAL ;
*/
FtpSetCurrentDirectory(oFTP:hFTP, "/testinfo/STB1/")
aFiles = oFTP:Directory("*.*" )
IF len(aFiles) > 0
AEval( aFiles, { | aFile | msginfo( aFile[ 1 ] ),cFile := ALLTRIM( aFile[ 1 ] ),;
cFile := STRTRAN(UPPER(cFile),".TXT",".LTX"),;
memowrit( "c:\dbf\" + cFile, ("STBWEB "+DTOC(date())+" / "+time()) ) ,;
FtpGetFile (oFTP:hFTP,aFile[ 1 ], "c:\dbf\" + aFile[ 1 ] ,.t.,0,0,0 ) ,;
oFTP:DeleteFile( aFile[ 1 ]),;
ferase ("c:\dbf\" + cFile) } )
ENDIF
/*
DLL32 FUNCTION FtpGetFile(
hFTP AS LONG, = INTERNETCONNECT
cRemoteFile AS LPSTR
cLocalFile AS LPSTR
lOverWrite AS LONG
n1 AS LONG
n2 AS LONG
n3 AS LONG
*/
else
MsgAlert( "oFTP:hFTP is null" )
endif
oInternet:End()
//MsgInfo( "Done!" )
return nil
//----------------------------------------------------------------------------//
Return to FiveWin for Pocket PC
Users browsing this forum: No registered users and 4 guests