Introduction

The LEADTOOLS Internet features are in the LEADTOOLS Raster Pro and above toolkits. These features are unlocked in these toolkits. The LEADTOOLS Internet API provides dynamic link library (DLL) functions which provide the ability to add Internet functionality to your application. LEADTOOLS Internet API includes the following dynamic link library developed by LEAD Technologies, Inc.:

LTNET14N.DLL is a dynamic link library for incorporating Internet functionality, including video conferencing, into your applications.

Please note that the LTNET14n.dll and this help file also contain functions for sending and responding to messages between local and remote computers.

The Internet functionality requires Winsock 2.0 to be installed.

Executable demos are included in all LEADTOOLS products. The executable demos provide a quick and easy way to evaluate the Internet features and performance.

The Internet features come in a WIN32 edition so that it can support development of software applications for any of the following environments:

Windows 3.x NT
Windows 4.x NT
Windows 95


Example Programs

The following example program are in separate EXAMPLES subdirectories (such as C:\LEAD14\EXAMPLES\DLL). The executable files for these examples were compiled with Document/Medical capabilities. To get Document/Medical capabilities, you must buy a LEADTOOLS Document/Medical edition toolkit. Otherwise, if you recompile the examples, the resulting executable files will not have the Document/Medical capabilities.

Note: | You can run the example programs on your system by clicking the appropriate buttons in online help. If you try to run an example program that is not on your system, an error message will appear.
NETCAP | Internet/Capture Demo demonstrates the Capture and Internet capabilities of the LEADTOOLS Internet features in one application.
NETCMD | Internet Commands Demo demonstrates how to send commands over the Internet.


Version History

Current version: | 14.5
Last update: | October 20, 2005

Changes from Version 14 to version 14.5

Changes from Version 13 to Version 14

Changes from Version 12.1 to Version 13

Changes from Version 12 to Version 12.1

Changes from Version 11.5 to Version 12

Changes from Version 11 to Version 11.5

Changes from Version 10 to Version 11

Changes from Version 9.0 to Version 10

Version 9.0


Changes from Version 14 to version 14.5

Version 14.5 of the LEADTOOLS Internet API has not changed from Version 14.


Changes from Version 13 to Version 14

Version 14 of the LEADTOOLS Internet API has changed from Version 13 as follows:

LEADTOOLS Internet API now supports UNICODE.


Changes from Version 12.1 to Version 13

Version 13 of the LEADTOOLS Internet API has not changed from Version 12.1.


Changes from Version 12 to Version 12.1

Version 12.1 of the LEADTOOLS Internet API has not changed from Version 12. Please note that the Internet functions contained in this help file were previously located in the LEADTOOLS Multimedia API help file.

The LEADTOOLS Multimedia toolkits currently include many of the functions documented in the Ltnetdlln.hlp help file. This is the final version of the LEADTOOLS Multimedia toolkit that will contain those functions. In future releases, the functions documented in the Ltnetdlln.hlp help file will only be available in the LEADTOOLS Internet Imaging toolkits.


Changes from Version 11.5 to Version 12

Version 12 of the LEADTOOLS Internet API has changed from version 11.5 as follows:

LEADTOOLS now provides functions for sending commands and responses between local and remote computers. This provides a means of using a "super computer" to store and process large numbers of images, while using a smaller, remote computer to send commands indicating which process to perform and which image to use.

Now uses DirectShow 6.0

Programmatic configuration of video/audio codes has been added.

More control over saving audiostreams has been added.

Additional Windows NT compatibility is now provided.

The rest of this topic lists the new functions in version 12.

INETCOMMANDCALLBACK

INETRESPONSECALLBACK

L_InetAttachToSocket

L_InetCreatePacket

L_InetCreatePacketFromParams

L_InetDetachFromSocket

L_InetFreePacket

L_InetGetCallBack

L_InetSendAttachBitmapCmd

L_InetSendAttachBitmapRsp

L_InetSendCloseWinCmd

L_InetSendCloseWinRsp

L_InetSendCmd

L_InetSendCreateWinCmd

L_InetSendCreateWinRsp

L_InetSendFreeBitmapCmd

L_InetSendFreeBitmapRsp

L_InetSendLoadCmd

L_InetSendLoadRsp

L_InetSendRsp

L_InetSendSaveCmd

L_InetSendSaveRsp

L_InetSendSetRectCmd

L_InetSendSetRectRsp

L_InetSendShowWinCmd

L_InetSendShowWinRsp

L_InetSendSizeWinCmd

L_InetSendSizeWinRsp

L_InetSetCallBack

L_InetSetCommandCallBack

L_InetSetResponseCallBack


Changes from Version 11 to Version 11.5

Version 11.5 of the LEADTOOLS Internet API has not changed from version 11.


Changes from Version 10 to Version 11

Version 11 of the LEADTOOLS Internet API has changed from version 10 as follows:

The following new formats are supported:

FILE_MPEG2


Changes from Version 9.0 to Version 10

The product line in Version 10 has been redesigned. If you are an existing LEADTOOLS customer, please take a moment to familiarize yourself with the new line of products and the new features.

Essentially the changes are as follows:

VBX Pro, ActiveX32 Pro, ActiveX16 Pro, WIN16 Pro, and WIN32 Pro are gone.

ActiveX16/32 Pro is now LEADTOOLS Imaging and includes C, C++, and MFC documentation.

WIN16/32 Pro is now LEADTOOLS Imaging Pro.

The Video module is no longer available as an add-on. LEAD's Multimedia support is included in the following new products: LEADTOOLS Multimedia, LEADTOOLS Multimedia Pro, LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite and LEADTOOLS Medical Imaging.

The Pro-Express document imaging features, annotations, bitonal display filters, fast rotation, ISIS® support and faster compression and decompression are included in all Express editions.

The OCR Module is no longer available. LEAD's OCR support is only in the LEADTOOLS Document Express Suite toolkit.

LEADTOOLS Medical Express contains all of the features present in the Express editions, plus DICOM, 12 and 16 bit grayscale, and window leveling support.

Version 10 of the LEADTOOLS Internet API has not changed from version 9.0.


Version 9.0

Version 9.0 is the first version of LEADTOOLS Internet API.

The rest of this topic lists the new functions in version 9.0.

L_InetAcceptConnect

L_InetClose

L_InetConnect

L_InetGetHostName

L_InetServerInit

L_InetShutDown

L_InetStartUp

L_InetAutoProcess

L_InetClearQueue

L_InetGetQueueSize

L_InetReadData

L_InetSendBitmap

L_InetSendData

L_InetSendRawData

L_InetSendSound


Copyright notice

Copyright Notices

©Copyright LEAD Technologies, Inc. 1991-2005. ALL RIGHTS RESERVED

Portions of the PCDLIB32.DLL, PCDLIB.DLL, LFFPX7.DLL, LFKODAK.DLL, EKFPIXJPEG140.DLL, PDC_SDK.DLL, PROFIRE.DLL, DC120V154_32.DLL, LFDCR14N.DLL, DCSPROBACK.DLL, DCSPRO3SLR.DLL, LFDCS14N.DLL, and LFKDC14N.DLL files contain material that is ©Copyright Eastman Kodak Company, 1996-2001. This software is based in part on the work of the Independent JPEG Group.

Portions of the LFCRW14N.DLL, LTCMP14.DLL, CDSDK.reg, CDSDK.dll, CDRAPCLS.dll, czs_ui.dll, deimg.dll, deImg010.dll, deImg110.dll, deImg153.dll, deimg301.dll, deimg401.dll, deImg404.dll, deimg602.dll, Deimg603.dll, DeImgd60.dll, pscAdimg.dll, pscCllct.dll, pscCStUI.dll, pscDcd.dll, pscDevUI.dll, pscDvlp.dll, Pscl2STI.dll, pscll.dll, pscParse.dll, pscSetup.dll, psdkdll.dll, psdkReg.dll, psParse.dll. file contain material that is © Canon, Inc. 2002

Portions of the LFFPX7.DLL and LFKODAK.DLL files contain material that is ©Copyright Hewlett Packard, 1996.

Portions of the OCR/ICR/OMR Features and the help file for the OCR/ICR/OMR Features are ©Copyright Scansoft, Inc. 1995-2003. ALL RIGHTS RESERVED

Portions of the Barcode Modules contain material that is ©Copyright Axtel Inc., 1999.

Portions of the LEADTOOLS PDF Plug in and the LEADTOOLS Vector Imaging Pro are ©Copyright 1996, 2000 Artifex Software Inc. All rights reserved.

File filters for decoding MrSID ® and DjVu ® formats are provided under a license from Lizardtech, Inc.

The "FlashPix" format uses Microsoft's OLE structured storage.

Portions of the DICOM help files in Medical Imaging product line are reprinted with permission from the National Electrical Manufacturers Association ©Copyright 1998 by the National Electrical Manufacturers Association. All rights including translation into other languages, reserved under the Universal Copyright Convention, the Berne Convention or the Protection of Literacy and Artistic Works, and the International and Pan American Copyright Conventions.

Portions of LEADTOOLS Data Security Add On contain software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/), including cryptographic software written by Eric Young (eay@cryptsoft.com) and by Tim Hudson (tjh@cryptsoft.com). Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. Copyright Tim Hudson 1995-1998 (tjh@cryptsoft.com) All rights reserved.

Portions of LEADTOOLS Data Security Add On contain software based on the MD5 Message Digest Algorithm developed by RSA Data Security, Inc.. Copyright (c) 1991-92 RSA Data Security, Inc. All Rights Reserved.

Portions hereof licensed under US patent 5,327,254 and foreign counterparts.

Portions of the LEADTOOLS ICC Profiles material is © Copyright 2004, International Color Consortium.

Trademarks

LEAD and LEADTOOLS are registered trademarks of LEAD Technologies, Inc.
Microsoft, Windows, Windows NT, Visual Basic, Visual FoxPro, and Microsoft Access are either trademarks or registered trademarks of the Microsoft Corporation.
OS/2® is a registered trademark of International Business Machines Corporation.

TextBridge®OCR is a registered trademark of Scansoft, Inc.

ISIS® is a registered trademark of Pixel Translations, Inc.

ScanAhead™ is a trademark of Pixel Translations, Inc.

FlashPix™ is a trademark of Eastman Kodak Company.

All other brand or product names used in this online help are trademarks of their respective holders.

Address and Contact Information

LEAD Technologies, Inc.
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

(704) 332-5532
FAX: (704) 372-8161
Technical support: (704) 372-9681 or Support@Leadtools.com
Home page: http://www.leadtools.com


Programming with LEADTOOLS Internet Functions

The following topics provide a systematic approach to understanding and using the LEAD Internet API functions:

Implementing Internet Functionality

A Client Server Diagram: Sending Commands and Responses

Sending Commands and Responses

Transferring Data and Sound


Implementing Internet Functionality

The LEADTOOLS Internet features provide Internet functions that allow you to create client server applications that transfer data over the Internet or local intranets. The first step to implementing network capabilities is to initialize the LEADTOOLS Internet DLL using L_InetStartUp. All of the LEADTOOLS Internet functions require that a network connection be established. You can connect to a remote computer using L_InetConnect. You can setup a local computer to act as a server and listen for incoming connection requests using L_InetServerInit. If your application is acting as a server, it can accept connection requests using L_InetAcceptConnect. You can determine who is connected to your server using L_InetGetHostname. To close an open network connection or to shutdown a local server , use L_InetClose.

While a network connection is open, you can:

transfer data and sound between local and remote computers

send commands and responses between a local and a remote computer

LEADTOOLS provides the L_InetAttachToSocket and L_InetDetachFromSocket functions for working with an existing socket.


Transferring Data and Sound

There are two ways to send data, with LEADTOOLS header information and without LEADTOOLS header information (raw). To send data in any of the LEADTOOLS supported image file formats with LEADTOOLS' header information, use L_InetSendData. You can enable auto processing for the receiving computer by calling L_InetAutoProcess to allow LEADTOOLS to check the received data and automatically load it into the appropriate data structure if LEADTOOLS' headers are found. To send data without LEADTOOLS's header information, use L_InetSendRawData. Transferred data will be received by the remote computer in the INETCALLBACK function. If auto process is disabled, the data must be manually read and processed using L_InetReadData. To send sound data, use L_InetSendSound.

To abort a data transfer use L_InetClearQueue. Use L_InetGetQueueSize to find out how much data is currently in the LEADTOOLS internal network send queue. When the Internet session is finished, call L_InetShutDown to shut down the LEADTOOLS Internet DLL and free any memory associated with the Internet DLL.


Sending Commands and Responses

LEADTOOLS provides a number of functions that allow you to send commands and responses between a local and a remote computer. This provides a means of using a "super computer" to store and process large numbers of images, while using a smaller, remote computer to send commands indicating which process to perform and which image to use.

In order to receive commands, an INETCOMMANDCALLBACK function should be set using the L_InetSetCommandCallback function, on the computer that will be receiving commands. If an INETCOMMANDCALLBACK function is not set, the INETCALLBACK function will be used by default for receiving commands. INETCALLBACK is not suitable for handling command parameters and extra data, so it is best to set an INETCOMMANDCALLBACK function. The supported command functions include the following:

L_InetSendCmd

L_InetSendLoadCmd

L_InetSendSaveCmd

L_InetSendCreateWinCmd

L_InetSendAttachBitmapCmd

L_InetSendSizeWinCmd

L_InetSendCloseWinCmd

L_InetSendShowWinCmd

L_InetSendSetRectCmd

L_InetSendFreeBitmapCmd

L_InetSendGetMagGlassDataCmd

When a computer receives a command, the INETCOMMANDCALLBACK function is called. The computer that receives the command should then send a response to the computer that sent the command. The supported response functions include the following:

L_InetSendRsp

L_InetSendLoadRsp

L_InetSendSaveRsp

L_InetSendCreateWinRsp

L_InetSendAttachBitmapRsp

L_InetSendSizeWinRsp

L_InetSendCloseWinRsp

L_InetSendShowWinRsp

L_InetSendSetRectRsp

L_InetSendFreeBitmapRsp

L_InetSendGetMagGlassDataRsp

To receive responses, the computer that sent the original command should also set an INETRESPONSECALLBACK function using L_InetSetResponseCallback.

While the L_InetSendLoadCmd, L_InetSendLoadRsp, L_InetSendSaveCmd, L_InetSendSaveRsp, etc. provide standard image processing commands and responses, the L_InetSendCmd and L_InetSendRsp functions provide a means of creating user-defined commands and responses. These commands and responses may require sending extra data, in the form of a packet, along with the command or the response. LEADTOOLS provides the following functions for creating and freeing packets: L_InetCreatePacket, L_InetCreatePacketFromParams and L_InetFreePacket. For a diagram of a client server set-up for sending commands and responses, refer to A Client-Server Diagram: Sending Commands and Responses.


A Client Server Diagram: Sending Commands and Responses

The diagram given below shows a simple example of a Client - Server connection and a series of function calls used to send commands and responses.

Client | Action | Server
L_InetStartUp | Initialize the LEADTOOLS Internet DLL. | L_InetStartUp
 | Set the computer to act as a server and listen for connection requests | L_InetServerInit
L_InetConnect | --------------------------------------------> The client requests a connection with the server. This generates a call to the INETCALLBACK on the server. | INETCALLBACK
INETCALLBACK | <-------------------------------------------- The server accepts the connection request. This generates a call to the INETCALLBACK function on the client. | L_InetAcceptConnect
L_InetSetResponseCallback | The server sets an INETCOMMANDCALLBACK function using L_InetSetCommandCallback so it will be notified of commands received from the client. The client sets an INETRESPONSECALLBACK function using L_InetSetResponseCallbackL_InetSetResponseCallback so it will be notified of responses received from the server. | L_InetSetCommandCallback
L_InetSendLoadCmd | --------------------------------------------> The client sends a load command to the server to load a specific image. This generates a call to the INETCOMMANDCALLBACK on the server. | INETCOMMANDCALLBACK
INETRESPONSECALLBACK | <------------------------------------------- The server receives the load command and responds by calling L_InetSendLoadRsp. This generates a call to the INETRESPONSECALLBACK function set on the client. | L_InetSendLoadRsp
L_InetSendCmd | --------------------------------------------> The client sends a flip command using the L_InetSendCmd function. This generates another call to the INETCOMMANDCALLBACK function on the server. | INETCOMMANDCALLBACK
INETRESPONSECALLBACK | <------------------------------------------- The server calls L_InetSendRsp in response to receiving the L_InetSendCmdcall from the client. This generates another call to the INETRESPONSECALLBACK function set on the client. | L_InetSendRsp
L_InetSendSaveCmd | -------------------------------------------> The client sends a save command using the L_InetSendSaveCmd function. This generates another call to the INETCOMMANDCALLBACK function on the server. | INETCOMMANDCALLBACK
INETRESPONSECALLBACK | <------------------------------------------- The server calls L_InetSendSaveRsp in response to receiving the L_InetSendSaveCmd call from the client. This generates another call to the INETRESPONSECALLBACK function set on the client. | L_InetSendSaveRsp
L_InetClose | The client has finished sending all the commands and closes the connection to the server. |


Internet Files To Be Included With Your Application

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation. The following subdirectory for the Internet features is created:

REDIST\VIDEO

Redistributable Internet features files.

The LEADTOOLS Internet features require Microsoft DirectShow 6.0 for the Internet functionality and it requires Winsock 2.0 for the Internet functionality. You will be given the opportunity to install one, both or neither of these during installation. If you do not install these during installation, you may install them later using the DirectShow 6.0 Installation and the Winsock 2.0 Installation under LEADTOOLS 14 ActiveXs Registration.

Note: The Internet features are provided for evaluation purposes only. You may not copy or redistribute any of the following files without obtaining the proper license. In some cases, the license is included with your initial purchase of LEADTOOLS. In other cases, you must obtain a license from a third party or enter into a royalty agreement with LEAD to obtain the proper license. For these special licensing situations, see the notes below accompanying the specific file.

Note:

You may not distribute the header files with your application, and you may not provide software development capabilities in your application.

The following table summarizes the files you must include on your distribution diskettes to support the LEADTOOLS Internet features functions on a WIN32 system. (\REDIST\VIDEO subdirectory contains copies of these files.)

Please note that LTKRN is required for ALL API applications. For more information on LTKRN and other files for the Main API, refer to Files To Be Included With Your Application.

Redistributables: | Explanation: | If you are using a standard release without Unicode, the files to use are: | If you are using a standard release with Unicode, the files to use are: | If you are using an evaluation release without Unicode, the files to use are: | If you are using an evaluation release with Unicode, the files to use are:
LTNET | Internet support. LTNET14N.DLL is the LEADTOOLS Internet Support DLL. Also requires the LTFIL DLL and the LEAD file format DLLs. Additional required files are installed by WS2SETUP.EXE (Winsock 2.0). | DLL: LTNET14N.DLL Library: LTNET_N.LIB. | DLL: LTNET14NU.DLL Library: LTNET_NU.LIB. | DLL: LTNET14E.DLL Library: LTNET_E.LIB. | DLL: LTNET14EU.DLL Library: LTNET_EU.LIB.


Installation Directory

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation.

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

The following is a list of the subdirectories in the root directory:

ACROBAT | LEADTOOLS manuals in the PDF format, which you can view and print using Adobe Acrobat. These files are optional and are available when installing from the CD-ROM.
BIN | Executable files for the demonstration programs.
HELP | Online help files.
IMAGES | Sample images and databases containing images.
EXAMPLES\DLL | One subdirectory for each example API program.
EXAMPLES\OCX | One subdirectory for each example ActiveX program.
EXAMPLES\COM | One subdirectory for each example COM program.
EXAMPLES\CLASSLIB | One subdirectory for each example Class Library program.
EXAMPLES\RES | Resource files for the example programs.
INCLUDE | Header files, BAS files, and the ActiveX's MFC interface files for versions of Visual C++ earlier than 4.0.
INCLUDE\CLASSLIB | Header files for the Class Library
LIB | Library files.
REDIST | Redistributable files. These are copies of the LEADTOOLS files and other files that you may need to distribute with your application. For exact information about required files, refer to Files To Be Included With Your Application.


Technical Support

As a registered user, free technical support is available. You must register your software to receive any technical support. Technical support is available 9 a.m. through 6 p.m. Eastern Standard Time. If you are calling by phone, please be at your computer. You can also contact us through the following methods:

Phone: | (704) 372-9681
E-mail: | support@leadtools.com
FAX: | (704) 372-8161
Home page: | http://www.leadtools.com
FTP: | ftp.leadtools.com

You can also contact LEAD by mail at:

LEAD Technologies, Inc.
Attn: Technical Support
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

Before calling technical support, please look in the online documentation and the example programs for an answer to your question.


API Function Groups

Internet Features API Function Groups

Internet Functions

Internet Functions

Support Functions

Callbacks

Version and License Information


Internet Functions

Working with network connections:

L_InetAcceptConnect

L_InetClose

L_InetConnect

L_InetGetHostName

L_InetServerInit

L_InetShutDown

L_InetStartUp

Sending and receiving data over a network connection:

L_InetAutoProcess

L_InetClearQueue

L_InetGetQueueSize

L_InetReadData

L_InetSendBitmap

L_InetSendData

L_InetSendRawData

L_InetSendSound

Command Messages

L_InetSetCommandCallback

L_InetSendCmd

L_InetSendLoadCmd

L_InetSendSaveCmd

L_InetSendCreateWinCmd

L_InetSendAttachBitmapCmd

L_InetSendSizeWinCmd

L_InetSendCloseWinCmd

L_InetSendShowWinCmd

L_InetSendSetRectCmd

L_InetSendFreeBitmapCmd

L_InetSendGetMagGlassDataCmd

Response Messages

L_InetSetResponseCallback

L_InetSendRsp

L_InetSendLoadRsp

L_InetSendSaveRsp

L_InetSendCreateWinRsp

L_InetSendAttachBitmapRsp

L_InetSendSizeWinRsp

L_InetSendCloseWinRsp

L_InetSendShowWinRsp

L_InetSendSetRectRsp

L_InetSendFreeBitmapRsp

L_InetSendGetMagGlassDataRsp

Packet Functions

L_InetCreatePacket

L_InetCreatePacketFromParams

L_InetFreePacket

Using Existing Sockets

L_InetAttachToSocket

L_InetDetachFromSocket

Working with Magnifying Glass

L_InetGetMagGlassData


Support Functions: Callbacks

Support Functions:
Callbacks

INETCOMMANDCALLBACK

INETRESPONSECALLBACK

INETCALLBACK

L_InetGetCallback

L_InetSetCallback

L_InetSetCommandCallback

L_InetSetResponseCallback

L_SetStatusCallBack

STATUSCALLBACK


Support Functions: Version and License Information

Support Functions:
Version and License Information

L_IsSupportLocked

L_UnlockSupport

L_VersionInfo


Data Types

Basic Data Types and Keywords

LEADTOOLS Basic Data Types

Keywords Used in Declarations

Image Information Structures

BITMAPHANDLE

Structures Used with Input and Output Functions

WINDOWS Structures

Internet Packets Data Types

HINETPACK

Internet Command Structures

CMDTYPE

COMMAND

PARAMETER

PARMTYPE

RECTTYPE

RESPONSE


LEADTOOLS Basic Data Types

LEADTOOLS has defined the following basic data types for portability:

Data Type | Definition and Usage
L_BITFIELD | Defined as L_UINT; used as a bit field.
L_BOOL | Defined as L_UINT; used as a boolean value.
L_CHAR | Defined as char; used as a signed 8-bit integer.
L_DOUBLE | Defined as double; used as a double precision floating point number.
L_FLOAT | Defined as float; used as a floating point number.
L_INT | Defined as int; used as a signed integer, 16-bits or larger.
L_INT16 | Defined as short; used as a signed 16-bit integer.
L_INT32 | Defined as long; used as a signed 32-bit integer.
L_UCHAR | Defined as unsigned char; used as an unsigned 8-bit integer.
L_UINT | Defined as unsigned; used as an unsigned integer, 16-bits or larger.
L_UINT16 | Defined as unsigned short; used as an unsigned 16-bit integer.
L_UINT32 | Defined as unsigned long; used as an unsigned 32-bit integer.
L_VOID | Defined as void; used as a void.
L_COMP | Defined as L_UINT; used as a handle to a computer
L_MEDIA | Defined as L_VOID L_FAR *; used as a void pointer
L_TCHAR | Defined as either char or TCHAR. If FOR_UNICODE is defined, then L_TCHAR will be defined as TCHAR.


Keywords Used in Declarations

LEADTOOLS uses the following keywords in declarations of functions, structures, and datatypes:

Keyword | Definition and Usage
L_FAR | Defined as nothing; used as a placeholder.
L_HUGE | Defined as nothing; used as a placeholder.
L_EXPORT | Defined as nothing; used as a placeholder.
L_PASCAL | Defined as nothing; used as a placeholder.
EXT_FUNCTION | Defined as WINAPI; used as an attribute for all toolkit functions.
pEXT_FUNCTION | Defined as EXT_FUNCTION L_FAR *; used as an attribute when defining pointers to toolkit functions.
EXT_CALLBACK | Defined as _cdecl L_FAR; used as an attribute for all toolkit callback functions.
pEXT_CALLBACK | Defined as EXT_CALLBACK L_FAR *; used as an attribute when defining pointers to toolkit callback functions.


BITMAPHANDLE

The BITMAPHANDLE structure serves as a working area for image manipulation and conversion. LEADTOOLS functions use this structure as a bitmap handle for accessing the image in memory and for maintaining the characteristics of the image.

Note:

Fields intended for internal use, such as the pointer to the bitmap, are omitted from the table. If necessary, you can refer to the LTKRN.H header file which describes the entire structure.

Member | Data Type | Description
Width | L_INT | Image width in pixels.
Height | L_INT | Image height in pixels.
BitsPerPixel | L_INT | Number of bits per pixel.
BytesPerLine | L_UINT | Bytes per line, rounded upward to the nearest multiple of four.
Flags.Allocated | L_BITFIELD | TRUE if the bitmap is allocated.
Flags.ConventionalMemory | L_BITFIELD | TRUE if the bitmap is allocated using conventional memory.
Flags.DiskMemory | L_BITFIELD | TRUE if the bitmap is allocated using LEAD's own virtual memory.
Flags.LockedMemory | L_BITFIELD | TRUE if the bitmap memory is locked down.
Flags.Progressive | L_BITFIELD | TRUE if an image is being loaded from a progressive JPEG file.
Flags.Tiled | L_BOOL | TRUE if the bitmap is a tiled bitmap.
Flags.WaitUserInput | L_BITFIELD | TRUE if the animation playback waits for user input.
Flags.Transparency | L_BITFIELD | TRUE if the animation playback uses transparency.
Flags.Compressed | L_BITFIELD | TRUE if the current bitmap is in 1-bit RLE-compressed format. For information about this format, refer to Speeding Up 1-Bit Documents .
Flags.Signed | L_BITFIELD | TRUE if the pixel values in the bitmap are signed.
nColors | L_INT | Number of colors (256 or less) that the bitmap has. If the image has more than 256 colors, this value is zero.
hPalette | HPALETTE | Handle to the image's palette. It can be an optimized palette or a fixed palette.
ViewPerspective | L_CHAR | Where the beginning of the image is stored. Valid values are TOP_LEFT, BOTTOM_LEFT, TOP_RIGHT, BOTTOM_RIGHT, TOP_LEFT90, and TOP_LEFT270. For descriptions, refer to Accounting for View Perspective .
Order | L_INT | Color order of the bitmap. Possible values are ORDER_RGB, ORDER_BGR and ORDER_GRAY.
Size | L_UINT32 | Size of the bitmap image data, in bytes.
DitheringMethod | L_UINT | Dithering method (referenced by some functions). For possible values, refer to the L_DefaultDithering function.
XResolution | L_INT | Horizontal resolution, in dots per inch. Some file formats save this value in the file header.
YResolution | L_INT | Vertical resolution, in dots per inch. Some file formats save this value in the file header.
Left | L_INT | Left offset for animation playback.
Top | L_INT | Top offset for animation playback, based on a TOP_LEFT view perspective.
Delay | L_UINT32 | Animation playback delay in milliseconds (ms).
Background | COLORREF | Background color for animation playback. You can specify a COLORREF value, such as the return value of the Windows RGB macro, or you can use the PALETTEINDEX macro to specify a palette color.
Transparency | COLORREF | Transparent color for animation playback. You can specify a COLORREF value, such as the return value of the Windows RGB macro, or you can use the PALETTEINDEX macro to specify a palette color.
DisposalMethod | L_UINT | Animation playback disposal method. For possible values, refer to Animation Disposal Methods.
LowBit | L_INT | Value indicating the low bit used for window leveling. 0 <= nLowBit <= nHighBit <= (11 for 12-bit grayscale or 15 for 16-bit grayscale). A value of -1 will be treated as 0.
HighBit | L_INT | Value indicating the high bit used for window leveling. 0 <= nLowBit <= nHighBit <= (11 for 12-bit grayscale or 15 for 16-bit grayscale). A value of -1 will be treated as BitsPerPixel -1.
MinVal | L_INT32 | Minimum grayscale value. For every value between 0 and MinVal, Black (RGB(0,0,0)) will be used. For values between MinVal and MaxVal, the gray value to be displayed is calculated by : gray = (index - MinVal) * 255 / (MaxVal - MinVal).(See * below)
MaxVal | L_UINT | Maximum grayscale value. For every value larger than MaxVal, White (RGB(255,255,255)) will be used. For values between MinVal and MaxVal, the gray value to be displayed is calculated by : gray = (index - MinVal) * 255 / (MaxVal - MinVal). (See * below)

* Index is the intensity value of the pixel. If the intensity value is > MaxVal, the color will be White. If the intensity value is < MinVal, the color will be Black. For those intensity values between MinVal and MaxVal, the above equation is used to determine the color, with index equal to the intensity value.

Comments

pBITMAPHANDLE is a pointer to a BITMAPHANDLE structure. Generally, where a function parameter type is pBITMAPHANDLE, you can declare a BITMAPHANDLE variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pBITMAPHANDLE variable is necessary only if your program requires a pointer.

In most cases, the values of fields in the BITMAPHANDLE structure are maintained by LEADTOOLS functions.

Note: A 16-bpp image may be color or grayscale. If you are working with a 16-bit grayscale image, explicitly set BITMAPHANDLE.Order to ORDER_GRAY. By default, the Order for a 16-bit image will be set to ORDER_BGR.

Please note that tiled bitmaps will have Flags.ConventionalMemory set, since the bitmap is allocated in conventional memory. To determine whether a bitmap is "regular memory", do the following:

if (!pBitmap->Flags.Compressed && !pBitmap->Flags.Tiled)
{
//regular bitmap. It is not compressed and it is not
 tiled.
}


CMDTYPE

typedef enum
{
/* predefined commands */
CMD_LOAD = 0, /* load a file */
CMD_SAVE = 1, /* save a file */
CMD_CREATE_WIN = 2, /* create a window */
CMD_SIZE_WIN = 3, /* size a new window */
CMD_CLOSE_WIN = 4, /* close a window */
CMD_SHOW_WIN = 5, /* show/hide the window */
CMD_SET_RECT = 6, /* set bitmap display rectangles */
CMD_GET_MAGGLASS_DATA = 10, /* get MagGlass needed data*/
CMD_USER_REG = 10000, /* start of registered user command values */
CMD_USER_CUSTOM = 20000, /* start of custom user command values */
} CMDTYPE, *pCMDTYPE;

The CMDTYPE data type contains the predefined commands used by the Internet command functions.

Comments

Users are encouraged to register their commands with LEAD. The registered commands will go in the 10000-19999 interval. Registering commands will help avoid conflicts when two different applications talk to each other.

The custom user commands will be known only by the application that sent them.


COMMAND

typedef struct tagCOMMAND
{
CMDTYPE uCmd;
L_UINT32 uNumParams;
pPARAMETER pParams;
L_UINT32 ulLength;
L_CHAR L_FAR
 *pData;
} INETCMD, L_FAR *pINETCMD;

The COMMAND structure is used internally by LEADTOOLS functions.

Member | Description
uCmd | Command id.
uNumParams | Number of parameters for command
pParams | Pointer to a list of parameters.
ulLength | Length of additional data associated with command.
pData | Additional data associated with command.


HINETPACK

LEADTOOLS has defined the following data types for referencing a packet:

Data Type | Definition and Usage
HINETPACK | HGLOBAL.
pHINETPACK | HINETPACK *


PARAMETER

typedef struct tagPARAMETER
{
PARMTYPE uType;
L_UINT32 uLength;
union
{
L_CHAR
 L_FAR *pValue;
L_UCHAR
 L_FAR *puValue;
L_CHAR cValue;
L_UCHAR ucValue;
L_INT16 sValue;
L_UINT16 usValue;
L_INT32 iValue;
L_UINT32 uiValue;
};
} PARAMETER, L_FAR *pPARAMETER;

The PARAMETER structure is used to contain parameter information sent to the INETCOMMANDCALLBACK, and INETRESPONSECALLBACK functions by the calling function.

Member | Description
uType | Type of variable. This has to be one of the LEADTOOLS defined types.
uLength | Length of pValue.
pValue | Actual value of parameter (if the type is PARAM_STRING).
puValue | Actual value of parameter (if the type is PARAM_USTRING).
cValue | Actual value of parameter (if the type is PARAM_CHAR).
ucValue | Actual value of parameter (if the type is PARAM_UCHAR).
sValue | Actual value of parameter (if the type is PARAM_INT16).
usValue | Actual value of parameter (if the type is PARAM_UINT16).
iValue | Actual value of parameter (if the type is PARAM_INT32).
uiValue | Actual value of parameter (if the type is PARAM_UINT32).

Comments

For the L_InetSendXXX functions, the parameter information is passed to the callback function in the pParams parameter. For information on the exact location of the parameter information within the pParams array, refer to the appropriate L_InetSendXXX function.

See Also

Functions:

INETCOMMANDCALLBACK, INETRESPONSECALLBACK, L_InetSendCmd, L_InetSendRsp, L_InetSendLoadCmd, L_InetSendLoadRsp, L_InetSendSaveCmd, L_InetSendSaveRsp, L_InetSendCreateWinCmd, L_InetSendCreateWinRsp, L_InetSendAttachBitmapCmd, L_InetSendAttachBitmapRsp, L_InetSendSizeWinCmd, L_InetSendSizeWinRsp, L_InetSendCloseWinCmd, L_InetSendCloseWinRsp, L_InetSendShowWinCmd, L_InetSendShowWinRsp, L_InetSendSetRectCmd, L_InetSendSetRectRsp, L_InetSendFreeBitmapCmd, L_InetSendFreeBitmapRsp, L_InetSendGetMagGlassDataCmd, L_InetSendGetMagGlassDataRsp


PARMTYPE

typedef enum tagPARMTYPE
{
PARAM_STRING, /* strings */
PARAM_CHAR, /* signed character */
PARAM_UCHAR, /* unsigned character */
PARAM_INT16, /* signed short */
PARAM_UINT16, /* unsigned short */
PARAM_INT32, /* signed integer */
PARAM_UINT32, /* unsigned integer */
PARAM_USTRING, /* unsigned string */
} PARMTYPE, *pPARMTYPE;

The PARMTYPE data type contains the parameter types used by the Internet command functions.


RECTTYPE

typedef enum tagRECTTYPE
{
RECT_SRC, /* source */
RECT_SRCCLIP, /* source clip */
RECT_SRCALL, /* source and source clip */
RECT_DST, /* destination */
RECT_DSTCLIP, /* destination clip */
RECT_DSTALL, /* destination and destination clip */
} RECTTYPE;

The RECTTYPE data type contains the parameter types used by the Internet command functions.


RESPONSE

typedef struct tagRESPONSE
{
L_UINT uNumParams;
pPARAMETER pParams;
L_UINT32 ulLength;
L_CHAR L_FAR
 *pData;
} INETRSP, L_FAR *pINETRSP;

The RESPONSE structure is used internally by LEADTOOLS functions.

Member | Description
uNumParams | Number of parameters for response
pParams | Pointer to a list of parameters.
ulLength | Length of additional data associated with command.
pData | Additional data associated with command.


WINDOWS Structures

BITMAPINFO

This is a Microsoft Windows structure as documented in the Microsoft SDK documentation. For complete documentation on this structure please refer to the Microsoft SDK documentation for BITMAPINFO.

COLORREF

COLORREF is a Windows data type. For further information concerning COLORREF, please refer to the Microsoft SDK documentation.

DWORD

DWORD is a Windows data type, 32 bit unsigned int. For further information concerning DWORD, please refer to the Microsoft SDK documentation.

HANDLE

Handle is a standard Windows structure. For further information concerning HANDLE, please refer to the Microsoft SDK documentation or your compiler's documentation.

HDC

HDC is a standard Windows structure. For further information concerning HDC, please refer to the Microsoft SDK documentation or your compiler's documentation.

HGLOBAL

HGLOBAL is a standard Windows data type. For further information concerning HGLOBAL, please refer to the Microsoft SDK documentation or your compiler's documentation.

HWND

HWND is a standard Windows data type. For further information concerning HWND, please refer to the Microsoft SDK documentation or your compiler's documentation.

LPBYTE

LPBYTE is a standard Windows data type. For further information concerning LPBYTE, please refer to the Microsoft SDK documentation or your compiler's documentation.

LPRECT

LPRECT is a standard Windows structure. For further information concerning LPRECT, please refer to the Microsoft SDK documentation or your compiler's documentation.

LPSTR

LPSTR is a standard Windows data type. For further information concerning LPSTR, please refer to the Microsoft SDK documentation or your compiler's documentation.

OPENFILENAME

This is a Microsoft Windows structure as documented in the Microsoft SDK documentation. For complete documentation on this structure please refer to the Microsoft SDK documentation for OPENFILENAME.


Return Codes

For a list of all possible return codes for LEADTOOLS Internet API functions, refer to LEADTOOLS API Return Codes in the Main API help file.


L_InetAcceptConnect

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetAcceptConnect(hHost, phRemote, pfnCallback, pUserData)

L_COMP hHost; | /* handle of host computer */
L_COMP L_FAR * phRemote; | /* address of variable to update */
INETCALLBACK pfnCallback; | /* pointer to a callback function */
L_VOID L_FAR *pUserData; | /* user defined callback data */

Accepts an incoming connection from a remote computer.

Parameter | Description
hHost | Handle of the host computer which is to accept the connection
phRemote | Address of the variable to be updated with the handle of the remote computer to which hHost is being connected.
pfnCallback | Pointer to a callback function of type INETCALLBACK, for receiving messages for phRemote. Use the function pointer to your callback function as the value of this parameter.
pUserData | Void pointer that you can use to pass one or more additional parameters that the callback function needs.
 | To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID L_FAR *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.
 | If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

You must call L_InetServerInit to get a valid handle for hHost before any connections can be accepted using this function.

After this function returns, phRemote will be updated with the handle of the computer that was requesting the connection.

You can use L_InetGetHostName to see who is trying to connect to hHost, after you accept the connection, using this function. If you then wish to restrict access, you can disconnect phRemote after examining the hostname.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetServerInit, L_InetConnect, L_InetClose, L_InetGetHostName, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

For an example, refer to L_InetServerInit.


L_InetAttachToSocket

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetAttachToSocket(phComputer, hSocket, pfnCallback, pUserData)

L_COMP L_FAR * phComputer; | /* address of a variable to update */
SOCKET hSocket; | /* handle to an existing windows socket */
INETCALLBACK pfnCallback; | /* pointer to a callback function */
L_VOID L_FAR * pUserData; | /* user defined callback data */

Attaches a computer to an existing Windows socket.

Parameter | Description
phComputer | Address of the variable to be updated with the handle of the computer attached to hSocket.
hSocket | Handle of an existing windows socket. After this call, both the computer and socket can be used to send and receive data.
pfnCallback | Pointer to a callback function of type INETCALLBACK for receiving messages for phComputer. Use the function pointer to your callback function as the value of this parameter.
pUserData | Void pointer that you can use to pass one or more additional parameters that the callback function needs.
 | To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID L_FAR *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.
 | If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function will allow you to attach to an existing Windows Socket. (See the Windows SDK for the socket command for more explanation on Windows Sockets). When the computer handle is no longer needed, use L_InetDetachFromSocket to detach from the socket. Calling L_InetDetachFromSocket will close hComputer, but will leave the socket useable (L_InetClose does not need to be called for the computer handle). Do not call L_InetClose unless both the computer handle and the windows socket need to be closed.

If the function is successful, any notifications for this socket are redirected to pfnCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetClose, L_InetDetachFromSocket, L_InetSendRawData, L_InetSendData, L_InetGetQueueSize, L_InetClearQueue
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

// this example will create a socket of type datagrams

#include <winsock2.h>
SOCKET hSocket;
SOCKADDR_IN sin;
L_COMP hComputer;

/* create the socket */
hSocket = socket (AF_INET, SOCK_DGRAM, 0);

// set your callback in here

sin.sin_family = AF_INET;
sin.sin_addr.s_addr = inet_addr("207.238.49.190");
sin.sin_port = htons(1000);

connect(hSocket, (LPSOCKADDR) &sin ,sizeof(sin));

L_InetAttachToSocket(&hComputer, hSocket, NULL, NULL);

// do the things you need…

// detach from the socket when you don’t need to use the LEADTOOLS functions anymore
L_InetDetachFromSocket(hComputer, TRUE, &hSocket);

// restore your callback for the socket…
// delete the socket
shutdown(hSocket, SD_BOTH);

// close the socket
closesocket(hSocket);


L_InetAutoProcess

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetAutoProcess(hComputer, bProcess)

L_COMP hComputer; | /* handle of remote computer */
L_BOOL bProcess; | /* TRUE to auto process received data */

Enables or disables auto processing of received data for a computer.

Parameter | Description
hComputer | Handle of the remote computer for which auto process should be enabled or disabled.
bProcess | Flag that controls auto processing. Set bProcess to TRUE to enable auto process of received data, or FALSE to disable it.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If auto process is enabled when data is received, that data will be checked for LEADTOOLS' headers. If no header is recognized, the data will be treated as user defined data, and the INETCALLBACK function will be called with the INET_USER1_RECEIVED message and the data will be passed in pBuffer. If the header is recognized, the INETCALLBACK function will be called with the appropriate data format message and the data will be passed in pBuffer.

If auto process is disabled when data is received, that data will not be checked for LEADTOOLS' headers. In this case, you must read the data using L_InetReadData in response to the INET_DATA_READY message in the INETCALLBACK function.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetReadData, L_InetSendRawData, L_InetSendData, L_InetSendBitmap, L_InetSendSound, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

For an example, refer to L_InetReadData.


L_InetClearQueue

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetClearQueue(hComputer)

L_COMP hComputer;

/* handle of computer */

Clears the LEADTOOLS internal queue used for sending data.

Parameter | Description
hComputer | Handle of the computer

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

You can use this function to abort data transfers. This function should be used with care because the remote end has no way of knowing that the send queue has been cleared.

If after using this function you send data using L_InetSendData, L_InetSendBitmap, or L_InetSendSound, then the remote end will be able to detect that new data is being sent and it will abort the previous download. However, if you send data using L_InetSendRawData, you must implement your own mechanism to synchronize the local and remote computers and recover from aborted sends.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetGetQueueSize, L_InetSendData, L_InetSendBitmap, L_InetSendRawData, L_InetSendSound, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

For an example, refer to L_InetGetQueueSize.


L_InetClose

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetClose(hComputer, bGraceful)

L_COMP hComputer; | /* handle of computer */
L_BOOL bGraceful; | /* disconnect flag */

Closes either a server setup or a connection with a remote computer.

Parameter | Description
hComputer | Handle of the computer for which connection is to be closed
bGraceful | Flag that determines when the connection is closed. Possible values are:
 | Value | Meaning
 | TRUE | allow all data to be sent before connection is closed.
 | FALSE | close the connection now.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If bGraceful is TRUE, then the connection will be closed after all the data has been sent. If you have sent a large chunk of data immediately before calling L_InetClose, then there is a high probability that not every byte has been sent. Closing with bGraceful = FALSE means that the connection is closed without delay, and with the possibility that the data you sent will be truncated. Closing with bGraceful = TRUE means that the close will be delayed until all the data has been sent. You will be notified of the disconnection in the INETCALLBACK function when you receive the INET_CLOSE message.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetConnect, L_InetServerInit, L_InetSendData, INETCALLBACK, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

For an example, refer to L_InetConnect.


L_InetConnect

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetConnect(pszAddress, nPort, phComputer, pfnCallback, pUserData)

L_CHAR L_FAR * pszAddress; | /* address of the computer to which to connect */
L_INT nPort; | /* port on remote computer to which to connect */
L_COMP L_FAR * phComputer; | /* address of variable to update */
INETCALLBACK pfnCallback; | /* pointer to a callback function */
L_VOID L_FAR *pUserData; | /* user defined callback data */

Connects to a remote computer.

Parameter | Description
pszAddress | Character string containing the address of the computer to which you want to connect
nPort | Port on the remote computer to which to connect
phComputer | Address of variable to be updated with the handle of the connected computer
pfnCallback | Pointer to a callback function of type INETCALLBACK for receiving messages for phComputer. Use the function pointer to your callback function as the value of this parameter.
pUserData | Void pointer that you can use to pass one or more additional parameters that the callback function needs.
 | To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID L_FAR *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.
 | If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function requests a connection to a remote computer. The remote computer must accept the connection by calling L_InetAcceptConnect.

If the connection is successful phComputer is updated with the handle to the connected computer. phComputer can then be used with the other internet functions that require a handle to a computer.

pszAddress can be any URL or an IP address in the Internet dot notation. Ex. http://www.leadtools.com or 207.238.49.130.

The INETCALLBACK function will be called when a connection request is successfully accepted by the remote computer.

Immediately after successfully connecting to a LEADTOOLS server started with L_InetServerInit, the INETCALLBACK function will be called. If auto process is enabled, the message will be INET_USER1_RECEIVED and pBuffer will contain a NULL terminated string containing "LEAD Technologies Server X.X" where X.X is the server version number. If auto process is not enabled, the message will be INET_DATA_READY, and the version string can be read using L_InetReadData.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetClose, L_InetReadData, L_InetSendData, L_InetSendBitmap, L_InetSendSound, L_InetAutoProcess, L_InetServerInit, L_InetGetHostName, L_InetAcceptConnect, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

L_COMP hComp; /* handle of the remote computer */
L_INT nRet;

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize,L_VOID L_FAR*pUserData);

/* note: instead of server_address you need to put the IP
 address
of the computer running the server. You can also put in
the computer name, if the server is running on a local network */
/* you do not need to use MakeProcInstance for 32 bit applications */
nRet = L_InetConnect("server_address",
 1000, &hComp, InetCallback, NULL);
if(nRet != SUCCESS)
MessageBox(NULL, TEXT("Error attempting to connect"),
 TEXT("ERROR"), MB_OK);

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize,L_VOID L_FAR*pUserData)
{
L_TCHAR s[100]; /* set up a buffer to retrieve the name
 of the server */
L_UINT32 sizeof_s = sizeof(s); /* the size of s */

switch(nMessage)
{
case INET_CONNECT:
/* check the status
 and try to get server's name */
if(nError == SUCCESS)
{
/*
 now you can assume you are connected to computer 'hComp' */
if(L_InetGetHostName(hComp, (L_CHAR) s,
 HOST_NAME_IP, &sizeof_s) == SUCCESS)
{
MessageBox(NULL,
 TEXT("You have successfully connected to"), s, MB_OK);
}
/*
 do whatever you want to do with the server here ... */

/*
 remove the next line if you want to keep the connection open */
L_InetClose(hComp, TRUE);
}
else
MessageBox(NULL,
 TEXT("You have failed to connect!"), TEXT("Error"),
 MB_OK);
break;
}
return SUCCESS;

}


L_InetCreatePacket

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetCreatePacket(phPacket, uExtra, pExtra, pszFormat, …)

pHINETPACK phPacket; | /* pointer to a packet */
L_UINT uExtra; | /* size of the binary data*/
L_VOID L_FAR * pExtra; | /* binary data to be sent */
L_CHAR L_FAR * pszFormat; | /* format describing the parameters */
… | /* variable list of parameters */

Creates a packet.

Parameter | Description
phPacket | Pointer to the variable to be updated with the newly created packet.
uExtra | Size of the binary data. Used only if pExtra is not NULL.
pExtra | Binary (extra) data to be sent. Use NULL if there is no binary data to send.
pszFormat | Format of the command parameters. Possible values are:
 | Value | Meaning
 | %d | decimal integer
 | %l | long signed integer
 | %c | character
 | %s | string
 | %ud | unsigned long integer
 | %us | unsigned short integer
 | %ss | signed short integer
 | %bs | unsigned string
 | Variable list of parameters for this command.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function allows the user to create a packet containing the parameters to send to a remote computer. Note that this packet can be used to send both commands and responses. The packet contains a binary chunk (described with uExtra and pExtra) and a variable number of arguments (described by pszFormat). If there are no parameters to send, pszFormat can be either NULL or an empty string ("").

Call L_InetFreePacket when the packet is no longer needed, to free the memory allocated for the packet.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetCreatePacketFromParams, L_InetFreePacket
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_COMP hComputer;

#define CMD_FLIP CMD_USER_CUSTOM + 1
#define CMD_ROTATE CMD_USER_CUSTOM + 2

L_VOID FlipCurrentRemoteBitmap()
{
HINETPACK cmdFlip;

/* Create a packet for a flip command. The remote program would probably interpret it as ‘Flip the current bitmap’. Note that you don’t really have to create a packet for commands with no arguments, since you can pass NULL for the packet. We are just showing that you can use NULL or "" as the format string. */
L_InetCreatePacket(&cmdFlip,0,NULL,NULL);

L_InetSendCmd(hComputer, CMD_FLIP, 1, cmdFlip);

L_InetFreePacket(cmdFlip);
}

/*
This function will rotate a bitmap, but it will pass the bitmap ID as an argument. The bitmap ID will have to be retrieved from the remote computer. One way to get the bitmap id is to process the response from a CMD_LOAD command*/
L_VOID RotateRemoteBitmap(L_UINT uBitmapID)
{
HINETPACK cmdRotate;

/* Create a packet for a rotate command. Note that it contains no binary data, one integer parameter and three unsigned integer parameters */

L_InetCreatePacket(&cmdRotate,0,NULL,"%ud%d%ud%ud",uBitmapID, 45, ROTATE_RESIZE,RGB(255,0,0));

L_InetSendCmd(hComputer, CMD_ROTATE, 2, cmdRotate);

L_InetFreePacket(cmdRotate);
}


L_InetCreatePacketFromParams

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetCreatePacketFromParams(phPacket, uExtra, pExtra, uParams, pParams)

pHINETPACK phPacket; | /* pointer to a packet */
L_UINT uExtra; | /* size of the binary data*/
L_VOID L_FAR * pExtra; | /* binary data to be sent */
L_UINT uParams; | /* number of parameters*/
pPARAMETER pParams; | /* pointer to parameters */

Creates a packet using the specified parameters.

Parameter | Description
phPacket | Pointer to variable to be update with the new packet.
uExtra | Size of the binary data. Used only if pExtra is not NULL.
pExtra | Binary (extra) data to be sent. Use NULL if there is no binary data to send.
uParams | The number of parameters for this packet.
pParams | Pointer to an array of parameters used to create the packet. This is valid only if uParams > 0).

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function allows the user to create a packet, containing the specified parameters, to send to a remote computer. Note that this packet can be used to send both commands and responses. The packet contains a binary chunk (described in uExtra and pExtra) and a fixed number of arguments (described in uParams and pParams).

This function is especially useful for sending an array of PARAMETER structures. This function is an alternative to using L_InetCreatePacket. It might be easier to use for people less familiar with C/C++.

Call L_InetFreePacket when you are done with the packet to free the memory allocated for the packet.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetCreatePacket, L_InetFreePacket
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

#define CMD_REVERSE CMD_USER_CUSTOM + 3

L_UINT guCommandID;

/* This example will create a command with only one parameter*/
L_INT ReverseRemoteBitmap(L_COMP hComputer, L_UINT uBitmapID)
{
PARAMETER Param;
HINETPACK hPacket;
L_INT nRet;

// initialize the parameter
Param.uType = PARAM_UINT32;
Param.uiValue = uBitmapID;

nRet = L_InetCreatePacketFromParams(&hPacket,
 0, NULL, 1, &Param);
if(nRet != SUCCESS)
return nRet;

nRet = L_InetSendCmd(hComputer,
 CMD_REVERSE, guCommandID++, hPacket);

L_InetFreePacket(hPacket);

return nRet;
}


L_InetDetachFromSocket

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetDetachFromSocket(hComputer, bWaitTillQueueEmpty, phSocket)

L_COMP hComputer; | /* handle to a computer */
L_BOOL bWaitTillQueueEmpty; | /* flag that indicates when to detach */
SOCKET L_FAR * phSocket; | /* address of a variable to be filled with the socket */

Detaches the computer handle from its associated Windows socket.

Parameter | Description
hComputer | Handle to the computer that will be detached from its socket. Note that its corresponding socket is not closed. This computer handle should have been created using L_InetAttachToSocket.
bWaitTillQueueEmpty | Flag that indicates when to detach the computer handle from the socket. Possible values are:
 | Value | Meaning
 | TRUE | Detach the socket when the send queue is empty. If the send queue is empty, the computer handle is detached immediately. You will be notified of the detachment in the INETCALLBACK function when you receive the INET_DETACH message. (Recommended)
 | FALSE | Detach the handle immediately. Any data present in the queue is abandoned.
phSocket | The address of a variable to be updated with the windows socket that is being detached. This is an optional parameter and you can pass NULL if you don’t need to know which socket is detached.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function invalidates the computer handle (there is no need to call L_InetClose for the handle).

Note that the socket is not receiving any notifications (read, write, etc). The notification events must be restored to use the socket properly. See WSAAsyncSelect in the Windows SDK help and related functions for more information on notification events.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetClose, L_InetAttachToSocket, L_InetSendRawData, L_InetSendData, L_InetGetQueueSize, L_InetClearQueue
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetAttachToSocket.


L_InetFreePacket

#include "l_bitmap.h"
#include "ltnet.h"

L_VOID EXT_FUNCTION L_InetFreePacket(hResponse)

HINETPACK hResponse;

/* handle to a response object*/

Frees the memory allocated for the packet created by L_InetCreatePacket and L_InetCreatePacketFromParams.

Parameter | Description
hResponse | Handle to an INET response object.

Comments

This function should be called when your program no longer needs the packet object.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetCreatePacket, L_InetCreatePacketFromParams
Topics: | Sending Commands and Responses

A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetCreatePacket.


L_InetGetCallback

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetGetCallback(hComputer, ppfnCallback, ppUserData)

L_COMP hComputer; | /* computer to get the callback data from */
INETCALLBACK L_FAR * ppfnCallback; | /* address of variable */
L_VOID L_FAR * L_FAR * ppUserData; | /* address of variable */

Gets a pointer to the current callback associated with the specified computer.

Parameter | Description
hComputer | Computer handle for which to retrieve the callback data.
ppfnCallback | Address of a variable to be updated with a pointer to the INETCALLBACK function associated with hComputer.
ppUserData | Address of the variable to be updated with the user defined data associated with the callback function.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function, together with L_InetSetCallback, can be used to change user defined data associated with a computer handle.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetServerInit, L_InetAcceptConnect, L_InetConnect, L_InetSetCallback
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_VOID SetNewCallbackData(L_COMP hComputer, L_VOID L_FAR*pData)
{
INETCALLBACK pfnCallback;
L_VOID L_FAR* pUserData;

L_InetGetCallback (hComputer, &pfnCallback, &pUserData);
if(pData != pUserData)
L_InetSetCallback(hComputer, pfnCallback, pData);
}


L_InetGetHostName

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetGetHostName(hComputer, pszName, nType, pulBufferLength)

L_COMP hComputer; | /* handle of remote computer */
L_CHAR L_FAR * pszName; | /* address of buffer to update */
L_INT nType; | /* type of name to retrieve */
L_UINT32 L_FAR *pulBufferLength; | /* address of a variable to be updated with the length of pszName */

Gets either the descriptive name (URL) or the IP address of a remote computer.

Parameter | Description
hComputer | Handle of the remote computer for which hostname should be retrieved
pszName | Address of the buffer to update with the hostname character string
nType | Value indicating the type of name to retrieve. Possible values include:
 | Value | Meaning
 | HOST_NAME_DESCRP | descriptive name of remote computer
 | HOST_NAME_IP | IP address of remote computer
pulBufferLength | Address of a variable to be updated with the required length of the buffer to hold the hostname string.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

hComputer has to be connected for this function to return SUCCESS.

If pszName is NULL, then pulBufferLength will be updated with the required size of the buffer to hold the hostname string. The size will take into account the terminating NULL character.

If pszName is not NULL, then pulBufferLength contains the size of the string copied into pszName. The string will be truncated if the buffer pointed to by pszName is not large enough to contain the entire hostname string.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetConnect, L_InetServerInit, L_InetClose, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

For an example, refer to L_InetConnect.


L_InetGetMagGlassData

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetGetMagGlassData(pBitmap, plColorSize, pColor, pMaskPlane, nMaskPlaneStart, nMaskPlaneEnd)

pBITMAPHANDLE pBitmap; | /* Pointer to the bitmap handle */
L_UINT32 *plColorSize; | /* address of a variable to be updated with the length of pColor */
COLORREF L_FAR * pColor; | /* address of COLORREF array to be updated */
L_UCHAR L_FAR *pMaskPlane; | /* pointer to a buffer that will contain an array of bit flags */
L_INT nMaskPlaneStart; | /* start index of the mask plane array */
L_INT nMaskPlaneEnd; | /* end index of the mask plane array */

Gets the required bitmap pixel colors according to the pMaskPlane array. These colors are necessary for Magnifying Glass to paint the zoomed area.

Parameter | Description
pBitmap | Pointer to the bitmap handle referencing the bitmap from which to get Magnifying Glass data.
plColorSize | Address of a variable to be updated with the required length of the array to hold the required colors.
pColor | Address of the COLORREF array to be updated with the required colors that match the position of needed data on the mask plane array.
pMaskPlane | An array of bit flags which represents a mask plane, this array work as a plane for the parts of the bitmap that is updated or not yet.
nMaskPlaneStart | The start index of the mask plane array.
nMaskPlaneEnd | The end index of the mask plane array.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If pColor is NULL, then plColorSize will be updated with the required size of the array to hold the required colors.

If pColor is not NULL, then plColorSize will contain the size of the colors copied into pColor and pColor will filled with the required colors.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendGetMagGlassDataCmd, L_InetSendGetMagGlassDataRsp,L_InetShutDown
Topics: | Internet Functions

Example

For an example, refer to L_InetSetCommandCallback .


L_InetGetQueueSize

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetGetQueueSize(hComputer, pulLength)

L_COMP hComputer; | /* handle of remote computer */
L_UINT32 L_FAR *pulLength; | /* address of variable to update */

Gets the size of the LEADTOOLS internal send queue.

Parameter | Description
hComputer | Handle of the computer.
pulLength | Address of the variable to be updated with the length of the internal send queue.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If this function returns SUCCESS, pulLength will be updated with the size of the internal send queue. Only actual data will be counted. The LEADTOOLS' headers which pad the data are not counted.

If pulLength is 0, then there is no data in the queue.

If pulLength is between 1 and 0xFFFFFFFE, then it represents the number of bytes in the queue, not counting any LEADTOOLS headers.

If pulLength is QUEUE_NO_DATA (0xFFFFFFFF), then there is no data but the queue is not empty and consists only of LEADTOOLS' headers used for auto process.

Note:

Even if pulLength is 0, then there is no guarantee that all bytes have been sent and you can do a hard close (i.e. L_InetClose(hComputer, FALSE) ).

Winsock (which LEADTOOLS uses) has its own internal queue and we have no access to it. Therefore we have no way of knowing how much data has been sent.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetClearQueue, L_InetSendData, L_InetSendBitmap, L_InetSendRawData, L_InetSendSound, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

L_COMP hComp; /* handle of the remote computer */
L_INT nRet;

L_VOID L_FAR*pUserData = NULL;

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize, L_VOID L_FAR*pUserData);

/* note: instead of server_address you need to put the IP
 address
of the computer running the server. You can also put in
the computer name, if the server is running on a local network */
/* you do not need to use MakeProcInstance for 32 bit applications */
nRet = L_InetConnect("server_address",
 1000, &hComp, InetCallback, pUserData);
if(nRet != SUCCESS)
MessageBox(NULL, TEXT("Error attempting to connect"),
 TEXT("ERROR"), MB_OK);

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize, L_VOID L_FAR*pUserData)
{
L_INT nRet;
static L_CHAR aData[50000] = "Some Data";
L_UINT32 lDataSize;

switch(nMessage)
{
case INET_CONNECT:
/* check the status
 and send some data */
if(nError == SUCCESS)
{
/*
 now you can assume you are connected to computer 'hComp' */
lDataSize
 = sizeof(aData);
nRet
 = L_InetSendData(hComp, aData, &lDataSize,
 IDATA_USER1);

L_InetGetQueueSize(hComp,
 &lDataSize);
/*
 abort the current send if less than 25k have been sent */
if(lDataSize
 > 0 && lDataSize < 25000)
L_InetClearQueue(hComp);

/*
 we can close the connection without data loss with a graceful connection.
 The closing is delayed until after all the data has been sent. remove
 the next line if you want to keep the connection open */
L_InetClose(hComp,
 TRUE);
}
else
MessageBox(NULL,
 TEXT("You have failed to connect!"), TEXT("Error"),
 MB_OK);
break;
}
return SUCCESS;
}


L_InetReadData

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetReadData(hComputer, pBuffer, pulBufferLength)

L_COMP hComputer; | /* handle of remote computer */
L_CHAR L_FAR * pBuffer; | /* pointer to the data buffer */
L_INT32 L_FAR * pulBufferLength; | /* address of length of buffer */

Reads data from a remote computer.

Parameter | Description
hComputer | Handle of the remote computer from which data is being sent.
pBuffer | Address of the buffer to be filled with the read data
pulBufferLength | Address of the variable to be updated with the size of the read data

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

After this function returns, pulBufferLength will be updated with the actual length of read data. This function should only be used if auto process is disabled. You should call this function in response to the INET_DATA_READY message, in the INETCALLBACK function.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetAutoProcess, L_InetSendData, L_InetSendBitmap, L_InetSendSound, L_InetConnect, L_InetClose, L_InetReadData, L_InetServerInit, INETCALLBACK, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

L_COMP hComp; /* handle of the remote computer */
L_INT nRet;

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize,L_VOID L_FAR*pUserData);

/* note: instead of server_address you need to put the IP
 address
of the computer running the server. You can also put in
the computer name, if the server is running on a local network */
/* you do not need to use MakeProcInstance for 32 bit applications */
nRet = L_InetConnect("server_address",
 1000, &hComp, InetCallback, NULL);
if(nRet != SUCCESS)
MessageBox(NULL, TEXT("Error attempting to connect"),
 TEXT("ERROR"), MB_OK);
/*
sometime before closing down the program call L_InetClose(hComp, TRUE)
*/

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize,L_VOID L_FAR*pUserData)
{
L_INT nRet;
HGLOBAL hData;
L_CHAR L_FAR*pData;

switch(nMessage)
{
case INET_CONNECT:
/* check the status
 and send some data */
if(nError == SUCCESS)
{
/*
 set auto process to False to receive INET_DATA_READY */
L_InetAutoProcess(hComp,
 FALSE);
}
else
MessageBox(NULL,
 TEXT("You have failed to connect!"), TEXT("Error"),
 MB_OK);
break;

case INET_DATA_READY:
/* Note: most servers
 (including a LEAD server started with
L_InetServerInit
 will send some form of data right after connection) */
if(nError == SUCCESS)
{
hData
 = GlobalAlloc(GHND, lSize + 1);
pData
 = (L_CHAR L_FAR*)GlobalLock(hData);
if(pData)
{
nRet
 = L_InetReadData(hComp, pData,
 &lSize);
pData[lSize]
 = 0; /* make the data NULL-terminated */
MessageBox(NULL,
 (L_TCHAR*)pData, TEXT("Data received"), MB_OK);

GlobalUnlock(hData);
}
GlobalFree(hData);
break;
}
}

return SUCCESS;
}


L_InetSendAttachBitmapCmd

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendAttachBitmapCmd(hComputer, uCommandID, uBitmapID, uWindowID)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uBitmapID; | /* bitmap id */
L_UINT uWindowID; | /* window id */

Sends an attach bitmap command to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uBitmapID | The ID of the bitmap being attached. If the bitmap is successfully attached, then this bitmap will be painted whenever the window paints itself.
uWindowID | The id of the window that was just created.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The remote computer should respond by calling L_InetSendAttachBitmapRsp in its INETCOMMANDCALLBACK function. This callback function must be set using L_InetSetCommandCallback.

Once the remote computer receives this command it should always paint the specified bitmap inside the specified window. Both the bitmap and the window should exist on the remote computer. The remote computer will most likely paint the window at 1:1 ratio, adding scrollbars if possible. To change the way the bitmap is painted, call L_InetSendSetRectCmd.

The INETCOMMANDCALLBACK function will receive the uBitmapID and uWindowID information in the pParams parameter. The uBitmapID information will be in pParams[0] and the uWindowID information will be in pParams[1].

To receive responses to commands, provide an INETRESPONSECALLBACK function. This function must be set using L_InetSetResponseCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendAttachBitmapRsp, INETRESPONSECALLBACK, INETCOMMANDCALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_UINT guCommandID;

// Note that pszRemoteFilename is a file name on the remote computer!
L_INT AttachRemoteBitmap(L_COMP hComputer, L_UINT uBitmapID, L_UINT uWindowID)
{
return L_InetSendAttachBitmapCmd(hComputer, guCommandID++, uBitmapID, uWindowID);
}


L_InetSendAttachBitmapRsp

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendAttachBitmapRsp(hComputer, uCommandID, uExtra, pExtra, nStatus)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uExtra; | /* length of any extra data */
L_CHAR L_FAR * pExtra; | /* extra data */
L_INT nStatus; | /* status */

Sends an attach bitmap response to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uExtra | The size of the extra data (pExtra). Unused if pExtra is NULL.
pExtra | Pointer to any extra data needed by the response. Pass NULL if the response does not need to pass any extra data.
nStatus | Status of the original command.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function sends a response to an attach bitmap command that was sent from a remote computer using the L_InetSendAttachBitmapCmd.

To receive commands, provide an INETCOMMANDCALLBACK function. This function must be set using L_InetSetCommandCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendAttachBitmapCmd, INETCOMMANDCALLBACK, INETRESPONSECALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSendCreateWinCmd.


L_InetSendBitmap

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendBitmap(hComputer, pBitmap, nFormat, nBitsPerPixel, nQFactor, pulImageLength)

L_COMP hComputer; | /* handle of remote computer */
pBITMAPHANDLE pBitmap; | /* pointer to the bitmap handle */
L_INT nFormat; | /* output file format */
L_INT nBitsPerPixel; | /* resulting file's pixel depth */
L_INT nQFactor; | /* quality factor */
L_UINT32 L_FAR *pulImageLength; | /* address of variable to update */

Saves a LEADTOOLS bitmap to a file in memory, and then sends the resulting memory file to a remote computer.

Parameter | Description
hComputer | Handle of remote computer to which bitmap data is to be sent.
pBitmap | Pointer to the bitmap handle referencing the bitmap to send.
nFormat | Value indicating the output file format of the file to send. For valid values, refer to Formats of Output Files .
nBitsPerPixel | Value indicating the resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files If nBitsPerPixel is 0, the file will be stored using the closet BitsPerPixel value supported by that format. For example, if a file format supports 1, 4, and 24 BitsPerPixel, and the pBitmap->BitsPerPixel is 5, the file will be stored as 24 bit. Likewise, if the pBitmap->BitsPerPixel is 2, the file will be stored as 4 bit.
nQFactor | This parameter is used when saving an image file to FILE_CMP, FILE_JFIF, FILE_LEAD1JFIF, FILE_LEAD2JFIF, FILE_JTIF, FILE_LEAD1JTIF, FILE_LEAD2JTIF, FILE_FPX_JPEG_QFACTOR, and FILE_EXIF_JPEG. Qfactor is a number that determines the degree of loss in the compression process. For possible values, refer to Compression Quality Factors .
pulImageLength | Address of the variable to be updated with the size of the output image file. Pass NULL if you are not interested in the resulting file's size in memory.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The image in pBitmap is saved into a memory file in the format specified by nFormat. Then, the data is sent to the remote computer. LEADTOOLS headers are added to the beginning of the data before it is sent.

If the remote computer has enabled auto process by calling L_InetAutoProcess, then the bitmap will be automatically loaded at the other end and the remote computer's INETCALLBACK function will be called with the INET_IMAGE_RECEIVED message. If auto process is disabled by the remote computer, then the LEADTOOLS headers must be stripped by the receiver. The remote computer can then call L_LoadMemory to load the image, or the data can be saved directly into a file. In this case, the format of the file would be the value of nFormat.

If pulImageLength is not NULL, then the size of the resulting file in memory after it was saved is returned in pulImageLength.

Note that in most cases, the data will not be completely sent by the time this function returns. Only when the INETCALLBACK function is called with INET_DATA _SENT can you be assured that all of the data has been sent to the remote computer.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendData, L_InetSendSound, L_InetConnect, L_InetClose, L_InetReadData, L_InetAutoProcess, L_InetServerInit, L_InetClearQueue, L_InetGetQueueSize, INETCALLBACK, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

L_COMP hComp; /* handle of the remote computer */
L_INT nRet;

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize,L_VOID L_FAR*pUserData);

/* note: instead of server_address you need to put the IP
 address
of the computer running the server. You can also put in
the computer name, if the server is running on a local network */
/* you do not need to use MakeProcInstance for 32 bit applications */
nRet = L_InetConnect("server_address",
 1000, &hComp, InetCallback, NULL);
if(nRet != SUCCESS)
MessageBox(NULL, TEXT("Error attempting to connect"),
 TEXT("ERROR"), MB_OK);

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize,L_VOID L_FAR*pUserData)
{
L_INT nRet;
BITMAPHANDLE Bitmap;

switch(nMessage)
{
case INET_CONNECT:
/* check the status
 and send some data */
if(nError == SUCCESS)
{
/*
 replace "image1.cmp" with the full path of the image */
nRet
 = L_LoadBitmap (TEXT("image1.cmp"),
 &Bitmap, sizeof(Bitmap), 0, ORDER_BGR, NULL, NULL);
if(nRet
 != SUCCESS)
MessageBox(NULL,
 TEXT("Error loading image!"), TEXT("Error"), MB_OK);
else
{
/*
 now you can assume you are connected to computer 'hComp' */
nRet
 = L_InetSendBitmap(hComp, &Bitmap,
 FILE_CMP, 24, 2, NULL);
if(nRet
 != SUCCESS)
MessageBox(NULL,
 TEXT("Error sending bitmap"), TEXT("Error"), MB_OK);
/*
 we don't need the bitmap anymore */
L_FreeBitmap (&Bitmap);
}

/*
 remove the next line to keep the connection open */
L_InetClose(hComp,
 TRUE);
}
else
MessageBox(NULL,
 TEXT("You have failed to connect!"), TEXT("Error"),
 MB_OK);
break;
}
return SUCCESS;
}


L_InetSendCloseWinCmd

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendCloseWinCmd(hComputer, uCommandID, uWindowID)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uWindowID; | /* window id */

Sends a close window command to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uWindowID | The id of the window to close.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The remote computer should respond by calling L_InetSendCloseWinRsp in its INETCOMMANDCALLBACK function. This callback function must be set using L_InetSetCommandCallback.

The INETCOMMANDCALLBACK function will receive the uWindowID information in the pParams parameter. The uWindowID information will be in pParams[0].

To receive responses to commands, provide an INETRESPONSECALLBACK function. This function must be set using L_InetSetResponseCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendCloseWinRsp, INETRESPONSECALLBACK, INETCOMMANDCALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_UINT guCommandID;

// Note that pszRemoteFilename is a file name on the remote computer!
L_INT CloseRemoteWindow(L_COMP hComputer, L_UINT uWindowID)
{
return L_InetSendCloseWinCmd(hComputer,
 guCommandID++, uWindowID);
}


L_InetSendCloseWinRsp

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendCloseWinRsp(hComputer, uCommandID, uExtra, pExtra, nStatus)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uExtra; | /* length of extra data */
L_CHAR L_FAR * pExtra; | /* extra data */
L_INT nStatus; | /* status */

Sends a close window response to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uExtra | The size of the extra data (pExtra). Unused if pExtra is NULL.
pExtra | Pointer to any extra data needed by the response. Pass NULL if the response does not need to pass any extra data.
nStatus | Status of the original command. If the command completes successfully this should be SUCCESS. Otherwise, it should be one of the Return Codes.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function sends a response to a command that was sent from a remote computer using the L_InetSendCloseWinCmd.

To receive commands, provide an INETCOMMANDCALLBACK function. This function must be set using L_InetSetCommandCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendCloseWinCmd, INETCOMMANDCALLBACK, INETRESPONSECALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSendCreateWinCmd.


L_InetSendCmd

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendCmd(hComputer, uCommand, uCommandID, hPacket)

L_COMP hComputer; | /* handle to a remote computer */
CMDTYPE uCommand; | /* command type */
L_UINT uCommandID; | /* command id */
HINETPACK hPacket; | /* handle to the packet object */

Sends a command to a remote computer.

Parameter | Description
hComputer | Handle to the remote computer to which the command will be sent.
uCommand | The command to send. For a list of possible values, refer to CMDTYPE.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
hPacket | Handle to an INET packet object containing the parameters for the command. You can pass NULL if the command doesn’t need any parameters.

Returns

SUCCESS | This function was successful.
< 1 | An occurred. Refer to Return Codes.

Comments

The remote computer should respond by calling L_InetSendRsp in its INETCOMMANDCALLBACK function. This callback function must be set using L_InetSetCommandCallback.

To receive responses to commands, provide an INETRESPONSECALLBACK function. This function must be set using L_InetSetResponseCallback.

Some commands will send back only the command’s status (indicating whether the command succeeded or not). But some commands will send back additional information if the command succeeds. For example, responses to L_InetSendLoadCmd will send the bitmap ID while responses to L_InetSendCreateWinCmd will send the window identifier (which can be used to resize or close the window).

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Funtions: | L_InetSendRsp, INETCOMMANDCALLBACK, INETRESPONSECALLBACK, L_InetSetCommandCallback
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetCreatePacket.


L_InetSendCreateWinCmd

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendCreateWinCmd(hComputer, uCommandID, pszClassName, pszWindowName, ulFlags, nLeft, nTop, nWidth, nHeight, uParentID)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_TCHAR L_FAR * pszClassName; | /* window class name */
L_TCHAR L_FAR * pszWindowName; | /* name of window */
L_UINT ulFlags; | /* window creation flags */
L_INT nLeft; | /* x coordinate */
L_INT nTop; | /* y coordinate */
L_INT nWidth; | /* width */
L_INT nHeight; | /* height */
L_UINT uParentID; | /* parent id */

Sends a create win command to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
pszClassName | Character string containing the class name for which to register the window. This must be a valid string, and should be related to your application, to avoid conflicting with an existing registered window class name.
pszWindowName | Character string containing the name of the window. This parameter can be an empty string ("").
ulFlags | Flags that indicate how to create the window. It is recommended to use the same flags shown in CreateWindow in the Microsoft SDK. However, you can pass 0 if you do not wish to use ulFlags, or you can define your own flags
nLeft | X coordinate for the origin of the window to create.
nTop | Y coordinate for the origin of the window to create.
nWidth | Requested width of the window's client area.
nHeight | Requested height of the window's client area.
uParentID | Id of the parent or owner window of the window being created.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The remote computer should respond by calling L_InetSendCreateWinRsp in its INETCOMMANDCALLBACK function. This callback function must be set using L_InetSetCommandCallback.

With this command, the local computer will signal the remote computer to create a window using the specified parameters. The window identifier will be sent in the response to this command.

To receive responses to commands, provide an INETRESPONSECALLBACK function. This function must be set using L_InetSetResponseCallback.

The INETCOMMANDCALLBACK function will receive the pszClassName, pszWindowName, ulFlags, nLeft, nTop, nWidth, nHeight and uParentID information in the pParams parameter. The pszClassName information will be in pParams[0]. The pszWindowName information will be in pParams[1], the ulFlags information will be in pParams[2], and so forth.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendCreateWinRsp, INETRESPONSECALLBACK, INETCOMMANDCALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_UINT guCommandID;

//********** Code on the local computer ****************/
// Note that pszRemoteFilename is a file name on the remote computer!
L_INT CreateRemoteWindow(L_COMP hComputer)
{
return L_InetSendCreateWinCmd(hComputer, guCommandID++, TEXT(""), // class
TEXT("Window created by remote computer"), // title
0, // flags
100, 50, 300, 150, // position and size
0); // parent
}

//********** Code on the remote computer ****************/
HWND CreateChildWindow(L_TCHAR L_FAR *pszClassName, L_TCHAR L_FAR *pszWindowName, L_UINT32 ulFlags, L_INT nLeft, L_INT nTop, L_INT nWidth, L_INT nHeight, L_UINT hwndParent)
{
// create the window here…

   return 0;
}

L_INT AttachBitmap(L_UINT uBitmapID, L_UINT uWindowID)
{
// Attach the local bitmap uBitmapID to the local window
 uWindowID
// To put it another way, "Make the bitmap with
 ID bitmap ID paint in the window uWindowID"
// Usually, the window ID is the window handle.
// For a complete example, see the NETCMD sample application.
return 0;

}

L_INT EXT_CALLBACK InetCommandCallback(L_COMP hComputer, CMDTYPE uCommand, L_UINT uCommandID, L_INT nError, L_UINT uParams,
pPARAMETER pParams, L_UINT uExtra, L_CHAR L_FAR *pExtra, L_VOID L_FAR *pUserData)
{
L_INT nStatus = ERROR_INV_PARAMETER;
L_UINT uBitmapID = (L_UINT)-1;
if(nError != SUCCESS)
nStatus = ERROR_TRANSFER_ABORTED;
else
switch(uCommand)
{
case CMD_CREATE_WIN:
// check the validity of the parameters
if(uParams == 8 && pParams[0].uType == PARAM_STRING && pParams[1].uType == PARAM_STRING && pParams[2].uType == PARAM_UINT32 && pParams[3].uType == PARAM_INT32 && pParams[4].uType == PARAM_INT32 && pParams[5].uType == PARAM_INT32 && pParams[6].uType == PARAM_INT32 && pParams[7].uType == PARAM_UINT32)
{
HWND hwnd = CreateChildWindow((L_TCHAR*)pParams[0].pValue, (L_TCHAR*)pParams[1].pValue,
pParams[2].uiValue, pParams[3].iValue, pParams[4].iValue,
pParams[5].iValue, pParams[6].iValue,
pParams[7].uiValue);

// If CreateChildWindow failed, one of the parameters must be invalid
nStatus = hwnd ? SUCCESS : ERROR_INV_PARAMETER;
return L_InetSendCreateWinRsp(hComputer, uCommandID,
(L_UINT)hwnd, 0, NULL, nStatus);
}
break;
case CMD_ATTACH_BITMAP:
if(uParams == 2 && pParams[0].uType == PARAM_UINT32 && pParams[1].uType == PARAM_UINT32)
nStatus = AttachBitmap(pParams[0].uiValue, pParams[1].uiValue);
return L_InetSendAttachBitmapRsp(hComputer, uCommandID, 0, NULL, nStatus);
case CMD_SIZE_WIN:
if(uParams == 5 && pParams[0].uType == PARAM_UINT32 && pParams[1].uType == PARAM_INT32 && pParams[2].uType == PARAM_INT32 && pParams[3].uType == PARAM_INT32 && pParams[4].uType == PARAM_INT32)
{
// move and repaint the window
if(MoveWindow((HWND) pParams[0].uiValue,
pParams[1].iValue, pParams[2].iValue,
pParams[3].iValue, pParams[4].iValue, TRUE))
nStatus = SUCCESS;
}
return L_InetSendSizeWinRsp(hComputer, uCommandID, 0, NULL, nStatus);
case CMD_SHOW_WIN:
if(uParams == 2 && pParams[0].uType == PARAM_UINT32 && pParams[1].uType == PARAM_INT32)

            {
if(IsWindow((HWND)pParams[0].uiValue))
{
ShowWindow((HWND)pParams[0].uiValue,
 pParams[1].iValue);
nStatus
 = SUCCESS;
}
}
return L_InetSendShowWinRsp(hComputer,
 uCommandID, 0, NULL, nStatus);
case CMD_CLOSE_WIN:
if(uParams
 == 1 && pParams[0].uType == PARAM_UINT32)
{
if(DestroyWindow((HWND)pParams[0].uiValue))
nStatus
 = SUCCESS;
}
return
 L_InetSendCloseWinRsp(hComputer,
 uCommandID, 0, NULL, nStatus);
default:
//
 this command is not supported
nStatus
 = ERROR_FEATURE_NOT_SUPPORTED;
break;
}
return L_InetSendRsp(hComputer,
 uCommand, uCommandID, NULL, nStatus);
}


L_InetSendCreateWinRsp

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendCreateWinRsp(hComputer, uCommandID, uWindowID, uExtra, pExtra, nStatus)

L_COMP hComputer; | /* handle to a remote computer*/
L_UINT uCommandID; | /* command id */
L_UINT uWindowID; | /* window id */
L_UINT uExtra; | /* length of extra data */
L_CHAR L_FAR * pExtra; | /* extra data */
L_INT nStatus; | /* status */

Sends a create window response to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uWindowID | The id of the window that was just created. This id should be unique for each create request.
uExtra | Length of any extra data associated with the response.
pExtra | Pointer to any extra data associated with the response.
nStatus | Status of the original command. If the command completes successfully, this should be SUCCESS. Otherwise, it should be one of the Return Codes.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function sends a response to a create window command that was sent from a remote computer using the L_InetSendCreateWinCmd.

To receive commands, provide an INETCOMMANDCALLBACK function. This function must be set using L_InetSetCommandCallback.

The INETRESPONSECALLBACK function will receive the uWindowID information in the pParams parameter. The uWindowID information will be in pParams[0].

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendCreateWinCmd, INETCOMMANDCALLBACK, INETRESPONSECALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSendCreateWinCmd.


L_InetSendData

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendData(hComputer, pBuffer, pulBufferLength, uDataType)

L_COMP hComputer; | /* handle of remote computer */
L_CHAR L_FAR * pBuffer; | /* pointer to the data buffer to send */
L_UINT32 L_FAR * pulBufferLength; | /* address of a variable to be updated with the length of the buffer */
L_UINT uDataType; | /* data type */

Sends data to a remote computer.

Parameter | Description
hComputer | Handle of remote computer to which data will be sent
pBuffer | Pointer to the buffer that contains the data to send
pulBufferLength | Address of a variable that contains the length of buffer, and which will be updated with the amount of data actually sent.
uDataType | Value indicating the type of data being sent. This value determines the type of headers added to the data. Possible values are:
 | Value | Meaning
 | IDATA_IMAGE | [0x0000] image data
 | IDATA_MMEDIA | [0x0001] multimedia object
 | IDATA_USER1 | [0x0002] user data
 | IDATA_USER2 | [0x0003] user data
 | IDATA_USER3 | [0x0004] user data
 | IDATA_USER4 | [0x0005] user data
 | The receiving computer will receive the appropriate notification in the INETCALLBACK function as follows:
 | On Send: | On Receive:
 | IDATA_IMAGE | INET_IMAGE_RECEIVED
 | IDATA_MMEDIA | INET_MMEDIA_RECEIVED
 | IDATA_USER1 | INET_USER1_RECEIVED
 | IDATA_USER2 | INET_USER2_RECEIVED
 | IDATA_USER3 | INET_USER3_RECEIVED
 | IDATA_USER4 | INET_USER4_RECEIVED
 | Note: If an error occurs during sending or receiving and the headers become corrupted, then the receiving computer will receive the INET_USER1_RECEIVED notification. This means that to differentiate your own user-defined data from bad frames, you can use IDATA_USER2, IDATA_USER3 or IDATA_USER4.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

After this function returns, pulBufferLength will be updated with the amount of data that was actually sent. If pulBufferLength is less than the original value, then the rest of the data is queued, and will be sent at a later time. You do not need to re-send the data.

Note:

With this function, LEADTOOLS adds its own headers to the data being sent. These headers need to be stripped by the remote computer, in order for the actual data to be processed. The remote computer can set auto process by calling L_InetAutoProcess in order for the headers to be stripped.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendRawData, L_InetConnect, L_InetClose, L_InetReadData, L_InetSendBitmap, L_InetSendSound, L_InetAutoProcess, L_InetServerInit, L_InetClearQueue, L_InetGetQueueSize, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

L_COMP hComp; /* handle of the remote computer */
L_INT nRet;

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize, L_VOID L_FAR*pUserData);

/* note: instead of server_address you need to put the IP
 address
of the computer running the server. You can also put in
the computer name, if the server is running on a local network */
/* you do not need to use MakeProcInstance for 32 bit applications */
nRet = L_InetConnect("server_address",
 1000, &hComp, InetCallback, NULL);
if(nRet != SUCCESS)
MessageBox(NULL, TEXT("Error attempting to connect"),
 TEXT("ERROR"), MB_OK);

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize, L_VOID L_FAR*pUserData)
{
L_TCHAR L_FAR*pData;
L_UINT32 lDataSize;

switch(nMessage)
{
case INET_CONNECT:
/* check the status and send some data */
if(nError == SUCCESS)
{
pData = TEXT("Some Data");
lDataSize = lstrlen(pData);

/* now you can assume you are connected to computer 'hComp'
nRet = L_InetSendData(hComp, pData, &lDataSize, IDATA_USER1);
/* we can close the connection without data loss with a graceful connection. The closing is delayed until after all the data has been sent. remove the next line if you want to keep the connection open */
L_InetClose(hComp, TRUE);
}
else
MessageBox(NULL, TEXT("You have failed to connect!"), TEXT("Error"), MB_OK);
break;
}
return SUCCESS;
}


L_InetSendFreeBitmapCmd

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendFreeBitmapCmd(hComputer, uCommandID, uBitmapID)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uBitmapID; | /* bitmap id */

Sends a free bitmap command to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uBitmapID | The ID of the bitmap that should be freed.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The remote computer should free the bitmap associated with uBitmapID and respond by calling L_InetSendFreeBitmapRsp in its INETCOMMANDCALLBACK function. This callback function must be set using L_InetSetCommandCallback.

The INETCOMMANDCALLBACK function will receive the uBitmapID information in the pParams parameter. The uBitmapID information will be in pParams[0].

To receive responses to commands, provide an INETRESPONSECALLBACK function. This function must be set using L_InetSetResponseCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendFreeBitmapRsp, INETRESPONSECALLBACK, INETCOMMANDCALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_UINT guCommandID;

// you can use this function to instruct the remote computer to
// free a bitmap that you instructed him to load.

L_INT DeleteRemoteBitmap(L_COMP hComputer, L_UINT uBitmapID)
{
return L_InetSendFreeBitmapCmd(hComputer,
 guCommandID++, uBitmapID);
}


L_InetSendFreeBitmapRsp

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendFreeBitmapRsp(hComputer, uCommandID, uExtra, pExtra, nStatus)

L_COMP hComputer; | /* handle to remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uExtra; | /* length of extra data */
L_CHAR L_FAR * pExtra; | /* extra data */
L_INT nStatus; | /* status */

Sends a free bitmap response to a remote computer.

Parameter | Description
hComputer | Handle of remote computer to which command will be sent.
uCommandID | ID of command. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uExtra | Length of extra data.
pExtra | Pointer to extra data associated with this response.
nStatus | Status of the original command. If the command completes successfully, this should be SUCCESS. Otherwise, it should be one of the Return Codes.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function sends a response to a free bitmap command that was sent from a remote computer using the L_InetSendFreeBitmapCmd.

To receive commands, provide an INETCOMMANDCALLBACK function. This function must be set using L_InetSetCommandCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendFreeBitmapCmd, INETCOMMANDCALLBACK, INETRESPONSECALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSetCommandCallback.


L_InetSendGetMagGlassDataCmd

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendGetMagGlassDataCmd(hComputer, uCommandID, uBitmapID, uMaskPlaneSize, pMaskPlane, nMaskPlaneStart, nMaskPlaneEnd)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uBitmapID; | /* bitmap id */
L_UINT32 uMaskPlaneSize; | /* size of the bit flags array */
L_UCHAR L_FAR *pMaskPlane; | /* pointer to a buffer that will contain an array of bit flags */
L_INT nMaskPlaneStart; | /* start index of the mask plane array */
L_INT nMaskPlaneEnd; | /* end index of the mask plane array */

Sends a get Magnifying Glass data command to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uBitmapID | The id of the bitmap from which to get Magnifying Glass data.
uMaskPlaneSize | The size of the bit flags array in bytes.
pMaskPlane | An array of bit flags which represents a mask plane. This array works as a plane for the parts of the bitmap that are not yet updated.
nMaskPlaneStart | The start index of the mask plane array.
nMaskPlaneEnd | The end index of the mask plane array.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The remote computer should respond by calling L_InetSendGetMagGlassDataRsp in its INETCOMMANDCALLBACK function. This callback function must be set using L_InetSetCommandCallback.

Once the remote computer receives this command it should call L_InetGetMagGlassData function to get the needed data from the bitmap. The bitmap that the data needed from should exist on the remote computer.

The INETCOMMANDCALLBACK function will receive the uBitmapID, uMaskPlaneSize, pMaskPlane, nMaskPlaneStart and nMaskPlaneEnd information in the pParams parameter. The uBitmapID information will be in pParams[0]. The uMaskPlaneSize information will be in pParams[1], and so forth.

To receive responses to commands, provide an INETRESPONSECALLBACK function. This function must be set using L_InetSetResponseCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendGetMagGlassDataRsp, L_InetGetMagGlassData, INETRESPONSECALLBACK, INETCOMMANDCALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_UINT guCommandID;

// Assume that this function is always called inside the MagGlassCallback function
L_INT GetMagGlassData(L_COMP hComputer, L_UINT uBitmapID, L_UINT32 lMaskPlaneSize, L_UCHAR L_FAR *pMaskPlane,
L_INT nMaskPlaneStart, L_INT nMaskPlaneEnd)
{
return L_InetSendGetMagGlassDataCmd(hComputer, guCommandID++, uBitmapID, lMaskPlaneSize, pMaskPlane, nMaskPlaneStart, nMaskPlaneEnd);
}


L_InetSendGetMagGlassDataRsp

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendGetMagGlassDataRsp(hComputer, uCommandID, lColorSize, pColor, uMaskPlaneSize, pMaskPlane, nMaskPlaneStart, nMaskPlaneEnd, uExtra, pExtra, nStatus)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT32 lColorSize; | /* size of the colors array */
COLORREF L_FAR *pColor; | /* an array of colors*/
L_UINT32 uMaskPlaneSize; | /* size of the bit flags array */
L_UCHAR L_FAR *pMaskPlane; | /* pointer to a buffer that will contain an array of bit flags */
L_INT nMaskPlaneStart; | /* start index of the mask plane array */
L_INT nMaskPlaneEnd; | /* end index of the mask plane array */
L_UINT uExtra; | /* length of any extra data */
L_CHAR L_FAR *pExtra; | /* extra data */
L_INT nStatus; | /* status */

Sends a get Magnifying Glass data response to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
lColorSize | The size of the colors.
pColor | Pointer to an array of colors that match the position of needed data in the mask plane array. This array of colors is obtained by calling of L_InetGetMagGlassData function.
uMaskPlaneSize | The size of the bit flags array in bytes.
pMaskPlane | An array of bit flags which represents a mask plane. This array works as a plane for the parts of the bitmap that are not yet updated.
nMaskPlaneStart | The start index of the mask plane array.
nMaskPlaneEnd | The end index of the mask plane array.
uExtra | The size of the extra data (pExtra). Unused if pExtra is NULL.
pExtra | Pointer to any extra data needed by the response. Pass NULL if the response does not need to pass any extra data.
nStatus | Status of the original command.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function sends a response to a command that was sent from a remote computer using the L_InetSendGetMagGlassDataCmd. This response provides the remote computer with the colors array and its size, the mask plane array and its size and the start and end indexes of the mask plane array.

To receive commands, provide an INETCOMMANDCALLBACK function. This function must be set using L_InetSetCommandCallback.

The INETRESPONSECALLBACK function will receive the lColorSize, pColor, uMaskPlaneSize, pMaskPlane, nMaskPlaneStart and nMaskPlaneEnd information in the pParams parameter. The lColorSize information will be in pParams[0]. The pColor information will be in pParams[1], and so forth.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendGetMagGlassDataCmd, L_InetGetMagGlassData, INETCOMMANDCALLBACK, INETRESPONSECALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSetCommandCallback.


L_InetSendLoadCmd

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendLoadCmd(hComputer, uCommandID, pszFile, nBitsPerPixel, nOrder, uFlags)

L_COMP hComputer; | /* handle to a remote computer*/
L_UINT uCommandID; | /* command id*/
L_TCHAR L_FAR * pszFile; | /* filename */
L_INT nBitsPerPixel; | /* resulting bitmap pixel depth */
L_INT nOrder; | /* desired color order*/
L_UINT uFlags; | /* flags that determine function behavior */

Sends a load command to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
pszFile | Character string containing the name of the image file to load. This should be the name of a file on the computer receiving the command.
nBitsPerPixel | Resulting bitmap pixel depth. The following are valid values:
 | Value | Meaning
 | 0 | Keep the original file's pixel depth (Do not convert).
 | 1 to 8 | The specified bits per pixel in the resultant bitmap
 | 12 | 12 bits per pixel in the resultant bitmap.
 | 16 | 16 bits per pixel in the resultant bitmap
 | 24 | 24 bits per pixel in the resultant bitmap
 | 32 | 32 bits per pixel in the resultant bitmap
 | 48 | 48 bits per pixel in the resultant bitmap
 | 64 | 64 bits per pixel in the resultant bitmap
nOrder | Color order for 16-, 24-, 32-, 48-, and 64-bit bitmaps. If the resultant bitmap is less than 16 bits per pixel, this will have no effect since palletized images have no order. The following are valid values:
 | Value | Meaning
 | ORDER_RGB | [0] Red, green, and blue color order in memory
 | ORDER_BGR | [1] Blue, green, and red color order in memory
 | ORDER_GRAY | [2] 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are only supported in the Document/Medical Imaging editions .
 | ORDER_RGBORGRAY | [3] Load the image as red, green, blue OR as a 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in the Document/Medical Imaging editions only.
 | ORDER_BGRORGRAY | [4] Load the image as blue, green, red OR as a 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in the Document/Medical Imaging editions only.
uFlags | Binary flags that determine the behavior of the loading process. You can pass some user-defined flag values, or specify one or more of the following values:
 | Value | Meaning
 | LOADFILE_ALLOCATE | [0x0001] The function allocates memory for the specified bitmap. (This takes place in addition to the actions of your callback function.)
 | LOADFILE_STORE | [0x0002] The function loads data into the specified bitmap. (This takes place in addition to the actions of your callback function.)

Returns

SUCCESS | This function was successful.
< 1 | An occurred. Refer to Return Codes.

Comments

The remote computer should respond by calling L_InetSendLoadRsp in its INETCOMMANDCALLBACK function. This callback function must be set using L_InetSetCommandCallback.

With this command, the local computer will signal the remote computer to load a bitmap and send across the bitmap identifier (not the bitmap data!). The local computer can then use the bitmap identifier in other commands (like L_InetSendAttachBitmapCmd). The bitmap identifier will be sent in the response to this command.

To receive responses to commands, provide an INETRESPONSECALLBACK function. This function must be set using L_InetSetResponseCallback.

The INETCOMMANDCALLBACK function will receive the pszFile, nBitsPerPixel, nOrder and uFlags information in the pParams parameter. The pszFile information will be in pParams[0]. The nBitsPerPixel information will be in pParams[1], and so forth.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendLoadRsp, INETCOMMANDCALLBACK, INETRESPONSECALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_UINT guCommandID;

L_INT LoadRemoteFile(L_COMP hComputer, L_TCHAR L_FAR* pszFilename)
{
return L_InetSendLoadCmd(hComputer,
 guCommandID++, pszFilename, 0, ORDER_BGRORGRAY, OADFILE_ALLOCATE|LOADFILE_STORE);
}


L_InetSendLoadRsp

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendLoadRsp(hComputer, uCommandID, uBitmapID, uExtra, pExtra, nStatus)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uBitmapID; | /* bitmap id */
L_UINT uExtra; | /* length of extra data */
L_CHAR L_FAR * pExtra; | /* extra data */
L_INT nStatus; | /* status */

Sends a load response to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the response will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uBitmapID | The id of the bitmap that was loaded. This id should be unique for each load request.
uExtra | The size of the extra data (pExtra). Unused if pExtra is NULL.
pExtra | Pointer to any extra data needed by the response. Pass NULL if the response does not need to pass any extra data.
nStatus | Status of the original command. If the command completes successfully, this should be SUCCESS. Otherwise, it should be one of the Return Codes.

Returns

SUCCESS | This function was successful.
< 1 | An occurred. Refer to Return Codes.

Comments

This function sends a response to a load command that was sent from a remote computer using the L_InetSendLoadCmd.This response provides the remote computer with an id to be used in identifying the bitmap.

To receive commands, provide an INETCOMMANDCALLBACK function. This function must be set using L_InetSetCommandCallback.

The INETRESPONSECALLBACK function will receive the uBitmapID information in the pParams parameter. The uBitmapID information will be in pParams[0].

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendLoadCmd, INETCOMMANDCALLBACK, INETRESPONSECALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSetCommandCallback.


L_InetSendRawData

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendRawData(hComputer, pBuffer, pulBufferLength)

L_COMP hComputer; | /* handle of remote computer */
L_CHAR L_FAR * pBuffer; | /* pointer to the data buffer to send */
L_INT32 L_FAR * pulBufferLength; | /* address of length of buffer */

Sends data to a remote computer.

Parameter | Description
hComputer | Handle of remote computer to which data will be sent
pBuffer | Pointer to the buffer that contains the data to send
pulBufferLength | Address of a variable that contains the length of buffer, and which will be updated with the amount of data actually sent.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

After this function returns, pulBufferLength will be updated with the amount of data that was actually sent. If pulBufferLength is less than the original value, then the rest of the data is queued, and will be sent at a later time. You do not need to re-send the data.

Note:

LEADTOOLS adds its own headers to the data being sent with L_InetSendData. L_InetSendRawData does not add any headers. The remote computer must disable auto process by calling L_InetAutoProcess in order for the raw data to be received properly.

One possible use of this function, is to send raw data to a remote computer to detect if the remote is capable of handling LEADTOOLS’ headers. If the remote computer cannot handle LEADTOOLS' headers, then you can send all your data with L_InetSendRawData and keep auto process disabled on the remote computer for that connection.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendData, L_InetConnect, L_InetClose, L_InetReadData, L_InetSendBitmap, L_InetSendSound, L_InetAutoProcess, L_InetServerInit, L_InetClearQueue, L_InetGetQueueSize, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

L_COMP hComp; /* handle of the remote computer */
L_INT nRet;

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize, L_VOID L_FAR*pUserData);

/* note: instead of server_address you need to put the IP
 address
of the computer running the server. You can also put in
the computer name, if the server is running on a local network */
/* you do not need to use MakeProcInstance for 32 bit applications */
nRet = L_InetConnect("server_address",
 1000, &hComp, InetCallback, NULL);
if(nRet != SUCCESS)
MessageBox(NULL, TEXT("Error attempting to connect"),
 TEXT("ERROR"), MB_OK);

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize, L_VOID L_FAR*pUserData)
{
L_INT nRet;
L_CHAR L_FAR*pData;
L_UINT32 lDataSize;

switch(nMessage)
{
case INET_CONNECT:
/* check the status and send some data */
if(nError == SUCCESS)
{
pData = "Some Data";
lDataSize = strlen(pData);

/* now you can assume you are connected to computer 'hComp' */
nRet = L_InetSendRawData(hComp, pData, &lDataSize);

/* remove the next line if you want to keep the connection open Note that not all the data might have been sent at this point. The connection will be closed wither now, or after all the data has been sent */
L_InetClose(hComp, TRUE);
}
else
MessageBox(NULL, TEXT("You have failed to connect!"), TEXT("Error"), MB_OK);
break;
}
return SUCCESS;
}


L_InetSendRsp

#include "l_bitmap.h"
#include "ltnet.h"

L_INET EXT_FUNCTION L_InetSendRsp(hComputer, uCommand, uCommandID, hPacket, nStatus)

L_COMP hComputer; | /* handle to a remote computer */
CMDTYPE uCommand; | /* command type */
L_UINT uCommandID; | /* command id */
HINETPACK hPacket; | /* handle to a packet object */
L_INT nStatus; | /* status */

Sends a response to a remote computer.

Parameter | Description
hComputer | Handle to the remote computer to which the response will be sent.
uCommand | The command type which prompted this response. For a list of possible values, refer to CMDTYPE.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
hPacket | Handle to an INET packet object containing any extra parameters for the response. You can pass NULL if the only parameter needed is nStatus
nStatus | Status of the original command. If the command completes successfully, this should be SUCCESS. Otherwise, it should be one of the Return Codes.

Returns

SUCCESS | This function was successful.
< 1 | An occurred. Refer to Return Codes.

Comments

This function sends a response to a command that was sent from a remote computer using the L_InetSendCmd.

To receive commands, provide an INETCOMMANDCALLBACK function. This function must be set using L_InetSetCommandCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendCmd, INETRESPONSECALLBACK, INETCOMMANDCALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSetCommandCallback.


L_InetSendSaveCmd

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendSaveCmd(hComputer, uCommandID, pszFile, uBitmapID, nFormat, nBitsPerPixel, nQFactor, uFlags)

L_COMP hComputer; | /* handle to remote computer*/
L_UINT uCommandID; | /* message id*/
L_TCHAR L_FAR * pszFile; | /* file name*/
L_UINT uBitmapID; | /* bitmap id*/
L_INT nFormat; | /* file format*/
L_INT nBitsPerPixel; | /* resulting file's pixel depth*/
L_INT nQFactor; | /* quality factor*/
L_UINT uFlags; | /* flags that determines the save behavior*/

Sends a save command to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
pszFile | Character string containing the name of the image file to save.
uBitmapID | Id of the bitmap to save.
nFormat | Output file format. For valid values, refer to Formats of Output Files .
nBitsPerPixel | Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files . If nBitsPerPixel is 0, the file will be stored using the closet BitsPerPixel value supported by that format. For example, if a file format supports 1, 4, and 24 BitsPerPixel, and the BitsPerPixel is 5, the file will be stored as 24 bit. Likewise, if the BitsPerPixel is 2, the file will be stored as 4 bit.
nQFactor | This parameter is used when saving an image file to FILE_CMP, FILE_JFIF, FILE_LEAD1JFIF, FILE_LEAD2JFIF, FILE_JTIF, FILE_LEAD1JTIF, FILE_LEAD2JTIF, FILE_FPX_JPEG_QFACTOR, and FILE_EXIF_JPEG. Qfactor is a number that determines the degree of loss in the compression process.
 | For possible values, refer to Compression Quality Factors .
uFlags | Binary flags that determine the behavior of save. You can specify one of the following values listed below, or set user-defined flags.
 | Value | Meaning
 | SAVEFILE_FIXEDPALETTE | [0x0001] The function uses the fixed palette for images that are saved as 8 bits per pixel or less.
 | SAVEFILE_OPTIMIZEDPALETTE | [0x0002] The function uses the individual image's optimized palette for images that are saved as 8 bits per pixel or less. The optimized palette must be included in the bitmap handle.
 | SAVEFILE_MULTIPAGE | [0x0004] The function saves the image in a multi-page file. It appends the image as the last one in the file. You can save multi-page images in PCX, GIF, and most TIFF file formats (including JTIF, but excluding EXIF).

Returns

SUCCESS | This function was successful.
< 1 | An occurred. Refer to Return Codes.

Comments

The remote computer should respond by calling L_InetSendSaveRsp in its INETCOMMANDCALLBACK function. This callback function must be set using L_InetSetCommandCallback.

With this command, the local computer will signal the remote computer to save a bitmap.

To receive responses to commands, provide an INETRESPONSECALLBACK function. This function must be set using L_InetSetResponseCallback.

The INETCOMMANDCALLBACK function will receive the pszFile, uBitmapID, nFormat, nBitsPerPixel, nQFactor and uFlags information in the pParams parameter. The pszFile information will be in pParams[0]. The uBitmapID information will be in pParams[1], the nFormat information will be in pParams[2], and so forth.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendSaveRsp, INETRESPONSECALLBACK, INETCOMMANDCALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_UINT guCommandID;

// Note that pszRemoteFilename is a file name on the remote computer!
L_INT SaveRemoteFile(L_COMP hComputer, L_UINT uBitmapID, L_TCHAR L_FAR* pszRemoteFilename)
{
return L_InetSendSaveCmd(hComputer, guCommandID++, pszRemoteFilename, uBitmapID, FILE_TIF, 0, 0, SAVEFILE_OPTIMIZEDPALETTE);
}


L_InetSendSaveRsp

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendSaveRsp(hComputer, uCommandID, uExtra, pExtra, nStatus)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uExtra; | /* length of extra data */
L_CHAR L_FAR * pExtra; | /* extra data */
L_INT nStatus; | /* status */

Sends a save response to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uExtra | The size of the extra data (pExtra). Unused if pExtra is NULL.
pExtra | Pointer to any extra data needed by the response. Pass NULL if the response does not need to pass any extra data.
nStatus | Status of the original command. If the command completes successfully, this should be SUCCESS. Otherwise, it should be one of the Return Codes.

Returns

SUCCESS | This function was successful.
< 1 | An occurred. Refer to Return Codes.

Comments

This function sends a response to a save command that was sent from a remote computer using the L_InetSendSaveCmd.

To receive commands, provide an INETCOMMANDCALLBACK function. This function must be set using L_InetSetCommandCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendSaveCmd, INETCOMMANDCALLBACK, INETRESPONSECALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSetCommandCallback.


L_InetSendSetRectCmd

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendSetRectCmd(hComputer, uCommandID, uWindowID, nType, nLeft, nTop, nWidth, nHeight)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uWindowID; | /* window id */
RECTTYPE nType; | /* rectangle type */
L_INT nLeft; | /* horizontal position */
L_INT nTop; | /* vertical position */
L_INT nWidth; | /* width */
L_INT nHeight; | /* height */

Sends a set rectangle command to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uWindowID | The id of the window to receive the command.
nType | Type of rectangle to set. For possible values, refer to RECTTYPE.
nLeft | X coordinate of the origin of the display rectangle.
nTop | Y coordinate of the origin of the display rectangle.
nWidth | Width of the display rectangle.
nHeight | Height of the display rectangle.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The remote computer should respond by calling L_InetSendSetRectRsp in its INETCOMMANDCALLBACK function. This callback function must be set using L_InetSetCommandCallback.

The INETCOMMANDCALLBACK function will receive the uWindowID, nType, nLeft, nTop, nWidth and nHeight information in the pParams parameter. The uWindowID information will be in pParams[0]. The nType information will be in pParams[1], and so forth.

To receive responses to commands, provide an INETRESPONSECALLBACK function. This function must be set using L_InetSetResponseCallback.

This command is only beneficial to windows that have a bitmap associated with them.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendSetRectRsp, INETRESPONSECALLBACK, INETCOMMANDCALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_UINT guCommandID;

// Note that pszRemoteFilename is a file name on the remote computer!
L_INT FitToRect(L_COMP hComputer, L_UINT uWindowID, LPRECT pRect)
{
return L_InetSendSetRectCmd(hComputer, guCommandID++, uWindowID, RECT_DSTALL, pRect->left, pRect->top, pRect->right – pRect->left, pRect->bottom – pRect->top);
}

//********** Code on the remote computer ****************/
L_INT SetWindowRect(HWND hwnd, CMDTYPE cmdType, L_INT nLeft, L_INT nTop, L_INT nWidth, L_INT nHeight)
{
// Set the window rectangle for painting here...
}

L_INT EXT_CALLBACK InetCommandCallback(L_COMP hComputer, CMDTYPE uCommand, L_UINT uCommandID, L_INT nError, L_UINT uParams, pPARAMETER pParams, L_UINT uExtra, L_CHAR L_FAR *pExtra, L_VOID L_FAR *pUserData)
{
L_INT nStatus = ERROR_FEATURE_NOT_SUPPORTED;

if(nError != SUCCESS)
nStatus = ERROR_TRANSFER_ABORTED;
else
switch(uCommand)
{
case CMD_SET_RECT:
// check the validity of the parameters
if(uParams == 6 && pParams[0].uType == PARAM_UINT32 && pParams[1].uType == PARAM_INT32 && pParams[2].uType == PARAM_INT32 && pParams[3].uType == PARAM_INT32 && pParams[4].uType == PARAM_INT32 && pParams[5].uType == PARAM_INT32)
{
nStatus = SetWindowRect((HWND)pParams[0].pValue, (CMDTYPE)pParams[1].iValue, pParams[2].iValue, pParams[3].iValue, pParams[4].iValue, pParams[5].iValue);
}
else
nStatus = ERROR_INV_PARAMETER; // invalid parameters
return L_InetSendSetRectRsp(hComputer, uCommandID, 0, NULL, nStatus);
}

return L_InetSendRsp(hComputer, uCommand, uCommandID, NULL, nStatus);
}


L_InetSendSetRectRsp

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendSetRectRsp(hComputer, uCommandID, uExtra, pExtra, nStatus)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uExtra; | /* length of extra data */
L_CHAR L_FAR * pExtra; | /* extra data */
L_INT nStatus; | /* status */

Sends a set rectangle response to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uExtra | The size of the extra data (pExtra). Unused if pExtra is NULL.
pExtra | Pointer to any extra data needed by the response. Pass NULL if the response does not need to pass any extra data.
nStatus | Status of the original command. If the command completes successfully, this should be SUCCESS. Otherwise, it should be one of the Return Codes.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function sends a response to a set rectangle command that was sent from a remote computer using the L_InetSendSetRectCmd.

To receive commands, provide an INETCOMMANDCALLBACK function. This function must be set using L_InetSetCommandCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendSetRectCmd, INETCOMMANDCALLBACK, INETRESPONSECALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSendSetRectCmd.


L_InetSendShowWinCmd

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendShowWinCmd(hComputer, uCommandID, uWindowID, nCmdShow)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uWindowID; | /* window id */
L_INT nCmdShow; | /* show flag */

Sends a show window command to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uWindowID | The id of the window to show.
nCmdShow | Specifies how the window is to be shown. The possible values are the same as the nCmdShow parameter of the ShowWindow command from the Windows SDK.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The remote computer should respond by calling L_InetSendShowWinRsp in its INETCOMMANDCALLBACK function. This callback function must be set using L_InetSetCommandCallback.

The INETCOMMANDCALLBACK function will receive the uWindowID and the nCmdShow information in the pParams parameter. The uWindowID information will be in pParams[0] and the nCmdShow information will be in pParams[1].

To receive responses to commands, provide an INETRESPONSECALLBACK function. This function must be set using L_InetSetResponseCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendShowWinRsp, INETRESPONSECALLBACK, INETCOMMANDCALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_UINT guCommandID;

// Note that pszRemoteFilename is a file name on the remote computer!
L_INT MaximizeRemoteWindow(L_COMP hComputer, L_UINT uWindowID)
{
return L_InetSendShowWinCmd(hComputer,
 guCommandID++, uWindowID, SW_MAXIMIZE);
}


L_InetSendShowWinRsp

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendShowWinRsp(hComputer, uCommandID, uExtra, pExtra, nStatus)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uExtra; | /* length of extra data */
L_CHAR L_FAR * pExtra; | /* extra data */
L_INT nStatus; | /* status */

Sends a show window response to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uExtra | The size of the extra data (pExtra). Unused if pExtra is NULL.
pExtra | Pointer to any extra data needed by the response. Pass NULL if the response does not need to pass any extra data.
nStatus | Status of the original command.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function sends a response to a command that was sent from a remote computer using the L_InetSendShowWinCmd.

To receive commands, provide an INETCOMMANDCALLBACK function. This function must be set using L_InetSetCommandCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendShowWinCmd, INETCOMMANDCALLBACK, INETRESPONSECALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSendCreateWinCmd.


L_InetSendSizeWinCmd

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendSizeWinCmd(hComputer, uCommandID, uWindowID, nLeft, nTop, nWidth, nHeight)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uCommandID; | /* command id */
L_UINT uWindowID; | /* window id */
L_INT nLeft; | /* horizontal position */
L_INT nTop; | /* vertical position */
L_INT nWidth; | /* window width */
L_INT nHeight; | /* window height */

Sends a size window command to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uWindowID | The id of the window to size. This id should be unique for each window.
nLeft | X coordinate of the new origin of the window.
nTop | Y coordinate of the new origin of the window.
nWidth | New width of window.
nHeight | New height of window.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The remote computer should respond by calling L_InetSendSizeWinRsp in its INETCOMMANDCALLBACK function. This callback function must be set using L_InetSetCommandCallback.

With this command, the local computer will signal the remote computer to size a window using the specified parameters.

To receive responses to commands, provide an INETRESPONSECALLBACK function. This function must be set using L_InetSetResponseCallback.

The INETCOMMANDCALLBACK function will receive the uWindowID, nLeft, nTop, nWidth and nHeight information in the pParams parameter. The uWindowID information will be in pParams[0]. The nLeft information will be in pParams[1], and so forth.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendSizeWinRsp, INETRESPONSECALLBACK, INETCOMMANDCALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_UINT guCommandID;

// Note that pszRemoteFilename is a file name on the remote computer!
L_INT SizeRemoteWindow(L_COMP hComputer, L_UINT uWindowID)
{
return L_InetSendSizeWinCmd(hComputer,
 guCommandID++, uWindowID, 0, 0, 300, 200);
}


L_InetSendSizeWinRsp

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendSizeWinRsp(hComputer, uCommandID, uExtra, pExtra, nStatus)

L_COMP hComputer; | /* handle to a remote computer */
L_UINT uExtra; | /* length of extra data */
L_UINT uCommandID; | /* id for command */
L_CHAR L_FAR * pExtra; | /* extra data */
L_INT nStatus; | /* status */

Sends a size window response to a remote computer.

Parameter | Description
hComputer | Handle of the remote computer to which the command will be sent.
uCommandID | Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.
uExtra | Length of any extra data associated with the response.
pExtra | Pointer to any extra data associated with the response.
nStatus | Status of the original command. If the command completes successfully, this should be SUCCESS. Otherwise, it should be one of the Return Codes.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function sends a response to a command that was sent from a remote computer using the L_InetSendSizeWinCmd.

To receive commands, provide an INETCOMMANDCALLBACK function. This function must be set using L_InetSetCommandCallback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendSizeWinCmd, INETCOMMANDCALLBACK, INETRESPONSECALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSendCreateWinCmd.


L_InetSendSound

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSendSound(hComputer, pWaveFormatData, pWaveData, pdwDataSize)

L_COMP hComputer; | /* handle of a remote computer */
LPWAVEFORMATDATA pWaveFormatData; | /* pointer to a structure describing the sound format */
LPWAVEDATA pWaveData; | /* pointer to a structure containing the sound data */
L_UINT32 L_FAR * pdwDataSize; | /* address of a variable to be updated with the size of the data being sent */

Sends sound data to a remote computer.

Parameter | Description
hComputer | Handle of a remote computer to which sound data will be sent.
pWaveFormatData | Pointer to a structure that describes the sound format.
pWaveData | Pointer to a structure containing the sound data.
pdwDataSize | Pointer to a variable which will be updated with the size of the data that was sent. This parameter is optional. You can pass NULL if you don't need this information.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function sends the pWaveFormatData structure first, including all the extra bytes needed by the format. It then sends the pWaveData structure, followed by the actual sound data.

The remote computer will receive an INET_SOUND_RECEIVED notification and pBuffer will point to pWaveFormatData. The remote computer will have to obtain the pointer to pWaveData. Since this structure follows the pWaveFormatData structure, use the SIZEOF_WAVEFORMATDATA macro to determine the size of the pWaveFormatData structure and thus the start of the pWaveData structure. On the remote computer, LEADTOOLS automatically adjusts pWaveData->lpData to point to the sound data.

The remote end can use pWaveFormatData and pWaveData to save the sound to a file, or to play it (using L_CapStartFeedSound).

The sound format is sent every time so that it will facilitate handling multiple connections to different computers that are recording sound in different formats.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSendBitmap, L_InetSendData, L_InetConnect, L_InetClose, L_InetReadData, L_InetAutoProcess, L_InetServerInit, L_InetClearQueue, L_InetGetQueueSize, INETCALLBACK, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

For a more complex example, you can look at the source for
 the NETCAP example.

This example contains code for both the server and the client program and
 shows
how sound can be captured by the client and sent to the server.

// ------------ code on the server side -------------
L_COMP hServer;
HGLOBAL hSoundServer;
L_COMP hClient;

...
if(L_InetServerInit(1000,&hServer,InetCallbackServer,NULL) != SUCCESS)
MessageBox(NULL, TEXT("Error attempting to start
 the server"), TEXT("ERROR"), MB_OK);
...

// at some point, before the end of the server program you should do
// L_InetClose(hServer, FALSE); or L_InetClose(hServer, TRUE);
// L_CapStopFeedSound(hSoundServer, FALSE); or L_CapStopFeedSound(hSoundServer,
 TRUE);

L_INT L_EXPORT EXT_CALLBACK InetCallbackServer(L_COMP hComp,L_INT nMessage,
 L_INT nError,
L_CHAR L_FAR *pBuffer,L_INT32 lSize, L_VOID L_FAR*pUserData)
{
switch(nMessage)
{
case INET_CONNECT_REQUEST: // somebody
 wants to connect with us
if(nError == SUCCESS)
{
L_InetAcceptConnect (hServer,&hClient,
 InetCallbackServer, NULL);
if(hSoundServer)
L_CapStopFeedSound
 (hSoundServer, TRUE);
hSoundServer
 = NULL;
}
break;

case INET_SOUND_RECEIVED:
// note: we will
 do less error checking to make the code simpler
// still check for
 nError being SUCCESS to make sure we won't get memory violations
if(nError == SUCCESS)
{
LPWAVEFORMATDATA
 pFormatData = (LPWAVEFORMATDATA)pBuffer;
LPWAVEDATA
 pWaveData = (LPWAVEDATA)(pBuffer + SIZEOF_WAVEFORMATDATA(pFormatData));

if(!hSoundServer)
//
 first time we received sound data. start playing the sound
L_CapStartFeedSound
 (&hSoundServer, NULL, CAP_DEVICE_MAPPER, pFormatData, 0, CAP_FEED_PLAYDATA,
 NULL, NULL);

L_CapFeedSound
 (hSoundServer, pWaveData);
}
break;
}
return TRUE;
}

// ----------- code on the client side -------------

L_COMP hClient;
HGLOBAL hSoundClient;

/* note: instead of server_address you need to put the IP address
of the computer running the server. You can also put in
the computer name, if the server is running on a local network */

...
if(L_InetConnect ("server_address",
 1000, &hClient, InetCallbackClient, NULL) != SUCCESS)
MessageBox(NULL, TEXT("Error attempting to connect"),
 TEXT("ERROR"), MB_OK);
...

// somewhere before the end of the program you should do
// L_InetClose(hRemoteServer, FALSE); or L_InetClose(hRemoteServer, TRUE);
// L_CapCloseRecord(hSoundClient);

L_INT L_EXPORT EXT_CALLBACK RecordCallback(LPWAVEDATA pWaveData, L_VOID
 L_FAR*pUserData)
{
L_UINT32 dwTotalSize;
L_InetSendSound(hClient, pWaveFormatData, pWaveData,
 &dwTotalSize);
// dwTotalSize has now the size of the data being sent
return SUCCESS;
}

L_INT L_EXPORT EXT_CALLBACK InetCallbackClient(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize,L_VOID L_FAR*pUserData)
{
L_UINT uWaveFormatSize;
LPWAVEFORMATDATA pWaveFormatData;

switch(nMessage)
{
case INET_CONNECT:
/* check the status
 and send some data */
if(nError == SUCCESS)
{
//
 note: hComp will be the same as hClient. but you can reassign it anyway
hClient
 = hComp;

//
 start recording in the current default Windows format
//
 get the format size
L_CapGetDefaultAudFormat
 (NULL, &uWaveFormatSize, NULL, NULL);
//
 allocate memory and get the format
pWaveFormatData
 = GlobalAllocPtr(GMEM_MOVEABLE, uWaveFormatSize);
L_CapGetDefaultAudFormat(pWaveFormatData,
 &uWaveFormatSize, NULL, NULL);

if(L_CapOpenRecord(&hSoundClient,
 CAP_DEVICE_MAPPER, pWaveFormatData, 0, pWaveFormatData->nAvgBytesPerSec,
 RecordCallback, NULL) != SUCCESS)
{
MessageBox(NULL,
 TEXT("Error starting recording!"), TEXT("Error"),
 MB_OK);
break;
}
else
L_CapStartRecord
 (hSoundClient);

//
 i don't need this anymore
GlobalFreePtr(pWaveFormatData);
}
break;
}
return SUCCESS;
}


L_InetServerInit

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetServerInit(nPort, phComputer, pfnCallback, pUserData)

L_INT nPort; | /* port on which to listen */
L_COMP L_FAR * phComputer; | /* address of variable to update */
INETCALLBACK pfnCallback; | /* pointer to a callback function */
L_VOID L_FAR *pUserData; | /* user defined callback data */

Sets up a port to act as a server to which other computers can connect.

Parameter | Description
nPort | Port number on which to listen for incoming connections. Some commonly used values include:
 | Value | Meaning
 | 0x015 | FTP
 | 0x050 | Web server
 | 0x077 | News
 | 0x019 | Mail
 | 0x017 | Telnet
phComputer | Address of a variable to updated with the handle to the server computer
pfnCallback | Pointer to a callback function of type INETCALLBACK for receiving messages for phComputer. Use the function pointer to your callback function as the value of this parameter.
pUserData | Void pointer that you can use to pass one or more additional parameters that the callback function needs.
 | To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID L_FAR *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.
 | If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function returns immediately, and the INETCALLBACK function will be called when other computers attempt to connect to phComputer.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetConnect, L_InetClose, L_InetAcceptConnect, INETCALLBACK, L_InetStartUp, L_InetShutDown
Topics: | Internet Functions

Example

L_COMP hServer; /* the handle to the server */
L_INT nRet;

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize,L_VOID L_FAR*pUserData);

/* you do not need to use MakeProcInstance for 32 bit applications
 */
nRet = L_InetServerInit(1000, &hServer,
 InetCallback, NULL);
if(nRet != SUCCESS)
MessageBox(NULL, TEXT("The server failed to start!"),
 TEXT("Error"), MB_OK);

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,
L_INT nMessage, L_INT nError, L_CHAR L_FAR *pBuffer,
L_UINT32 lSize,L_VOID L_FAR*pUserData)
{
L_INT nRet;
L_COMP hClient;

switch(nMessage)
{
case INET_CONNECT_REQUEST:
/* check the status and send some data */
if(nError == SUCCESS)
{
/* somebody is trying to connect to our server accept the connection into the server created above */
nRet = L_InetAcceptConnect(hServer, &hClient, InetCallback, NULL);
if(nRet == SUCCESS)
MessageBox(NULL, TEXT("Connection accepted successfully"), TEXT("Info"), MB_OK);

/* remove the next line if you want to keep the connection open in your app you should save hClient in a list of active
connections */
L_InetClose(hClient, TRUE);
}
else
MessageBox(NULL, TEXT("You have failed to connect!"), TEXT("Error"), MB_OK);
break;
}
return SUCCESS;
}


L_InetSetCallback

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSetCallback(hComputer, pfnCallback, pUserData)

L_COMP hComputer; | /* computer to associate the callback data with */
INETCALLBACK pfnCallback; | /* callback to associate */
L_VOID L_FAR * pUserData; | /* user data to associate */

Sets the function that will receive notifications for the specified computer handle.

Parameter | Description
hComputer | Handle to the computer that will be associated with the callback function and the user data.
pfnCallback | Pointer to a callback function of type INETCALLBACK, for receiving messages for hComputer. Use the function pointer to your callback function as the value of this parameter.
pUserData | Void pointer that you can use to pass one or more additional parameters that the callback function needs.
 | To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID L_FAR *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.
 | If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS | This function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function can be used to change the function that will receive notifications for a computer handle. It can also be used to change the user data associated with it

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetServerInit, L_InetAcceptConnect, L_InetConnect, L_InetGetCallback
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

L_VOID SetNewCallbackData(L_COMP hComputer, L_VOID L_FAR*pData)

{

INETCALLBACK pfnCallback;

L_VOID L_FAR* pUserData;

L_InetGetCallback(hComputer, &pfnCallback, &pUserData);

if(pData != pUserData)

L_InetSetCallback(hComputer, pfnCallback, pData);

}


L_InetSetCommandCallback

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSetCommandCallback(hComputer, pfnCallback, pUserData)

L_COMP hComputer; | /* computer to associate the callback data with */
INETCALLBACK pfnCallback; | /* callback to associate */
L_VOID L_FAR * pUserData; | /* user data to associate */

Sets the command callback function to use for incoming command requests.

Parameter Description

hComputer | Handle of the host computer to be associated with the callback.
pfnCallback | Pointer to an optional callback. You can pass NULL if you want the default INETCALLBACK to be called when a command request is received.
pUserData | Void pointer that can be used to access a variable or structure containing data that the callback function needs. This gives you a way to receive data indirectly from the function that uses this callback.
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type within the callback function.

Returns

SUCCESS | This function was successful.
< 1 | An occurred. Refer to Return Codes.

Comments

This function sets a specialized callback to handle the incoming command requests. By default, the INETCALLBACK handles the command requests, but INETCALLBACK is not suitable for handling the command parameters and extra data. Use an INETCOMMANDCALLBACK function to process the command requests properly.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | INETCOMMANDCALLBACK, L_InetSetResponseCallback, INETRESPONSECALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

/*

This example will create a server and set the command and
 response callback
*/
L_COMP ghServer;
// Global bitmap list used to hold the local bitmaps loaded with CMD_LOAD
HBITMAPLIST ghBitmapList;
// Bitmap loaded on the remote computer using L_InetSendCmdLoad
L_UINT guBitmapID; // the bitmap ID which is loaded on the remote
 computer
L_COMP ghComputer; // the computer where the bitmap is loaded
L_UINT guWindowID; // the id of the window that is created on the remote
 computer

// This can be either the local or the remote computer
//**********  Code on the remote computer ****************/
L_INT RemoveBitmap(L_UINT uBitmapID);
L_INT GetLocalBitmap(pBITMAPHANDLE pBitmap, L_UINT uBitmapID);
L_INT AddBitmap(pBITMAPHANDLE pBitmap, L_UINT L_FAR*puBitmapID);

L_INT L_EXPORT EXT_CALLBACK InetCallback(L_COMP hComp,L_INT nMessage, L_INT
 nError, L_CHAR L_FAR *pBuffer, L_UINT32 lSize,L_VOID L_FAR*pUserData)
{
L_TCHAR s[100]; /* set up a buffer to retrieve the name
 of the server */
L_UINT32 sizeof_s = sizeof(s); /* the size of s */
switch(nMessage)
{
case INET_CONNECT:
/* check the status and try to get
 server's name */
if(nError == SUCCESS)
{
/* now you can assume
 you are connected to computer 'hComp' */
if(L_InetGetHostName(hComp,
 (L_CHAR) s, HOST_NAME_IP, &sizeof_s) == SUCCESS)
{
MessageBox(NULL,
 TEXT("You have successfully connected to"), s, MB_OK);
}
/* do whatever you
 want to do with the server here ... */
/* remove the next
 line if you want to keep the connection open */
L_InetClose(hComp,
 TRUE);
}
else
MessageBox(NULL,
 TEXT("You have failed to connect!"), TEXT("Error"),
 MB_OK);
break;
}
return SUCCESS;
}

L_INT EXT_CALLBACK InetCommandCallback(L_COMP hComputer,CMDTYPE uCommand, L_UINT uCommandID,L_INT nError, L_UINT uParams,pPARAMETER pParams, L_UINT uExtra,L_CHAR L_FAR *pExtra, L_VOID L_FAR *pUserData)

{
L_INT  nStatus = ERROR_FEATURE_NOT_SUPPORTED;
BITMAPHANDLE Bitmap;
L_UINT uBitmapID =
 (L_UINT)-1;
COLORREF L_FAR *pColor=NULL;
L_UINT32 lColorSize=0;
if(nError != SUCCESS)
nStatus
 = ERROR_TRANSFER_ABORTED;
else
switch(uCommand)
{
case
 CMD_LOAD:
// check
 the validity of the parameters
if(uParams == 4 && pParams[0].uType
 == PARAM_STRING && pParams[1].uType == PARAM_INT32 &&
 pParams[2].uType == PARAM_INT32 && pParams[3].uType == PARAM_UINT32)
{
nStatus = L_LoadFile((L_TCHAR*)pParams[0].pValue,
 &Bitmap,sizeof(Bitmap), pParams[1].iValue, pParams[2].iValue, pParams[3].iValue,
 NULL, NULL, NULL, NULL);
if(nStatus == SUCCESS)
{
//
 add the bitmap to the list of currently open bitmaps
nStatus
 = AddBitmap(&Bitmap, &uBitmapID);
}
}
else
nStatus = ERROR_INV_PARAMETER;
 // invalid parameters
return L_InetSendLoadRsp(hComputer,
 uCommandID, uBitmapID, 0, NULL, nStatus);
case CMD_SAVE:
if(uParams == 6 &&
 pParams[0].uType == PARAM_STRING && pParams[1].uType == PARAM_UINT32
 && pParams[2].uType == PARAM_INT32 && pParams[3].uType
 == PARAM_INT32 && pParams[4].uType == PARAM_INT32 && pParams[5].uType
 == PARAM_UINT32)
{
uBitmapID
 = pParams[1].uiValue;

nStatus
 = GetLocalBitmap(&Bitmap, uBitmapID);
if(nStatus
 == SUCCESS)
nStatus
 = L_SaveFile((L_TCHAR*)pParams[0].pValue, &Bitmap, pParams[2].iValue,
 pParams[3].iValue, pParams[4].iValue, pParams[5].uiValue, NULL, NULL,
 NULL);
}
else
nStatus
 = ERROR_INV_PARAMETER;
return L_InetSendSaveRsp(hComputer,
 uCommandID, 0, NULL, nStatus);
case CMD_FREE_BITMAP:
if(uParams == 1 &&
 pParams[0].uType == PARAM_UINT32)
nStatus
 = RemoveBitmap(pParams[0].uiValue);
else
nStatus
 = ERROR_INV_PARAMETER;
return L_InetSendFreeBitmapRsp(hComputer,
 uCommandID, 0, NULL, nStatus);
case CMD_GET_MAGGLASS_DATA:
if(uParams == 5 &&
 pParams[0].uType == PARAM_UINT32 && pParams[1].uType == PARAM_UINT32
 && pParams[2].uType == PARAM_USTRING && pParams[3].uType
 == PARAM_INT16 && pParams[4].uType == PARAM_INT16)
{
uBitmapID
 = pParams[0].uiValue;

nStatus
 = GetLocalBitmap(&Bitmap, uBitmapID);
if(nStatus
 == SUCCESS)
{
nStatus
 = L_InetGetMagGlassData(&Bitmap, &lColorSize, NULL, pParams[2].puValue,
 pParams[3].sValue, pParams[4].sValue);
if(nStatus
 == SUCCESS)
{
pColor
 = GlobalAllocPtr(GHND, lColorSize);
nStatus
 = L_InetGetMagGlassData(&Bitmap, &lColorSize, pColor, pParams[2].puValue,
 pParams[3].sValue, pParams[4].sValue);
}
}
}
else
nStatus = ERROR_INV_PARAMETER;
L_InetSendGetMagGlassDataRsp
 (hComputer, uCommandID, lColorSize, pColor, pParams[1].uiValue, pParams[2].puValue,
 pParams[3].sValue, pParams[4].sValue, 0, NULL, nStatus);
if(pColor)
{
GlobalFreePtr(pColor);
pColor=NULL;
}
break;
}
return L_InetSendRsp(hComputer, uCommand, uCommandID,
 NULL, nStatus);
}

//**********  Code on the local computer ****************/
L_VOID EXT_CALLBACK InetResponseCallback(L_COMP hComputer,CMDTYPE uCommand,
 L_UINT uCommandID,L_INT nError, L_INT nStatus,L_UINT uParams, pPARAMETER
 pParams, L_UINT uExtra, L_CHAR L_FAR *pExtra,L_VOID L_FAR *pUserData)
{
if(nError != SUCCESS)
{
OutputDebugString(TEXT("An error
 has occurred processing the response!"));
return;
}
switch(uCommand)
{
case CMD_LOAD:
if(nStatus == SUCCESS)
{
if(uParams
 == 1 && pParams[0].uType == PARAM_UINT32)
{
ghComputer
 = hComputer;
guBitmapID
 = pParams[0].uiValue;
OutputDebugString(TEXT("Load
 SUCCEEDED!"));
}
}
else
OutputDebugString
 (TEXT("Load failed!"));
break;
case CMD_CREATE_WIN:
if(nStatus == SUCCESS)
{
if(uParams
 == 1 && pParams[0].uType == PARAM_UINT32)
{
//
 the window has been created - store the window ID for later use
ghComputer
 = hComputer;
guWindowID
 = pParams[0].uiValue;
}
OutputDebugString(TEXT("Create
 window SUCCEEDED!"));
}
else
OutputDebugString
 (TEXT("Create Window failed"));
break;
case CMD_FREE_BITMAP:
if(nStatus == SUCCESS)
OutputDebugString(TEXT("Free
 bitmap SUCCEEDED!"));
else
OutputDebugString
 (TEXT("Free bitmap failed"));
break;
}
}

L_INT StartServer()
{
L_INT  nRet;
nRet = L_InetServerInit(1000,&ghServer,InetCallback,NULL);
if(nRet==SUCCESS)
{
L_InetSetCommandCallback(ghServer,
 InetCommandCallback, NULL);
L_InetSetResponseCallback(ghServer,
 InetResponseCallback, NULL);
}
return nRet;
}

/*
The local bitmaps are identified by the index in the bitmap list.
*/
L_INT AddBitmap(pBITMAPHANDLE pBitmap, L_UINT L_FAR*puBitmapID)
{
L_INT nRet;
if(!ghBitmapList)
{
nRet = L_CreateBitmapList(&ghBitmapList);
if(nRet != SUCCESS)
{
L_FreeBitmap(pBitmap);
return nRet;
}
}
nRet = L_InsertBitmapListItem(ghBitmapList, (L_UINT)-1,
 pBitmap);
if(nRet == SUCCESS)
L_GetBitmapListCount(ghBitmapList,
 puBitmapID);
else
// free the bitmap if an error occurs
 because the caller is not doing anything else with it
L_FreeBitmap(pBitmap);
return nRet;
}

L_INT GetLocalBitmap(pBITMAPHANDLE pBitmap, L_UINT uBitmapID)
{
if(ghBitmapList)
return L_GetBitmapListItem(ghBitmapList,
 uBitmapID, pBitmap, sizeof(pBitmap));
return ERROR_INV_PARAMETER;
}

L_INT RemoveBitmap(L_UINT uBitmapID)
{
L_INT nRet = ERROR_INV_PARAMETER;

if(ghBitmapList)
{
nRet = L_DeleteBitmapListItems(ghBitmapList,
 uBitmapID, 1);
if(nRet == SUCCESS)
{
// Go to all the
 places that you might have used this bitmap and make the
// necessary changes
}
}
return nRet;
}


L_InetSetResponseCallback

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetSetResponseCallback(hComputer, pfnCallback, pUserData)

L_COMP hComputer; | /* computer to associate the callback data with */
INETCALLBACK pfnCallback; | /* callback to associate */
L_VOID L_FAR * pUserData; | /* user data to associate */

Sets the response callback function to use for incoming responses.

Parameter Description

hComputer | Handle of the host computer to be associated with the callback.
pfnCallback | Pointer to an optional callback. You can pass NULL if you want the default INETCALLBACK to be called when a command request is received.
pUserData | Void pointer that can be used to access a variable or structure containing data that the callback function needs. This gives you a way to receive data indirectly from the function that uses this callback.
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type within the callback function.

Returns

SUCCESS | This function was successful.
< 1 | An occurred. Refer to Return Codes.

Comments

This function sets a specialized callback to handle the incoming responses. By default, the INETCALLBACK handles the responses. But INETCALLBACK is not suitable for handling the response parameters and extra data. Use an INETRESPONSECALLBACK function to process the responses properly.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | INETRESPONSECALLBACK, L_InetSetCommandCallback, INETCOMMANDCALLBACK
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSetCommandCallback.


L_InetShutDown

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetShutDown(L_VOID)

Shuts down the LEADTOOLS Internet DLL.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function shuts down the LEADTOOLS Internet DLL. This must be the last function that is called to free up any memory that is associated with the Internet DLL. No other Internet function can be used after L_InetShutDown is called. If you wish to use other functions after calling this function, L_InetStartUp must be called again.

You must initialize the LEADTOOLS Internet DLL using L_InetStartUp before calling this function.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetStartUp, L_InetSendSound
Topics: | Internet Functions

Example

For an example, refer to L_InetStartUp .


L_InetStartUp

#include "l_bitmap.h"
#include "ltnet.h"

L_INT EXT_FUNCTION L_InetStartUp(L_VOID)

Initializes the LEADTOOLS Internet DLL.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function initializes the LEADTOOLS Internet DLL. This must be the first function that is called before using any other Internet functions. For each call to L_InetStartUp, there needs to be a corresponding call to L_InetShutDown.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetShutDown, L_InetSendSound
Topics: | Internet Functions

Example

int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
 LPSTR lpszCmdLine, int nCmdShow)
{
MSG msg ;
/* start up internet DLL */
L_InetStartUp();
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg) ;
DispatchMessage(&msg) ;
}
/* shut down internet DLL */
L_InetShutDown();
return(msg.wParam);
}


INETCALLBACK Function

#include "l_bitmap.h"
#include "ltnet.h"

L_INT pEXT_CALLBACK YourFunction (hComputer, nMessage, nError, pBuffer, lSize, pUserData)

L_COMP hComputer; | /* handle to a connected computer */
L_INT nMessage; | /* reason for the callback */
L_INT nError; | /* error code */
L_VOID L_FAR * pBuffer | /* data buffer */
L_UINT32 lSize; | /* size of the data buffer */
L_VOID L_FAR * pUserData; | /* pointer to additional parameters */

Handles the messages received by a connected computer.

Parameter | Description
hComputer | Handle to the computer connection that is receiving the message.
nMessage | Value indicating reason for the callback. Can be one of the following values:
 | Value | Meaning
 | INET_CONNECT | [0x0000] connected to remote computer.
 | INET_DATA_READY | [0x0001] data ready to be read
 | INET_CLOSE | [0x0002] connection has been terminated
 | INET_CONNECT_REQUEST | [0x0003] remote computer is requesting a connection
 | INET_DATA_SENT | [0x0004] data has been completely sent to remote
 | INET_DATA_SENDING | [0x0005] queued data has been sent
 | INET_DATA_START | [0x0006] about to start receiving data
 | INET_DATA_RECEIVING | [0x0007] receiving data from a remote connection
 | INET_IMAGE_RECEIVED | [0x0008] an image has been received
 | INET_MMEDIA_RECEIVED | [0x0009] a multimedia object has been received
 | INET_SOUND_RECEIVED | [0x000A] sound block has been received
 | INET_USER1_RECEIVED | [0x000B] user data has been received
 | INET_USER2_RECEIVED | [0x000C] user data has been received
 | INET_USER3_RECEIVED | [0x000D] user data has been received
 | INET_USER4_RECEIVED | [0x000E] user data has been received
nError | If no error has occurred, nError will be SUCCESS. If nError is < SUCCESS, an error has occurred.
pBuffer | Pointer to a data buffer. The buffer can hold different data, depending on nMessage:
 | Message | Type of data in pBuffer
 | INET_IMAGE_RECEIVED | pBuffer points to a BITMAPHANDLE structure containing the bitmap.
 | INET_MMEDIA_RECEIVED | pBuffer points to a MEDIAHANDLE structure containing a multimedia object.
 | INET_USERx_RECEIVED | pBuffer points to data of a user-defined format.
 | INET_SOUND_RECEIVED | pBuffer points to a WAVEFORMATDATA structure, followed by a WAVEDATA structure.
 | other | Not used
lSize | The size of the data pointed to by pBuffer. The value depends on nMessage:
 | Message | Size of data in pBuffer
 | INET_DATA_READY | The size of the available data pointed to by pBuffer.
 | INET_USERx_RECEIVED | The size of the user-defined data pointed to by pBuffer.
 | INET_SOUND_RECEIVED | The size of the data pointed to by pBuffer.
pUserData | A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of the calling function.)
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If nMessage is INET_IMAGE_RECEIVED, the bitmap pointed to by pBuffer will be freed upon returning from the callback. If you want to keep the bitmap, you can make a copy of the bitmap before returning.

If nMessage is INET_MMEDIA_RECEIVED, the multimedia object pointed to by pBuffer was opened in L_OPEN_READ mode.

If nError is < SUCCESS, pBuffer should be ignored.

The INET_DATA_READY message is sent before the INET_IMAGE_RECEIVED, INET_MMEDIA_RECEIVED or INET_USERx_RECEIVED messages so that you can determine the total amount of data that will be received.

If auto process was not enabled for hComputer, pBuffer will be NULL, and you should read the data by calling L_InetReadData.

Immediately after successfully connecting to a LEADTOOLS server started with L_InetServerInit, the INETCALLBACK function will be called. If auto process is enabled, the first message will be INET_USER1_RECEIVED and pBuffer will contain a NULL terminated string containing "LEAD Technologies Server X.X" where X.X is the server version number. If auto process is not enabled, the first message will be INET_DATA_READY, and the version string can be read using L_InetReadData.

If nMessage is INET_SOUND_RECEIVED, then pBuffer points to a WAVEFORMATDATA structure followed by a WAVEDATA structure.

Note:

The WAVEFORMATDATA structure is a variable length structure. For more information, refer to the example for L_InetSendSound.

The buffer pointed to by pBuffer will be freed upon returning from the callback.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

L_InetAutoProcess, L_InetReadData, L_InetSendData

Example

For an example, refer to L_InetConnect or L_InetSendSound.


INETCOMMANDCALLBACK

#include "l_bitmap.h"
#include "ltnet.h"

L_VOID pEXT_CALLBACK INETCOMMANDCALLBACK (hComputer, uCommand, uCommandID, nError, uParams, pParams, uExtra, pExtra, pUserData)

L_COMP hComputer; | /* handle to a remote computer */
CMDTYPE uCommand; | /* command type */
L_UINT uCommandID; | /* command id */
L_INT nError; | /* status of the received data */
L_UINT uParams; | /* number of parameters */
pPARAMETER pParams; | /* pointer to an array of parameters */
L_UINT uExtra; | /* length */
L_CHAR L_FAR * pExtra; | /* pointer to extra data*/
L_VOID L_FAR * pUserData; | /* pointer to additional parameters */

Notifies the local computer that a command has been received from a remote computer

Parameter | Description
hComputer | Handle to the remote computer that sent the command.
uCommand | Command received from the remote computer. For a list of possible values, refer to CMDTYPE.
uCommandID | Message Id. Each message sent by a member of a connection should have a unique ID. Since a member of a connection may send several messages, this ID allows that member to identify when a specific request has been completed.
nError | Determines whether the command was received properly. If not all the parameters were received properly, then nError will be set to an error code (usually ERROR_TRANSFER_ABORTED)
uParams | The number of parameters for this command.
pParams | Pointer to an array of PARAMETER structures that contain the parameters for the command.
uExtra | Length of any extra data sent with the command.
pExtra | Pointer to the extra data sent with the command.
pUserData | A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of the calling function.)
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

Returns

None

Comments

A call to this function is generated when a computer receives a command request from a remote computer.

To use this callback function, it must be set using L_InetSetCommandCallback. If this callback function is not set, INETCALLBACK will be called instead.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSetCommandCallback, INETRESPONSECALLBACK, L_InetSetResponseCallback
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSetCommandCallback.


INETRESPONSECALLBACK

#include "l_bitmap.h"
#include "ltnet.h"

L_VOID pEXT_CALLBACK INETRESPONSECALLBACK (hComputer, uCommand, uCommandID, nError, nStatus, uParams, pParams, uExtra, pExtra, pUserData)

L_COMP hComputer; | /* handle to a remote computer */
CMDTYPE uCommand; | /* command type */
L_UINT uCommandID; | /* message id */
L_INT nError; | /* status of the received data */
L_INT nStatus; | /* status */
L_UINT uParams; | /* number of parameters */
pPARAMETER pParams; | /* pointer to parameters*/
L_UINT uExtra; | /* length*/
L_CHAR L_FAR * pExtra; | /* pointer to extra data*/
L_VOID L_FAR * pUserData; | /* pointer to additional parameters*/

Notifies the local computer that a response has been received from a remote computer

Parameter | Description
hComputer | Handle to the remote computer that sent this command.
uCommand | The command type which prompted this response. For a list of possible values, refer to CMDTYPE.
uCommandID | Command Id. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific request has been completed.
nError | Determines whether the command was received properly. If not all the parameters were received properly, then nStatus will be set to an error code (most likely ERROR_TRANSFER_ABORTED). Note that this is not the status of the command. This is only an indication of whether this response has been received properly. nStatus indicates whether the command has executed properly or not.
nStatus | Status of the original command. It indicates whether the command has executed properly on the remote end. If the command completes successfully, this should be SUCCESS. Otherwise the value should be one of the Error Codes.
uParams | The number of parameters for this response.
pParams | Pointer to an array of PARAMETER structures that contain the parameters for the response.
uExtra | Length of any extra data sent with the response.
pExtra | Pointer to the extra data sent with the response.
pUserData | A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of the calling function.)
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

Comments

A call to this function is generated when a computer receives a response from a remote computer.

To use this callback function, it must be set using L_InetSetResponseCallback. If this callback function is not set, INETCALLBACK will be called instead.

Note:

The parameters (uParams, pParams) and the extra data (uExtra, pExtra) for this response are not the parameters of the original command! They are only sent if this response needs to send some data to the computer that originally sent the command. An example of a response that needs to send a parameter back is the response for the CMD_CREATE_WIN command. In this case, the response will need to send back the window handle of the newly created window. Most of the responses will only send back the status of the command (nStatus).

The string parameters and pExtra are only valid during this call. Do not free these pointers and don’t try to keep references to the strings. If the data is needed outside this function, allocate buffers and copy the data into them.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions: | L_InetSetResponseCallback, INETCOMMANDCALLBACK, L_InetSetCommandCallback
Topics: | Sending Commands and Responses
 | A Client-Server Diagram: Sending Commands and Responses

Example

For an example, refer to L_InetSetCommandCallback.


LEADTOOLS Reference Manuals

LEADTOOLS provides reference manuals that contain the same information as the online help. You can print them from PDF files. Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

To print the PDF files, you must use the Adobe Acrobat Reader 3.0 or higher. You can download a copy of the Acrobat Reader from the Adobe web site (http://www.adobe.com). Note that different versions of the Acrobat Reader are available for different operating systems, but they all can read the same PDF files.


Raster Pro/Document/Medical Features

Raster Pro:

LEADTOOLS Raster Imaging Pro provides some imaging capabilities that are not available in the LEADTOOLS Raster Imaging product. In order to access these features, you must unlock them by calling L_UnlockSupport(L_SUPPORT_LTPRO, L_KEY_LTPRO). L_KEY_LTPRO can be found in ltkey.h.

If you are a licensed user of LEADTOOLS Raster Imaging, and would like to access Raster Imaging Pro features, you must contact Tech Support for information on obtaining a license and the unlock key for calling L_UnlockSupport.

Document/Medical:

LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite are the most comprehensive imaging toolkits on the market. No other toolkit provides as many imaging features for color, gray-scale and black & white images in one development package, and for one price. These toolkits comprise LEAD's best code and are designed for the programmer who is looking for the fastest performance, and/or the most extensive color, document, and medical imaging capabilities available.

These toolkits contain powerful annotation capabilities and optimized document image processing filters, and high performance compression, decompression and viewing of JPEG, LEAD CMP, MRC and CCITT G3/G4. The annotation capabilities enable the programmer to add text, highlights, sticky notes, audio, ellipses, buttons, lines, arrows, rectangles, polygons, redaction (blackout), hotspots, freehand scribble, pointers, bitmap and text stamps, to black & white and color images. Programmers working with document imaging will also find special processing filters such as despeckle, deskew, favor black, and scale to gray to enhance their black and white 1 bit images. Additionally, you can achieve faster rotation in 90-degree increments by applying a rotated view perspective to the bitmap. These LEADTOOLS toolkits offer the fastest software-only JPEG decoder available.

LEADTOOLS Document Imaging

The LEADTOOLS Document Imaging toolkit contains all the features available in the LEADTOOLS Raster Imaging Pro. In addition, it contains the following capabilities:

Special functions for Document (bitonal) images. The LEADTOOLS functions for bitonal images are especially useful for working with images from black-and-white scanners or FAX machines. These functions let you do things such as automatically straighten (deskew) an image, remove spots (despeckle), or clarify a scaled display (using scale-to-gray and favor-black features).

Annotation. LEADTOOLS supports annotation of images by letting you overlay images with text, lines, shapes, arrows, buttons, highlights, hot spots, sticky notes, stamps, buttons, and sounds.

Fast rotation. LEADTOOLS achieves fast rotation in 90-degree increments by applying a rotated view perspective to the bitmap.

ISIS support. LEADTOOLS supports ISIS interfaces for driving scanning devices.

Faster compression and decompression. The Document/Medical editions work faster when loading and saving LEAD CMP, JPEG, and CCITT Group 3 and Group 4 images. The LEADTOOLS functions for loading and saving are the same in all products. The only difference is in performance.

1-bit Image Clean-up. The Document toolkits include support for removing dots, blobs, holes, inverted text, lines, borders, bumps and nicks from 1-bit images.

Region Clean-up. [Document/Medical] Remove all the holes from a region.

Embedded Messages. The Document toolkits include support for embedding messages in lossless image formats like bmp, tiff, lossless jpeg, etc. The message is embedded without any visible changes to the image, and does not appreciably increase the size of the image. The message is password-protected.

Image Conversion. The Document toolkits include support for transforming a bitmap into a binary image using specified thresholds or a threshold calculated automatically based on statistical features of the bitmap.

12 and 16 bit grayscale images. [Document/Medical] Load, process, display, window level and save 12 and 16 bit grayscale images (including support for 16-bit grayscale TIFF).

48 and 64 bit color images. [Document/Medical] Load, process, display, and save 48 and 64 bit color images.

MRC Support. [Document/Medical] LEADTOOLS supports the Mixed Raster Content format for color documents containing mixed image and text components. For more information, refer to the .

Halftoning. [Document/Medical] Convert 1-, 4-, 8-, 16-, 24-, or 32-bit bitmaps to a halftoned bitmap, with a specified pattern rotation. A halftoned bitmap is a 1-bit bitmap that has been dithered for black and white printing or display.

LEADTOOLS Document Imaging Suite

The LEADTOOLS Document Imaging Suite toolkit contains all the capabilities of LEADTOOLS Document Imaging, and includes the features listed below. Please note that the OCR features are included in this toolkit, however they can also be purchased as a plug-in for the LEADTOOLS Document Imaging toolkit. Also, JBIG support is provided in this toolkit, however a JBIG Module may be added on to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite.

OCR features. [Document/Medical] LEAD offers OCR features that use Scansoft Textbridge technology. Support for these features is included in the LEADTOOLS Document Imaging Suite, and can be added, via plug-in to the LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite toolkits. The OCR features allow you to perform optical character recognition and turn images into documents. Features include preset confidence and accuracy levels for controlling how sensitive the engine is to unrecognized text, artificial intelligence for improving recognition on documents of the same type, and built-in and user-defined lexicons for limiting the type of text to recognize within a particular zone. LEADTOOLS provides the ability to verify or correct text during, and (using LEAD's unique OCR editor) after recognition. LEAD's OCR editor ties the text being edited directly to the image, providing a visual reference to the original bitmap data. The OCR engine can perform Automatic area segmentation creating multi-layered zones, recognizing areas such as tables, rules, images and text. Or, you can manually designate up to 250 such zones. The OCR features support different fonts, sizes (5 to 72 point) and styles. Fax, dot matrix and halftones can be preprocessed to improve recognition results. The OCR Engine supports major European and Scandinavian languages (Danish, Dutch, Finnish, French, German, Italian, Norwegian, Portuguese, Russian, Spanish, and Swedish) as well as English. Support for dialects such as US. English, French Canadian, Latin American Spanish, Swiss German, and Brazilian Portuguese is also provided.

Recognized text can be exported to more than 40 different formats, including MS Word, MS Excel, Dbase andWordPerfect. The LEADTOOLS OCR features contain superior OCR processing speeds, for use in form recognition and processing applications.

LEAD's JBIG filter. [Document/Medical] LEAD includes support for this filter in the LEADTOOLS Document Imaging Suite toolkit. Support for this filter can be added to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite by purchasing the JBIG Module. JBIG defines a method for lossless compression encoding of a bi-level image (two-color image). This method can also be used for coding grayscale and color images. LEADTOOLS completely supports all three types of images, giving you the ability to make full use of this powerful compression technology. LEADTOOLS also supports the progressive capability of JBIG, allowing you to store and send multiple representations of images at different resolutions without any extra storage overhead.

LEADTOOLS Medical Imaging

LEADTOOLS Medical Imaging contains all the capabilities of LEADTOOLS Document Imaging. It also includes general medical imaging technologies (1-16,24,32 bit color, 1-16 bit grayscale and window leveling of 12 and 16-bit grayscale images) and support for the DICOM file format.

DICOM file support. [Medical] LEADTOOLS Medical Imaging provides COMPLETE support for the DICOM 3.0 specification, including all standard IOD classes and modalities (CR, CT, MR, NM, US, RF, SC, VL, etc.) and complete DICOM Basic Directory support.

Window leveling. [Document/Medical] Detect and set LowBit and HighBit for image data, display images with automatic LUT intensity expansion, or set LUT entries and ranges with specific values and gradients. Display images through the LUT without changing the data, or process the image data using the LUT. Linearize the number of pixels locally in a bitmap, based on the specified color space in order to bring out the detail in dark areas of an image, and smooth the edges between blocks.

Medical Imaging Processing. [Medical] LEADTOOLS Medical Imaging provides image processing functionality designed specifically to allow you to examine and improve the quality of medical images.

LEADTOOLS Medical Imaging Suite

LEADTOOLS Medical Imaging Suite contains all the capabilities of LEADTOOLS Medical Imaging. In addition, it supports the following:

DICOM Communication support. [Medical Suite] LEADTOOLS provides COMPLETE support for DICOM Communications, including all Service Classes (Verification, Storage, Query/Retrieve, Patient Management, etc), and contains high-level communications functions simplifying the creation of DICOM client/server applications.

(Document/Medical) is used in the documentation to designate the features that are available in LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite. Those features that are available only in the Medical toolkits are indicated in the documentation by (Medical). Features available only in the LEADTOOLS Medical Imaging Suite toolkit are indicated in the documentation by (Medical Suite).

(Internet only) is used in the documentation to designate the features that are available only in the LEADTOOLS Internet toolkit.

For more information, refer to Document/Medical Edition Support and Licensing Requirements .


Topic Selection

LEAD Technologies, Inc.
Suite 400,
1201 Greenwood Cliff,
Charlotte, NC 28204

Sales@Leadtools.com
www.leadtools.com

(704) 332-5532
FAX: (704) 372-8161
Tech Support: (704) 372-9681

LEADTOOLS is ideal for developers involved in still frame, multimedia, document, medical, and vector imaging projects, including Internet/Intranet applications. Independent of the specific application requirement – scanning, file format support/conversion, compression, image processing, annotation, database support, multimedia, etc. – LEADTOOLS provides the most comprehensive, robust, flexible, and powerful imaging solution available.

Click this button to start the Licensing help file to review the License Agreements governing your use of the software.

Click this button to start the Products help file to review the full line of LEADTOOLS Products.

Click this button to start the Imaging help file to review the full line of LEADTOOLS Image Categories.