Please enable JavaScript to view this site.

thinBasic Help Manual

Navigation: ThinBASIC Modules > INet

INET_Internet_SetStatusCallback

Scroll Prev Top Next More

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

Sets up a callback function that WinINet functions can call as progress is made during an operation

 

Syntax

 

INET_Internet_SetStatusCallback(hInternet, CallBackFunction)

 

Returns

 

None

 

Parameters

 

Name

Type

Optional

Meaning

hInternet

Numeric

No

The handle for which the callback is set. Usually the handle returned by INET_Internet_OpenUrl function

CallBackFunction

Function

No

Name of a callback function to call when progress is made.

 

Remarks

 

It is sometimes desirable to display status information during a long-term operation.

The structure of the callback function is fixed and MUST BE like the following:

 

CALLBACK Function MyStatusFunction( _

              ByVal hInternet                 As Long , _

              ByVal dwContext                 As Long , _

              ByVal dwInternetStatus         As Long , _

              ByVal lpvStatusInformation     As Long , _

              ByVal dwStatusInformationLength As Long   _

            ) As Long

 

Callback parameters

Name

Type

Optional

Meaning

hInternet

Numeric

No

The handle for which the callback function is called.

dwContext

Numeric

No

Specifies the application-defined context value associated with hInternet.

dwInternetStatus

Numeric

No

A status code that indicates why the callback function is called. This parameter can be one of the following values. See INET Equates. for the list of possible values

lpvStatusInformation

Numeric

Yes

A pointer to additional status information.

StatusInformationLength

Numeric

Yes

The size, in bytes, of the data pointed to by lpvStatusInformation.

 

Restrictions

 

See also

 

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

 

Examples

 

'...

'---Set a callback for hInternet events. Driver will automatically call MyStatusFunction on status change

bResult = INET_Internet_SetStatusCallBack(hFile, MyStatusFunction)

'...

 

'------------------------------------------------------------------

' CallBack function automatically called by Internet driver when

' status change for a specific Internet handle to which a callback

' function has been installed.

' Parameters are mandatory and are defined my Microsoft

' callback template. More info at: http://msdn.microsoft.com/en-us/library/aa385121(VS.85).aspx

'------------------------------------------------------------------

CALLBACK Function MyStatusFunction( _

                ByVal hInternet                 As Long , _   '---Mandatory in thinBasic and in API

                ByVal dwContext                 As Long , _   '---Mandatory in thinBasic and in API

                ByVal dwInternetStatus          As Long , _   '---Mandatory in thinBasic and in API

                ByVal lpvStatusInformation      As Long , _   '---Optional in thinBasic, mandatory in API

                ByVal dwStatusInformationLength As Long   _   '---Optional in thinBasic, mandatory in API

             ) As Long

'------------------------------------------------------------------

  Dim BytesReceived     As DWORD AT 0

  Static TotBytes       As DWORD

 

  Select Case dwInternetStatus 

    Case %INTERNET_STATUS_RECEIVING_RESPONSE

 

    Case %INTERNET_STATUS_RESPONSE_RECEIVED

      '---  Successfully received a response from the server.

      '---  The lpvStatusInformation parameter points to a DWORD value that contains the number, in bytes, received.

      SETAT(BytesReceived, lpvStatusInformation)

      TotBytes += BytesReceived

 

      '---ATTENTION: TotalBytes received can differ from total bytes of the file to be downloaded

    Case Else

      '---In case of other status, just decode it at the bottom.

 

  End Select            

 

End Function

 

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software