Copyright Notices

©Copyright LEAD Technologies, Inc. 1991-2004. 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
E-mail: support@leadtools.com
Technical support: (704) 372-9681 or support@leadtools.com
Home page: http://www.leadtools.com


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 LEADTOOLS Licensing help file.
	Click this button to start the LEADTOOLS Products help file.
	Click this button to start the LEADTOOLS Image Categories help file.


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
Online Support / FAQs	http://www.leadtools.com (click on Customers Only)
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.


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 support for L_SUPPORT_LTPRO, using UnlockSupport.  To unlock these features, call 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 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, 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.

 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 Main COM help file (Ltcomn.chm) in the Help directory.

 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. [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.

	Click this button to start the LEADTOOLS Products help file.


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.


Syntax

This is the internal syntax of the property, method, or event. The external syntax depends on the development system you are using. Refer to the code example for your system, or for general information, refer to the following:

Visual Basic Syntax

Visual C++ 4.0 Syntax

Delphi 2.0 Syntax


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 functionality on a WIN32 system. (\REDIST\VIDEO subdirectory contains copies of these files.)

Please note that LTKRN, LTDIS, LTEFX, LTFIL, and LTIMG are required for ALL OCX applications. For more information on LTKRN, LTDIS, LTEFX, LTFIL, LTIMG and other files for the Main OCX, refer to Files To Be Included With Your Application.

Redistributables:	Explanation:	If you are using a standard release, the files to use are:	If you are using an evaluation release, the files to use are:
LTNET	Internet support.  LEAD Internet Control LEADTOOLS Internet Support DLL. Also requires the LEAD file format DLLs.  Additional required files are installed by WS2SETUP.EXE (Winsock 2.0).	DLL: LTNET14N.DLL  OCX: LTNET14N.OCX	DLL: LTNET14E.DLL  OCX: LTNET14E.OCX


System Files Updated

The LEADTOOLS installation procedure adds the DLL files and all of the required driver files to your WINDOWS\SYSTEM directory. For a list of these files, refer to Files To Be Included With Your Application.

In addition, the installation procedure, as noted in the remainder of this topic, updates Windows system files that are required by the LEADTOOLS example programs.

The LEADTOOLS WIN32 installation procedure adds the following Windows files to your WINDOWS\SYSTEM directory. If your system has an earlier version of any of these files, the installation procedure overwrites it with the newer version.

COMDLG32.OCX
CTL3D32.DLL
MFC40.DLL
MFC42.DLL
MSVCRT20.DLL
MSVCRT40.DLL
MSVCRT.DLL
OC30.DLL
OLE32.DLL
OLEAUT32.DLL
OLEPRO32.DLL
STDOLE2.TLB
VB40032.DLL
VEN2232.OLB


Tutorial for Visual C++ 4.0 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS Internet features ActiveX.

Note:	These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.
Initializing a Computer as a Server and Accepting Connections

Connecting to a Remote Computer

Sending Images to a Remote Computer

Receiving and Displaying Images from a Remote Computer

Miscellaneous Examples


Initializing a Computer as a Server and Accepting Connections (Visual C++ 4.0 and later)

Take the following steps to start a project and to add some code that will let you initialize a computer as a server and accept connections.

1.	Start a new project as follows:

For C++ 4.x, run Microsoft Developer Studio for Visual C++, select the File >New menu option, select Project Workspace, and click the OK button. In the New Project Workspace dialog box, do the following:

a.	In the Type list box, select MFC AppWizard (exe).

b.	In the Name text box, specify server.

c.	In the Location text box, specify the path of the project.

d.	In the Platforms list box, check Win32.

e.	Click the Create button.

For C++ 5.0, run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:

a.	Click the Projects tab.

b.	Select MFC AppWizard (exe) as the project type

c.	In the Project name text box, specify server.

d.	In the Location text box, specify the path of the project.

e.	Click the OK button.

2.	In the Step 1 dialog box, do the following:

a.	Select Dialog based.

b.	Click the Next button.

3.	In the Step 2 of 4 dialog box, do the following:

a.	Ensure that About Box is selected.

b.	Ensure that 3D controls is selected.

c.	Select OLE controls (ActiveX controls in 5.0).

d.	Click the Next button.

4.	In the Step 3 of 4 dialog box, do the following:

a.	For comments, ensure that Yes, Please is selected.

b.	For how to use the MFC library, select As a shared DLL.

c.	Click the Next button.

5.	In the Step 4 of 4 dialog box, just click Finish.

6.	Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)

7.	Add the L_OCX40.H, L_OcxErr.H, and Ltnetocx.h files, to your project as follows:

a.	Copy the l_ocx40.h, l_ocxerr.h, and Ltnetocx.h files to your project directory, from the \lead\include\ directory.

b.	In the Project Workspace, click the FileView tab.

c.	Double-click the server files folder to open it.

d.	Double-click the Dependencies folder (the Header Files folder in 5.0) to open it.

e.	Double-click the StdAfx.h file to edit it.

f.	Add the following lines to the end of the file:

#include "L_OCX40.H"
#include "Ltnetocx.h"

8.	Add a LEAD Internet control to the main window as follows:

For C++ 4.x:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the server resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_SERVER_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Insert > Component. (The Component Gallery appears.)

g.	Click the OLE controls tab.

h.	Double-click the LEAD Internet Control (14) icon. (The Confirm Classes dialog box appears.)

i.	Ensure that CLtnetCtl is checked.
j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD controls appears in the controls toolbar.)

k.	Click the LEAD Internet Control icon on the toolbar and position it.

l.	Double-click the new LEAD Internet Control to edit its properties.

m.	Change the ID to IDC_LEADNet1.

For C++ 5.0:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the server resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_SERVER_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Project > Add To Project > Components and controls.

g.	Select Registered ActiveX controls.

h.	Double-click the LEAD Internet Control (14) icon. (The Confirm Classes dialog box appears.)

i.	Ensure that CLtnetCtl is checked.

j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD Controls appears in the controls toolbar.)

k.	Click the LEAD Internet Control icon and position the control on the main window.

l.	Use the right mouse button to edit the properties of the new LEAD Internet Control.

m.	Change the ID to IDC_LEADNet1.

9.	Add a command button to the main window and set the ID and Caption properties as follows:

ID	Caption
IDC_SERVERINIT	Init Server
10	Do the following to add m_LEADNet1 to the CServerDlg class and link the variable to the control using dynamic data exchange:

a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)

b.	Click the Member Variables tab.

c.	In the Class Name box, select CServerDlg.

d.	In the Control IDs list, select IDC_LEADNet1.

e.	Click the Add Variable... button.

f.	Specify m_LEADNet1 as the variable name, and control as the category.

g.	Click OK to close the dialog box and click OK to close the MFC ClassWizard.

11.	Define a global variable in the ServerDlg.cpp file as follows:

short hServer;

12.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CServerDlg.

c.	In the Object IDs list box, select IDC_SERVERINIT.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnServerInit).

f.	Click the Edit Code button and code the OnServerInit procedure as follows:

int nRet;
CString cs;
m_LEADNet1.SetEnableMethodErrors(0);
/* initialize server on port 1000 */
nRet = m_LEADNet1.InetServerInit(&hServer, 1000);
if (nRet != 0)
{
cs.Format("%s %d\n","Error initializing server:", nRet);
AfxMessageBox(cs);
}

13.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CServerDlg.

c.	In the Object IDs list box, select IDC_LEADNet1.

d.	In the Messages list box, select InetAccept.

e.	Click the Add function button. Choose OK for the default function name (On InetAcceptLeadnet1).

f.	Click the Edit Code button and code the OnInetAcceptLeadnet1 procedure as follows:

short hComputer;
int nRet;
BSTR hName;
CString cs;
nRet = m_LEADNet1.InetAcceptConnect(hServer, &hComputer);
if (nRet != 0)
{
cs.Format("%s %d\n","Error accepting connection:", nRet);
AfxMessageBox(cs);
}
m_LEADNet1.InetGetHostName(hComputer, HOST_NAME_DESCRP, &hName);
/* add to our send list */
m_LEADNet1.SetSendList(m_LEADNet1.GetSendListNum(), hComputer);
AfxMessageBox("Connection accepted.");

14.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CServerDlg.

c.	In the Object IDs list box, select IDCANCEL.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnCancel).

f.	Click the Edit Code button and code the OnCancel procedure as follows:

int i, num;
/* disconnect all connections */
num = m_LEADNet1.GetConnectListNum();
for (i = 0; i < num; i++)
{
m_LEADNet1.InetDisconnect(m_LEADNet1.GetConnectList(i));
}
CDialog::OnCancel();

15.	On the main menu, select Build> Build server.exe to build the project.

16.	On the main menu, select Build> Execute server.exe to run the project.


Connecting to a Remote Computer (Visual C++ 4.0 and later)

Take the following steps to start a project and to add some code that will let you connect to a remote computer that is acting as a server.

1.	Run the server executable you created in Initializing a Computer as a Server and Accepting Connections.

2.	Start a new project as follows:

For C++ 4.x, run Microsoft Developer Studio for Visual C++, select the File >New menu option, select Project Workspace, and click the OK button. In the New Project Workspace dialog box, do the following:

a.	In the Type list box, select MFC AppWizard (exe).

b.	In the Name text box, specify remote.

c.	In the Location text box, specify the path of the project.

d.	In the Platforms list box, check Win32.

e.	Click the Create button.

For C++ 5.0, run Microsoft Visual C++ 5.0, select the File >New menu option, and do the following:

a.	Click the Projects tab.

b.	Select MFC AppWizard (exe) as the project type

c.	In the Project name text box, specify remote.

d.	In the Location text box, specify the path of the project.

e.	Click the OK button.

3.	In the Step 1 dialog box, do the following:

a.	Select Dialog based.

b.	Click the Next button.

4.	In the Step 2 of 4 dialog box, do the following:

a.	Ensure that About Box is selected.

b.	Ensure that 3D controls is selected.

c.	Select OLE controls (ActiveX controls in 5.0).

d.	Click the Next button.

5.	In the Step 3 of 4 dialog box, do the following:

a.	For comments, ensure that Yes, Please is selected.

b.	For how to use the MFC library, select As a shared DLL.

c.	Click the Next button.

6.	In the Step 4 of 4 dialog box, just click Finish.

7.	Read New Project Information, and click OK. (The AppWizard creates the project files and opens the project.)

8.	Add the L_OCX40.H, L_OcxErr.H, and Ltnetocx.h files, to your project as follows:

a.	Copy the L_ocx40.h, l_ocxerr.h, and Ltnetocx.h files to your project directory, from the \lead\include\ directory.

b.	In the Project Workspace, click the FileView tab.

c.	Double-click the remote files folder to open it.

d.	Double-click the Dependencies folder (the Header Files folder in 5.0) to open it.

e.	Double-click the StdAfx.h file to edit it.

f.	Add the following lines to the end of the file:

#include "L_OCX40.H"
#include "Ltnetocx.h"

9.	Add a LEAD Internet control to the main window as follows:

For C++ 4.x:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the remote resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_REMOTE_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Insert > Component. (The Component Gallery appears.)

g.	Click the OLE controls tab.

h.	Double-click the LEAD Internet Control (14) icon. (The Confirm Classes dialog box appears.)

i.	Ensure that CLtnetCtl is checked.

j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD controls appears in the controls toolbar.)

k.	 Click the LEAD Internet Control icon on the toolbar and position it.

l.	Double-click the new LEAD Internet Control to edit its properties.

m.	Change the ID to IDC_LEADNet1.

For C++ 5.0:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the remote resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_REMOTE_DIALOG to design the dialog box.

e.	Select the TODO... text control; then press the Delete key to delete it.

f.	From the main menu, select Project > Add To Project > Components and controls.

g.	Select Registered ActiveX controls.

h.	Double-click the LEAD Internet Control (14) icon. (The Confirm Classes dialog box appears.)

i.	Ensure that CLtnetCtl is checked.

j.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD Controls appears in the controls toolbar.)

k.	Click the LEAD Internet Control icon; then size and position the control as you want it to appear at run time.

l.	Use the right mouse button to edit the properties of the new LEAD Internet Control.

m.	Change the ID to IDC_LEADNet1.

10.	Add an Edit box control to the main window and give it the following ID:

ID
IDC_Remote

11.	Do the following to add m_LEADNet1 and m_Remote to the CRemoteDlg class and link the variable to the LEAD Internet Control using dynamic data exchange:

a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)

b.	Click the Member Variables tab.

c.	In the Class Name box, select CRemoteDlg.

d.	In the Control IDs list, select IDC_LEADNet1.

e.	Click the Add Variable... button.

f.	Specify m_LEADNet1 as the variable name, and control as the category.

g.	Click OK to close the dialog box.

h.	Back in MFC Wizard, go to the Member Variables tab, and ensure CRemoteDlg is in the Class Name box.

i.	In the Control IDs list, select IDC_Remote.

j.	Click the Add Variable... button.

k.	Specify m_Remote as the variable name, and control as the category.

l.	Click OK to close the dialog box, and click OK to close the MFC ClassWizard.

12.	Add two command buttons to the main window and set the ID and Caption properties as follows:

ID	Caption
IDC_CONNECT	Connect To Remote
IDC_DISCONNECT	Disconnect From Remote
13	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CRemoteDlg.

c.	In the Object IDs list box, select IDC_CONNECT.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnConnect).

f.	Click the Edit Code button and code the OnConnect procedure as follows:

int nRet;
CString cs,text;

m_LEADNet1.SetEnableMethodErrors(0);
/* get the name of the computer entered in the edit box control */
m_Remote.GetWindowText(text);
/* Connect to remote computer on port 1000 */
nRet = m_LEADNet1.InetConnect(text, 1000);
if (nRet != 0)
{
cs.Format(" %s\n %s\n", "Error connecting to :", text);
AfxMessageBox(cs);
}

14	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CRemoteDlg.

c.	In the Object IDs list box, select IDC_DISCONNECT.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnDisconnect).

f.	Click the Edit Code button and code the OnDisconnect procedure as follows:

int nRet;

CString cs;

/* We are assuming only one connection in this example.
   Therefore, the handle to the remote computer will be
   in the first position in the SendList.
*/

nRet = m_LEADNet1.InetDisconnect(m_LEADNet1.GetSendList(0));
if (nRet != 0)
{
cs.Format("%s %d\n", "Error disconnecting from the server:",nRet);
AfxMessageBox(cs);
}

15	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CRemoteDlg.

c.	In the Object IDs list box, select IDC_LEADNet1.

d.	In the Messages list box, select InetConnected.

e.	Click the Add function button. Choose OK for the default function name (OnInetConnectedLeadnet1).

f.	Click the Edit Code button and code the InetConnectedLeadnet1 procedure as follows:

BSTR sRemote;
/* Get the name of the remote host */
m_LEADNet1.InetGetHostName(iComputer, HOST_NAME_DESCRP, &sRemote);
/* Add this connection to our SendList. */
m_LEADNet1.SetSendList(m_LEADNet1.GetSendListNum(), iComputer);
AfxMessageBox("Successfully connected to server.");

16	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CRemoteDlg.

c.	In the Object IDs list box, select IDC_LEADNet1.

d.	In the Messages list box, select InetDisconnected.

e.	Click the Add function button. Choose OK for the default function name (OnInetDisconnectedLeadnet1).

f.	Click the Edit Code button and code the InetDisconnectedLeadnet1 procedure as follows:

AfxMessageBox("Disconnected from remote computer.");

17	On the main menu, select Build> Build remote.exe to build the project.

18	On the main menu, select Build> Execute remote.exe to run the project.

19Save the object to use as a starting point for other tasks in the tutorials.


Sending Images to a Remote Computer (Visual C++ 4.0 and later)

Take the following steps to add some code that will let you send images to a remote computer.

1. 	Start with the project you created in Initializing a Computer as a Server and Accepting Connections.

2.	Add the Ltcapocx.h file, to your project as follows:

a.	Copy the Ltcapocx.h file to your project directory, from the \lead\include\ directory.

b.	In the Project Workspace, click the FileView tab.

c.	Double-click the server files folder to open it.

d.	Double-click the Dependencies folder (the Header Files folder in 5.0) to open it.

e.	Double-click the StdAfx.h file to edit it.

f.	Add the following line to the end of the file:

#include "Ltcapocx.h"

3.	Add the LEAD Capture Control to your main window as follows:

For C++ 4.0:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the server resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_SERVER_DIALOG to design the dialog box.

e.	From the main menu, select Insert > Component. (The Component Gallery appears.)

f.	Click the OLE controls tab.

g.	Double-click the LEAD Capture Control (14) icon. (The Confirm Classes dialog box appears.)

h.	Ensure that CLtCapCtl and CPicture are checked.

i.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD Controls appears in the controls toolbar.)

j.	Click the LEAD Capture Control icon on the toolbar; size and position it as you want it to appear at run time.

k.	Double-click the new LEAD Capture Control to edit its properties.

l.	Change the ID to IDC_LEADCap1.

For C++ 5.0:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the server resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_SERVER_DIALOG to design the dialog box.

e.	From the main menu, select Project > Add To Project > Components and controls.

f.	Select Registered ActiveX controls.

g.	Double-click the LEAD Capture Control (14) icon. (The Confirm Classes dialog box appears.)

h.	Ensure that CLtCapCtl and CPicture are checked.

i.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD Controls appears in the controls toolbar.)

j.	Click the LEAD Capture Control icon; then size and position the control as you want it to appear at run time.

k.	Use the right mouse button to edit the properties of the new LEAD Capture Control.
l.	Change the ID to IDC_LEADCap1.

4.	Add a command button to the main window and set the ID and Caption properties as follows:

ID	Caption
IDC_SEND	Send Bitmaps
5.	Do the following to add m_LEADCap1 to the CServerDlg class and link the variable to the LEAD Capture Control using dynamic data exchange:

a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)

b.	Click the Member Variables tab.

c.	In the Class Name box, select CServerDlg.

d.	In the Control IDs list, select IDC_LEADCap1.

e.	Click the Add Variable... button.

f.	Specify m_LEADCap1 as the variable name, and control as the category.

g.	Click OK to close the dialog box and click OK to close the MFC ClassWizard.

6.	Define a global variable in the ServerDlg.cpp file as follows:

BOOL	bSendImages;
7.	Add the following code to OnInitDialog procedure in the ServerDlg.cpp file, following the code that unlocks Internet features support:

int nRet;
CString cs;

bSendImages = FALSE;
m_LEADCap1.SetEnableMethodErrors(0);

/* connect to the default driver */
nRet = m_LEADCap1.CapConnect (0);
if (nRet != 0)
{
cs.Format("%s %d\n", "Error connecting to capture device:", nRet);
AfxMessageBox(cs);
}
else
{
/* Setting the display mode to preview will allow us to get
   a callback for each frame that is displayed */
m_LEADCap1.SetCapDisplayMode (DISPLAY_PREVIEW);
m_LEADCap1.SetEnableCaptureEvents (1);
}

8.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CServerDlg.

c.	In the Object IDs list box, select IDC_SEND.

d.	In the Messages list box, select BN_CLICKED.

e.	Click the Add function button. Choose OK for the default function name (OnSend).

f.	Click the Edit Code button and code the OnSend procedure as follows:

bSendImages = !bSendImages;

9.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CServerDlg.

c.	In the Object IDs list box, select IDC_LEADCap1.

d.	In the Messages list box, select CapVideoData.

e.	Click the Add function button. Choose OK for the default function name (On CapVideoDataLeadcap1).

f.	Click the Edit Code button and code the OnCapVideoDataLeadcap1 procedure as follows:

MSG msg;
if (bSendImages)
{
/* Send the images to the remote computer */
m_LEADNet1.InetSendDIB(hDib, FILE_CMP, 24, 75);
}
/* Are there any messages in the queue? */
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
/* Translates virtual key codes */
TranslateMessage(&msg);

/* Dispatches message to window */
DispatchMessage(&msg);
}

10.	On the main menu, select Build> Build server.exe to build the project.

11.	On the main menu, select Build> Execute server.exe to run the project.

12.	The exe generated from this project will be used as a server for other tasks in the tutorial.


Receiving and Displaying Images from a Remote Computer (Visual C++ 4.0 later)
Receiving and Displaying Images from a Remote Computer (Visual C++ 4.0 and later)

Take the following steps to add some code that will let you receive and display images received from a computer acting as a server.

1.	Run the exe you created in Sending Images to a Remote Computer.

2.	Start Visual C++.

3.	Start with the project you created in Connecting to a Remote Computer.

4. 	Add the LEAD control to your main window as follows:

For C++ 4.0:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the remote resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_REMOTE_DIALOG to design the dialog box.

e.	From the main menu, select Insert > Component. (The Component Gallery appears.)

f.	Click the OLE controls tab.

g.	Double-click the LEAD Main Control (14) icon. (The Confirm Classes dialog box appears.)

h.	Ensure that COleFont, CPicture, CLead are checked.

i.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD controls appears in the controls toolbar.)

j.	 Click the LEAD Control icon on the toolbar; size and position it as you want it to appear at run time.

k.	Double-click the new LEAD control to edit its properties.

l.	Change the ID to IDC_LEAD1 and set the BackErase property to False.

For C++ 5.0:

a.	In the Project Workspace, click the ResourceView tab.

b.	Double-click the remote resources folder to open it.

c.	Double-click the Dialog folder to open it.

d.	Double-click IDD_REMOTE_DIALOG to design the dialog box.

e.	From the main menu, select Project > Add To Project > Components and controls.

f.	Select Registered ActiveX controls.

g.	Double-click the LEAD Main Control (14) icon. (The Confirm Classes dialog box appears.)

h.	Ensure that COleFont, CPicture, CLead are checked.

i.	Click OK to complete the selection; then click Close to close the Component Gallery. (The LEAD controls appears in the controls toolbar.)

j.	Click the LEAD Control icon; then size and position the control as you want it to appear at run time.

k.	Use the right mouse button to edit the properties of the new LEAD Control.

l.	Change the ID to IDC_LEAD1 and set the BackErase property to False.

5.	Do the following to add m_LEAD1 to the CRemoteDlg class and link the variable to the LEAD control using dynamic data exchange:

a.	Press Ctrl-W. (The MFC ClassWizard dialog box appears.)

b.	Click the Member Variables tab.

c.	In the Class Name box, select CRemoteDlg.

d.	In the Control IDs list, select IDC_LEAD1.

e.	Click the Add Variable... button.

f.	Specify m_LEAD1 as the variable name, and control as the category.

g.	Click OK to close the dialog box and click OK to close the MFC ClassWizard.

6.	Press Ctrl-W to go to the MFC Class Wizard; then do the following:

a.	Click the Message Maps tab.

b.	In the Class Name combo box, select CRemoteDlg.

c.	In the Object IDs list box, select IDC_LEADNet1.

d.	In the Messages list box, select InetReceiveBitmap.

e.	Click the Add function button. Choose OK for the default function name (On InetReceiveBitmapLeadnet1).

f.	Click the Edit Code button and code the OnInetReceiveBitmapLeadnet1 procedure as follows:

MSG msg;
/* Assign bitmap to LEAD Main control */
m_LEAD1.SetBitmap(hBitmap);
/* Are there any messages in the queue? */
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
/* Translate virtual key codes */
TranslateMessage(&msg);
/* Dispatches message to window. */
DispatchMessage(&msg);
}

7.	On the main menu, select Build> Build remote.exe to build the project.

8.	On the main menu, select Build> Execute remote.exe to run the project.


Miscellaneous Examples (Visual C++ 4.0 and later)

You can test the following examples by either adding a command button to one of the previous lessons in the tutorial and pasting the sample code in the Click procedure, or by cutting and pasting event code into the appropriate event in a lesson.

AutoResizeControl Example for C++ 4.0 and later

EnableMethodErrors Example for C++ 4.0 and later

InetAccept Example for C++ 4.0 and later

InetClearQueue Example for C++ 4.0 and later

InetConnect Example for C++ 4.0 and later

InetConnected Example for C++ 4.0 and later

InetDataSent Example for C++ 4.0 and later

InetDisconnect Example for C++ 4.0 and later

InetDisconnected Example for C++ 4.0 and later

InetError Example for C++ 4.0 and later

InetReceiveBitmap Example for C++ 4.0 and later

InetReceiveCmd Example for C++ 4.0 and later

InetReceiveData Example for C++ 4.0 and later

InetReceiveRsp Example for C++ 4.0 and later

InetReceiveSound Example for C++ 4.0 and later

InetReceiveStart Example for C++ 4.0 and later

InetReceiving Example for C++ 4.0 and later

InetSendAttachBitmapCmd Example for C++ 4.0 and later

InetSendBitmap Example for C++ 4.0 and later

InetSendCloseWinCmd Example for C++ 4.0 and later

InetSendCloseWinRsp Example for C++ 4.0 and later

InetSendCmd Example for C++ 4.0 and later

InetSendCreateWinCmd Example for C++ 4.0 and later

InetSendData Example for C++ 4.0 and later

InetSendDIB Example for C++ 4.0 and later

InetSendFreeBitmaCmd Example for C++ 4.0 and later

netSendFreeBitmapRsp Example for C++ 4.0 and later

InetSendGetMagGlassDataCmd Example for C++ 4.0 and later

InetSendGetMagGlassDataRsp Example for C++ 4.0 and later

InetSending Example for C++ 4.0 and later

InetSendLoadCmd Example for C++ 4.0 and later

InetSendSaveCmd Example for C++ 4.0 and later

InetSendSetRectCmd Example for C++ 4.0 and later

InetSendSetRectRsp Example for C++ 4.0 and later

InetSendShowWinCmd Example for C++ 4.0 and later

InetSendShowWinRsp Example for C++ 4.0 and later

InetSendSizeWinCmd Example for C++ 4.0 and later

InetSendSizeWinRsp Example for C++ 4.0 and later

InetSendSound Example for C++ 4.0 and later

InetServerClose Example for C++ 4.0 and later

InetServerInit Example for C++ 4.0 and later


AutoResizeControl Example for C++ 4.0 and later

This is also the example for the ControlMode property.

// enable autosize, and set the mode to read-only
   m_LEADVid1.SetAutoResizeControl (TRUE);
   m_LEADVid1.SetControlMode(MODE_PLAYBACK);
   m_LEADVid1.MMLoad ("d:\\temp\\leopard.avi");


EnableMethodErrors Example for C++ 4.0 and later

m_LEADNet1.SetEnableMethodErrors(FALSE);


InetAccept Example for C++ 4.0 and later

void CNet::InetAccept(short iServer)
{
short iComputer;

    	m_LEADNet1.InetAcceptConnect(iServer, &iComputer);
    	// add connection to send list
    	m_LEADNet1.SetSendList(m_LEADNet1.GetSendListNum(), iComputer);
}


InetClearQueue Example for C++ 4.0
InetClearQueue Example for C++ 4.0 and later

This is also the example for the InetQueueSize property.

void CNetCapDlg::TestQueue()
{
   char szText[80];
   int  i, nComputer;
   long nSize, nTotal=0;

   for (i = 0; i < m_LEADNet1.GetSendListNum(); i++)
   {
      nComputer = m_LEADNet1.GetSendList(i);
      nSize     = m_LEADNet1.GetInetQueueSize(nComputer);

      if (nSize > 0)
      {
         nTotal += m_LEADNet1.GetInetQueueSize(nComputer);

         if (nSize > QUEUE_MAX)
         {
            m_LEADNet1.InetClearQueue(nComputer);
         }
      }
   }

   sprintf(szText, "%ld", nTotal);
   DisplayMessage(0, szText);
}


InetConnect Example for C++ 4.0 and later

void CNet::Method ()
{
    	int    nResult;
char szText[80];

    	m_LEADNet1.SetEnableMethodErrors(FALSE);

// connect to computer 127.0.0.1
    	nResult = m_LEADNet1.InetConnect("127.0.0.1", 1000);
    	If (nResult != 0)
    	{
wsprintf(szText, "Error: %d trying to connect", nResult);
MessageBox(szText);
}
}


InetConnected Example for C++ 4.0 and later

This is also the example for the InetGetHostName method.

void CNet::InetConnected(short iComputer)
{
char szText[80], szHostName[80];

BSTR    bstrText;

   	CString strText;

// and to sendlist
    	m_LEADNet1.SetSendList(m_LEADNet1.GetSendListNum(), iComputer);

// get host name
m_LEADNet1.InetGetHostName(iComputer, HOST_NAME_IP, &bstrText);

strText = bstrText;

      	strcpy(szHostName, (LPCTSTR)strText);

      	::SysFreeString(bstrText);

wsprintf(szText, "Computer %d connected with ", iComputer, szHostName);
MessageBox(szText);
}


InetDataSent Example for C++ 4.0 and later

void CNet::InetDataSent(short iComputer, long lSize)
{
char szText[80];

    	// Display amount
wsprintf(szText, "Data sent: %ld bytes.", lSize);
MessageBox(szText);
}


InetDisconnect Example for C++ 4.0 and later

This is also the example for the ConnectList property and ConnectListNum property.

void CNet::Method()
{
    	int i;

    	// disconnect all connections
    	for i = 0, i < m_LEADNet1.GetConnectListNum(); i++)
    	{
        	m_LEADNet1.InetDisconnect(m_LEADNet1.GetConnectList(i));
    	}
}


InetDisconnected Example for C++ 4.0 and later

void CNet::InetDisconnected(short iComputer)
{
char szText[80];

wsprintf(szText, "Computer %d disconnected", iComputer);
MessageBox(szText);
}


InetError Example for C++ 4.0 and later

void CNet::InetError(short iComputer, short iMessage, short iError)
{
char szText[80];

wsprintf(szText, "Computer %d had Error: %d (%d)", iComputer, iError, iMessage);
MessageBox(szText);
}


InetReceiveBitmap Example for C++ 4.0 and later

void CNet::InetReceiveBitmap(short iComputer, long hBitmap)
{
    	// assign bitmap to main lead control
    	m_Lead.SetBitmap(hBitmap);
}


InetReceiveCmd Example for C++ 4.0 and later

// my user defined commands
#define INETCMD_FLIP INETCMD_USER_CUSTOM

void CNETCMDDlg::OnInetReceiveCmdLeadnetctrl1(short iComputer, short InetCommand, long nCommandID, short nError, LPDISPATCH Params, long nExtraDataSize, const VARIANT FAR& ExtraData)
{
   short nStatus;
   CString szOut;
   CString szTmp;
   CLTInetPacket Packet(Params);
   short nRet;

   nStatus = ERROR_FEATURE_NOT_SUPPORTED;

   szOut.Format("Command %d id=%d, nError=%d nParams=%d received",
                 InetCommand, nCommandID, nError, Packet.GetParamCount());

   if(nExtraDataSize > 0)
   {
      szTmp.Format(", nExtraDataSize=%d", nExtraDataSize);
      szOut = szOut + szTmp;
   }
   OutputDebugString(szOut);
   OutputDebugString("\n");

   if(nError != 0)
      nStatus = ERROR_TRANSFER_ABORTED;
   else
   {
      switch(InetCommand)
      {
      case INETCMD_LOAD:
         // check the validity of the parameters
         if((Packet.GetParamCount() == 4) && (Packet.GetParamType(0) == PARAM_TYPE_STRING) &&
            (Packet.GetParamType(1) == PARAM_TYPE_INT32) && (Packet.GetParamType(2) == PARAM_TYPE_INT32) &&
            (Packet.GetParamType(3) == PARAM_TYPE_UINT32))
         {
            //NOTE: this is a function you must create
            nStatus = ProcessLoadCommand(Packet.GetParamValue(0).bstrVal, (short)Packet.GetParamValue(1).lVal);
//            gBitmaps(gnBitmapID).Tag = gnBitmapID
//          else
//            m_nBitmapID = gnBitmapID - 1
            if(nStatus == 0)
            {
               szOut.Format("Received LoadBitmapCmd - Loaded Bitmap %d ID=%d",
                             Packet.GetParamValue(0), m_nBitmapID);

               StatusUpdate(szOut);
            }
            else
               nStatus = ERROR_INV_PARAMETER; // invalid parameters

            m_LEADNet1.InetSendLoadRsp(nCommandID, m_nBitmapID, 0, NULL, nStatus);
            return;
         }
         break;

      case INETCMD_CREATE_WIN:
         // check the validity of the parameters
         if((Packet.GetParamCount() == 8) && (Packet.GetParamType(0) == PARAM_TYPE_STRING) &&
            (Packet.GetParamType(1) == PARAM_TYPE_STRING) && (Packet.GetParamType(2) == PARAM_TYPE_UINT32) &&
            (Packet.GetParamType(3) == PARAM_TYPE_INT32) && (Packet.GetParamType(4) == PARAM_TYPE_INT32) &&
            (Packet.GetParamType(5) == PARAM_TYPE_INT32) && (Packet.GetParamType(6) == PARAM_TYPE_INT32) &&
            (Packet.GetParamType(7) == PARAM_TYPE_UINT32))

         {
            long nWindowID;
            //NOTE: this is a function you must create
            nWindowID = ProcessCreateWinCommand(Packet.GetParamValue(1).bstrVal,
                                              Packet.GetParamValue(3).lVal,
                                              Packet.GetParamValue(4).lVal,
                                              Packet.GetParamValue(5).lVal,
                                              Packet.GetParamValue(6).lVal);

            nRet = m_LEADNet1.InetSendCreateWinRsp(nCommandID, nWindowID, 0, NULL, 0);
            return;
         }
         break;

      case INETCMD_ATTACH_BITMAP:
         if((Packet.GetParamCount() == 2) && (Packet.GetParamType(0) == PARAM_TYPE_UINT32) &&
            (Packet.GetParamType(1) == PARAM_TYPE_UINT32))
         {
            //NOTE: this is a function you must create
            nStatus = ProcessAttachBitmapCommand(Packet.GetParamValue(0).ulVal,
                                                 Packet.GetParamValue(1).ulVal);
            nRet = m_LEADNet1.InetSendAttachBitmapRsp(nCommandID, 0, NULL, nStatus);
            return;
         }
         break;

      case INETCMD_SAVE:
         if((Packet.GetParamCount() == 6) && (Packet.GetParamType(0) == PARAM_TYPE_STRING) &&
            (Packet.GetParamType(1) == PARAM_TYPE_UINT32) && (Packet.GetParamType(2) == PARAM_TYPE_INT32) &&
            (Packet.GetParamType(3) == PARAM_TYPE_INT32) && (Packet.GetParamType(4) == PARAM_TYPE_INT32) &&
            (Packet.GetParamType(5) == PARAM_TYPE_UINT32))

         {
            //NOTE: this is a function you must create
            nStatus = ProcessSaveCommand(Packet.GetParamValue(0).bstrVal,
                                         Packet.GetParamValue(1).ulVal,
                                         Packet.GetParamValue(2).lVal,
                                         Packet.GetParamValue(3).lVal,
                                         Packet.GetParamValue(4).lVal,
                                         Packet.GetParamValue(5).ulVal);

            nRet = m_LEADNet1.InetSendSaveRsp(nCommandID, 0, NULL, nStatus);
            return;
         }
         else
            nStatus = ERROR_INV_PARAMETER;
         break;

      case INETCMD_FLIP:
         if((Packet.GetParamCount() == 1) && (Packet.GetParamType(0) == PARAM_TYPE_UINT32))
            //NOTE: this is a function you must create
            nStatus = ProcessFlipCommand(Packet.GetParamValue(0).ulVal);
         else
            nStatus = ERROR_INV_PARAMETER;
         break;

      case INETCMD_GET:
         if((Packet.GetParamCount() == 1) && (Packet.GetParamType(0) == PARAM_TYPE_UINT32))
            //NOTE: this is a function you must create
            nStatus = ProcessGetCommand(Packet.GetParamValue(0).ulVal);
         else
            nStatus = ERROR_INV_PARAMETER;
         break;
      }
   }
   //return an error response
   m_LEADNet1.InetSendRsp(InetCommand, nCommandID, NULL, 0, NULL, nStatus);
}


InetReceiveRsp Example for C++ 4.0 and later

void CNETCMDDlg::OnInetReceiveRspLeadnetctrl1(short iComputer, short InetCommand, long nCommandID, short nError, short nStatus, LPDISPATCH Params, long nExtraDataSize, const VARIANT FAR& ExtraData)
{
   CString szOut;
   CString szTmp;
   CLTInetPacket Packet(Params);

   szOut.Format("Command %d id=%d, nError=%d nStatus=%d, nParams=%d received",
                 InetCommand, nCommandID, nError, nStatus, Packet.GetParamCount());

   if(nExtraDataSize > 0)
   {
      szTmp.Format(", nExtraDataSize=%d", nExtraDataSize);
      szOut = szOut + szTmp;
   }
   OutputDebugString(szOut);
   OutputDebugString("\n");

   if(nError != 0)
      return;

   switch(InetCommand)
   {
   case INETCMD_LOAD:
      if((nStatus == 0) || (nStatus == 1))
      {
         if((Packet.GetParamCount() == 1) && (Packet.GetParamType(0) == PARAM_TYPE_UINT32))
         {
            OutputDebugString("Load SUCCEEDED!");
         }
         else
         {
            szOut.Format("Load failed with error code %d", nStatus);
            OutputDebugString(szOut);
         }
      }
      break;
   }
}


InetReceiveData Example for C++ 4.0 and later

void CNet::InetReceiveData(short iComputer, VARIANT FAR &pData, long lSize,
 short iType)
{
   	char szText[80];

    	// convert to a string
wsprintf(szText, "Received %ld bytes from %d computer", lSize, iComputer);
MessageBox(szText);
}


InetReceiveSound Example for C++ 4.0 and later

int	m_nSoundFlag;
long	m_hSound;
CLEADCap	m_LEADCap1;	// Lead capture control class

void CNet::InetReceiveSound(short iComputer,
   short iFormatTag,
   short nChannels,
   long lSamplesPerSec,
   long lAvgBytesPerSec,
   short iBlockAlign,
   short iBitsPerSample,
   short iExtraDataSize,
   long lDataSize)
{
// this example uses the LEAD Capture Module for sound playback

if (m_nSoundFlag == FALSE)
{
      	m_LEADCap1.SetCapWaveFormatTag (CAP_AUDIO_FEED, iFormatTag);
      	m_LEADCap1.SetCapWaveChannels (CAP_AUDIO_FEED, nChannels);
     	m_LEADCap1.SetCapWaveSamplesPerSec (CAP_AUDIO_FEED, lSamplesPerSec);
      	m_LEADCap1.SetCapWaveAvgBytesPerSec (CAP_AUDIO_FEED, lAvgBytesPerSec);
      	m_LEADCap1.SetCapWaveBlockAlign (CAP_AUDIO_FEED, iBlockAlign);
      	m_LEADCap1.SetCapWaveBitsPerSample (CAP_AUDIO_FEED, iBitsPerSample);
      	m_LEADCap1.SetCapWaveExtraSize (CAP_AUDIO_FEED, iExtraDataSize);
m_LEADCap1.SetCapWaveExtraData (CAP_AUDIO_FEED, pExtraData);

 	m_LEADCap1.CapStartFeedSound ("", -1, 0, CAP_FEED_PLAYDATA,
&m_hSound);

      	m_nSoundFlag = TRUE;
}
else
{
 	m_LEADCap1.CapFeedSound (m_hSound, (VARIANT *)&pData, lDataSize);
}

// when finished playing sound m_LEADCap1.CapStopFeedSound should be
// called. A good place to do it would be in the InetDisconnected event
}


InetReceiveStart Example for C++ 4.0 and later

void CNet::InetReceiveStart(short iComputer, long lSize)
{
   	char szText[80];

    	// Display amount expected
wsprintf(szText, "Will receive: %ld bytes.", lSize);
MessageBox(szText);
}


InetReceiving Example for C++ 4.0 and later

void CNet::InetReceiving(short iComputer, long lSize)
{
   	char szText[80];

    	// Display amount expected
wsprintf(szText, "Receiving: %ld bytes.", lSize);
MessageBox(szText);
}


InetSendAttachBitmapCmd  Example for C++ 4.0 and later

short nRet;
   CString csOut;

   nRet = m_LEADNet1.InetSendAttachBitmapCmd(999, 1, 1);
   if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
   {
      csOut.Format("ERROR %d calling InetSendAttachBitmapCmd.", nRet);
      AfxMessageBox(csOut);
   }
   else
      AfxMessageBox("InetSendAttachBitmapCmd Executed.");


InetSendBitmap Example for C++ 4.0 and later

void CNet::Method()
{
    	// send bitmap to everybody in SendList property
    	m_LEADNet1.InetSendBitmap(m_Lead.GetBitmap(), FILE_CMP, 24, 255);
}


InetSendCloseWinCmd Example for C++ 4.0 and later

short nRet;
   CString csOut;

   nRet = m_LEADNet1.InetSendCloseWinCmd(999, 1);
   if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
   {
      csOut.Format("ERROR %d calling InetSendCloseWinCmd.", nRet);
      AfxMessageBox(csOut);
   }
   else
      AfxMessageBox("InetSendCloseWinCmd Executed.");


InetSendCloseWinRsp Example for C++ 4.0 and later

void CNETCMDDlg::OnInetReceiveCmdLeadnetctrl1(short iComputer, short InetCommand, long nCommandID, short nError, LPDISPATCH Params, long nExtraDataSize, const VARIANT FAR& ExtraData)
{
   short nStatus;
   CString szOut;
   CString szTmp;
   CLTInetPacket Packet(Params);
   short nRet;

   nStatus = ERROR_FEATURE_NOT_SUPPORTED;

   szOut.Format("Command %d id=%d, nError=%d nParams=%d received",
                 InetCommand, nCommandID, nError, Packet.GetParamCount());

   if(nExtraDataSize > 0)
   {
      szTmp.Format(", nExtraDataSize=%d", nExtraDataSize);
      szOut = szOut + szTmp;
   }
   OutputDebugString(szOut);
   OutputDebugString("\n");

   if(nError != 0)
      nStatus = ERROR_TRANSFER_ABORTED;
   else
   {
      switch(InetCommand)
      {
      case INETCMD_CLOSE_WIN:
         // check the validity of the parameters
         if((Packet.GetParamCount() == 1) &&

            (Packet.GetParamType(0) == PARAM_TYPE_UINT32))
         {
            //Note this is a function you must create
            nStatus = ProcessCloseWinCommand(Packet.GetParamValue(0).ulVal);
            nRet = m_LEADNet1.InetSendCloseWinRsp(nCommandID, 0, NULL, nStatus);
            return;
         }
         break;
      }
   }
   //return an error response
   m_LEADNet1.InetSendRsp(InetCommand, nCommandID, NULL, 0, NULL, nStatus);
}


InetSendCmd Example for C++ 4.0 and later

// my user defined commands
#define INETCMD_FLIP INETCMD_USER_CUSTOM

   short nRet;
   CString csOut;
   CLTInetPacket Packet;
   char szText[]="This is Flip";
   VARIANT var;
   SAFEARRAY FAR *psa;
   SAFEARRAYBOUND rgsabound[1];
   VARIANT vaVal;
   HRESULT hr;
   IDispatch *pDisp=NULL;

   m_nCommandID++;

   hr = CoCreateInstance(CLSID_LTInetPacket, NULL, CLSCTX_ALL, IID_IDispatch, (void**)&pDisp);
   Packet.AttachDispatch(pDisp);

   Packet.SetParamCount(1);
   VariantInit(&vaVal);
   V_VT(&vaVal) = (VT_UI4);
   V_UI4(&vaVal) = m_nLastBitmapID;
   Packet.SetParamValue(0, vaVal);
   Packet.SetParamType(0, PARAM_TYPE_UINT32);

   VariantInit(&var);
   rgsabound[0].lLbound = 0;
   rgsabound[0].cElements = lstrlen(szText) + 1;

   psa = SafeArrayCreate(VT_UI1, 1, rgsabound);
   if (psa != NULL)
   {
      SafeArrayLock(psa);
      strcpy((char far *)psa->pvData, szText);
      SafeArrayUnlock(psa);
      V_VT(&var) = (VT_ARRAY | VT_UI1);
      V_ARRAY(&var) = psa;

      nRet = m_LEADNet1.InetSendCmd(INETCMD_FLIP, m_nCommandID, Packet, lstrlen(szText) + 1, &var);

      if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
      {
         csOut.Format("ERROR %d calling InetSendCmd.", nRet);
         StatusUpdate(csOut);
      }
      else
         StatusUpdate("InetSendCmd Executed.");
   }


InetSendCreateWinCmd Example for C++ 4.0 and later

short nRet;
   CString csOut;

   nRet = m_LEADNet1.InetSendCreateWinCmd(999,
                                          "", "Window Created By Remote",
                                          0, 100, 50, 300, 150, 0);
   if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
   {
      csOut.Format("ERROR %d calling InetSendCreateWinCmd.", nRet);
      AfxMessageBox(csOut);
   }
   else
      AfxMessageBox("InetSendCreateWinCmd Executed.");


InetSendData Example for C++ 4.0 and later

void CNet::Method()
{
    	char                                   szText[]="This is a test";
 	VARIANT                        var;
   	SAFEARRAY FAR       *psa;
   	SAFEARRAYBOUND    rgsabound[1];

VariantInit(&var);
            	rgsabound[0].lLbound = 0;
            	rgsabound[0].cElements = strlen(szText) + 1;

            	psa = SafeArrayCreate(VT_UI1, 1, rgsabound);
            	if (psa != NULL)
            	{
               	SafeArrayLock(psa);
               	strcpy((char far *)psa->pvData, szText);
               	SafeArrayUnlock(psa);
               	V_VT(&var) = (VT_ARRAY | VT_UI1);
               	V_ARRAY(&var) = psa;
            	m_LEADNet1.InetSendData(&var, strlen(szText) + 1, IDATA_USER2);
               	SafeArrayDestroy(psa);
            }

            VariantClear(&var);
}


InetSendDIB Example for C++ 4.0 and later

void CNet::Method()
{
    	m_Lead.Load("d:\ltwin14x\images\sample4.cmp", 0, 0, 1);
    	// send dib to remote computer
    	m_LEADNet1.InetSendDIB(m_Lead.GetDIB(), FILE_CMP, 24, 255);
}


InetSendFreeBitmapCmd Example for C++ 4.0 and later

short nRet;
   CString csOut;

   nRet = m_LEADNet1.InetSendFreeBitmapCmd(999, 1);
   if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
   {
      csOut.Format("ERROR %d calling InetSendFreeBitmapCmd.", nRet);
      AfxMessageBox(csOut);
   }
   else
      AfxMessageBox("InetSendFreeBitmapCmd Executed.");


InetSendFreeBitmapRsp Example for C++ 4.0 and later

void CNETCMDDlg::OnInetReceiveCmdLeadnetctrl1(short iComputer, short
InetCommand, long nCommandID, short nError, LPDISPATCH Params, long
nExtraDataSize, const VARIANT FAR& ExtraData)
{
   short nStatus;
   CString szOut;
   CString szTmp;
   CLTInetPacket Packet(Params);
   short nRet;

   nStatus = ERROR_FEATURE_NOT_SUPPORTED;

   szOut.Format("Command %d id=%d, nError=%d nParams=%d received",
                 InetCommand, nCommandID, nError, Packet.GetParamCount());

   if(nExtraDataSize > 0)
   {
      szTmp.Format(", nExtraDataSize=%d", nExtraDataSize);
      szOut = szOut + szTmp;
   }
   OutputDebugString(szOut);
   OutputDebugString("\n");

   if(nError != 0)
      nStatus = ERROR_TRANSFER_ABORTED;
   else
   {
      switch(InetCommand)
      {
      case INETCMD_FREE_BITMAP:
         if((Packet.GetParamCount() == 1) && (Packet.GetParamType(0) ==
PARAM_TYPE_UINT32))
         {
            //Note this is a function you must create
            nStatus = ProcessFreeCommand(Packet.GetParamValue(0).ulVal);
            m_LEADNet1.InetSendFreeBitmapRsp(nCommandID, 0, NULL, nStatus);
         }
         else
            nStatus = ERROR_INV_PARAMETER;
         break;
      }
   }
   //return an error response
   m_LEADNet1.InetSendRsp(InetCommand, nCommandID, NULL, 0, NULL, nStatus);
}


InetSending Example for C++ 4.0 and later

void CNet::InetSending(short iComputer, long lSize)
{
   	char szText[80];

    	// Display amount
wsprintf(szText, "Sending: %ld bytes.", lSize);
MessageBox(szText);
}


InetSendLoadCmd Example for C++ 4.0 and later

short nRet;
   CString csOut;

   nRet = m_LEADNet1.InetSendLoadCmd(999, "v:\\images\\eagle.cmp", 0, 1);
   if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
   {
      csOut.Format("ERROR %d calling InetSendLoadCmd.", nRet);
      AfxMessageBox(csOut);
   }
   else
      AfxMessageBox("InetSendLoadCmd Executed.");


InetSendSaveCmd Example for C++ 4.0 and later

short nRet;
   CString csOut;

   nRet = m_LEADNet1.InetSendSaveCmd(999, m_nLastBitmapID,
                                     "d:\\temp\\remote.tif",
                                     FILE_TIF, 0, 0, TRUE);
   if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
   {
      csOut.Format("ERROR %d calling InetSendSaveCmd.", nRet);
      AfxMessageBox(csOut);
   }
   else
      AfxMessageBox("InetSendSaveCmd Executed.");


InetSendSetRectCmd Example for C++ 4.0 and later

short nRet;
   CString csOut;

   nRet = m_LEADNet1.InetSendSetRectCmd(999, 1, DISPLAY_RECT_DST, 0, 0, 100, 100);
   if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
   {
      csOut.Format("ERROR %d calling InetSendSetRectCmd.", nRet);
      AfxMessageBox(csOut);
   }
   else
      AfxMessageBox("InetSendSetRectCmd Executed.");


InetSendSetRectRsp Example for C++ 4.0 and later

void CNETCMDDlg::OnInetReceiveCmdLeadnetctrl1(short iComputer, short InetCommand, long nCommandID, short nError, LPDISPATCH Params, long nExtraDataSize, const VARIANT FAR& ExtraData)
{
   short nStatus;
   CString szOut;
   CString szTmp;
   CLTInetPacket Packet(Params);
   short nRet;

   nStatus = ERROR_FEATURE_NOT_SUPPORTED;

   szOut.Format("Command %d id=%d, nError=%d nParams=%d received",
                 InetCommand, nCommandID, nError, Packet.GetParamCount());

   if(nExtraDataSize > 0)
   {
      szTmp.Format(", nExtraDataSize=%d", nExtraDataSize);
      szOut = szOut + szTmp;
   }
   OutputDebugString(szOut);
   OutputDebugString("\n");

   if(nError != 0)
      nStatus = ERROR_TRANSFER_ABORTED;
   else
   {
      switch(InetCommand)
      {
      case INETCMD_SET_RECT:
         // check the validity of the parameters
         if((Packet.GetParamCount() == 6) && (Packet.GetParamType(0) == PARAM_TYPE_UINT32) &&
            (Packet.GetParamType(1) == PARAM_TYPE_INT32) &&
            (Packet.GetParamType(2) == PARAM_TYPE_INT32) &&
            (Packet.GetParamType(3) == PARAM_TYPE_INT32) &&
            (Packet.GetParamType(4) == PARAM_TYPE_INT32) &&
            (Packet.GetParamType(5) == PARAM_TYPE_INT32))
         {
            //Note this is a function you must create
            nStatus = ProcessSetRectCommand(Packet.GetParamValue(0).ulVal,
                                            Packet.GetParamValue(1).lVal,
                                            Packet.GetParamValue(2).lVal,
                                            Packet.GetParamValue(3).lVal,
                                            Packet.GetParamValue(4).lVal,
                                            Packet.GetParamValue(5).lVal);
            nRet = m_LEADNet1.InetSendSetRectRsp(nCommandID, 0, NULL, nStatus);
            return;
         }
         break;
      }
   }
   //return an error response
   m_LEADNet1.InetSendRsp(InetCommand, nCommandID, NULL, 0, NULL, nStatus);
}


InetSendShowWinCmd Example for C++ 4.0 and later

short nRet;
   CString csOut;

   nRet = m_LEADNet1.InetSendShowWinCmd(999, 1, SW_HIDE);
   if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
   {
      csOut.Format("ERROR %d calling InetSendShowWinCmd.", nRet);
      AfxMessageBox(csOut);
   }
   else
      AfxMessageBox("InetSendShowWinCmd Executed.");


InetSendShowWinRsp Example for C++ 4.0 and later

void CNETCMDDlg::OnInetReceiveCmdLeadnetctrl1(short iComputer, short InetCommand, long nCommandID, short nError, LPDISPATCH Params, long nExtraDataSize, const VARIANT FAR& ExtraData)
{
   short nStatus;
   CString szOut;
   CString szTmp;
   CLTInetPacket Packet(Params);
   short nRet;

   nStatus = ERROR_FEATURE_NOT_SUPPORTED;

   szOut.Format("Command %d id=%d, nError=%d nParams=%d received",
                 InetCommand, nCommandID, nError, Packet.GetParamCount());

   if(nExtraDataSize > 0)
   {
      szTmp.Format(", nExtraDataSize=%d", nExtraDataSize);
      szOut = szOut + szTmp;
   }
   OutputDebugString(szOut);
   OutputDebugString("\n");

   if(nError != 0)
      nStatus = ERROR_TRANSFER_ABORTED;
   else
   {
      switch(InetCommand)
      {
      case INETCMD_SHOW_WIN:
         // check the validity of the parameters
         if((Packet.GetParamCount() == 2) && (Packet.GetParamType(0) == PARAM_TYPE_UINT32) &&
            (Packet.GetParamType(1) == PARAM_TYPE_INT32))
         {
            //Note this is a function you must create
            nStatus = ProcessShowWinCommand(Packet.GetParamValue(0).ulVal,
                                            Packet.GetParamValue(1).lVal);
            nRet = m_LEADNet1.InetSendShowWinRsp(nCommandID, 0, NULL, nStatus);
            return;
         }
         break;
      }
   }
   //return an error response
   m_LEADNet1.InetSendRsp(InetCommand, nCommandID, NULL, 0, NULL, nStatus);
}


InetSendSizeWinCmd Example for C++ 4.0 and later

short nRet;
   CString csOut;

   nRet = m_LEADNet1.InetSendSizeWinCmd(999, 1, 0, 0, 100, 100);
   if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
   {
      csOut.Format("ERROR %d calling InetSendSizeWinCmd.", nRet);
      AfxMessageBox(csOut);
   }
   else
      AfxMessageBox("InetSendSizeWinCmd Executed.");


InetSendSizeWinRsp Example for C++ 4.0 and later

void CNETCMDDlg::OnInetReceiveCmdLeadnetctrl1(short iComputer, short InetCommand, long nCommandID, short nError, LPDISPATCH Params, long nExtraDataSize, const VARIANT FAR& ExtraData)
{
   short nStatus;
   CString szOut;
   CString szTmp;
   CLTInetPacket Packet(Params);
   short nRet;

   nStatus = ERROR_FEATURE_NOT_SUPPORTED;

   szOut.Format("Command %d id=%d, nError=%d nParams=%d received",
                 InetCommand, nCommandID, nError, Packet.GetParamCount());

   if(nExtraDataSize > 0)
   {
      szTmp.Format(", nExtraDataSize=%d", nExtraDataSize);
      szOut = szOut + szTmp;
   }
   OutputDebugString(szOut);
   OutputDebugString("\n");

   if(nError != 0)
      nStatus = ERROR_TRANSFER_ABORTED;
   else
   {
      switch(InetCommand)
      {
      case INETCMD_SIZE_WIN:
         // check the validity of the parameters
         if((Packet.GetParamCount() == 5) && (Packet.GetParamType(0) == PARAM_TYPE_UINT32) &&
            (Packet.GetParamType(1) == PARAM_TYPE_INT32) && (Packet.GetParamType(2) == PARAM_TYPE_INT32) &&
            (Packet.GetParamType(3) == PARAM_TYPE_INT32) && (Packet.GetParamType(4) == PARAM_TYPE_INT32))
         {
            //Note this is a function you must create
            nStatus = ProcessSizeWinCommand(Packet.GetParamValue(0).ulVal,
                                            Packet.GetParamValue(1).lVal,
                                            Packet.GetParamValue(2).lVal,
                                            Packet.GetParamValue(3).lVal,
                                            Packet.GetParamValue(4).lVal);
            nRet = m_LEADNet1.InetSendSizeWinRsp(nCommandID, 0, NULL, nStatus);
            return;
         }
         break;

      }
   }
   //return an error response
   m_LEADNet1.InetSendRsp(InetCommand, nCommandID, NULL, 0, NULL, nStatus);
}


InetSendGetMagGlassDataCmd Example for C++ 4.0 and later

long nCommandID;
.
.
.

// … Assume that the following function will be called from inside the MagGlassExt event that
// belongs to LEAD Main OCX control
short GetMagGlassData(long nBitmapID,
                                            const VARIANT FAR& vMaskPlane,
                                            short nMaskPlaneStart,
                                            short nMaskPlaneEnd)
{
   short nRet;
   CString csOut;

   nRet = m_LEADNet1.InetSendGetMagGlassDataCmd(nCommandID++, nBitmapID, vMaskPlane, nMaskPlaneStart, nMaskPlaneEnd);

   if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
   {
      csOut.Format("ERROR %d calling InetSendGetMagGlassDataCmd.", nRet);
      AfxMessageBox(csOut);
   }
   else
      AfxMessageBox("InetSendGetMagGlassDataCmd Executed.");

   return nRet;
}


InetSendGetMagGlassDataRsp Example for C++ 4.0 and later

void CNETCMDDlg::OnInetReceiveCmdLeadnetctrl1(short iComputer, short InetCommand, long nCommandID, short nError, LPDISPATCH Params, long nExtraDataSize, const VARIANT FAR& ExtraData)
{
   short nStatus;
   CString szOut;
   CString szTmp;
   CLTInetPacket Packet(Params);
   CLead *pLead=NULL;
   VARIANT vColorBuffer;

   nStatus = ERROR_FEATURE_NOT_SUPPORTED;

   szOut.Format("Command %d id=%d, nError=%d nParams=%d received",
                 InetCommand, nCommandID, nError, Packet.GetParamCount());

   if(nExtraDataSize > 0)
   {
      szTmp.Format(", nExtraDataSize=%d", nExtraDataSize);
      szOut = szOut + szTmp;
   }
   OutputDebugString(szOut);
   OutputDebugString("\n");

   if(nError != 0)
      nStatus = ERROR_TRANSFER_ABORTED;
   else
   {
      switch(InetCommand)
      {
      case INETCMD_GET_MAGGLASS_DATA:
         // check the validity of the parameters
         if((Packet.GetParamCount() == 5) && (Packet.GetParamType(0) == PARAM_TYPE_UINT32) &&
            (Packet.GetParamType(1) == PARAM_TYPE_UINT32) && (Packet.GetParamType(2) == PARAM_TYPE_USTRING) &&
            (Packet.GetParamType(3) == PARAM_TYPE_INT16) && (Packet.GetParamType(4) == PARAM_TYPE_INT16))
         {
            // Note: This is a function you must create to get a pointer to the
            // control that has the bitmap.
            pLead = FindLBitmap(Packet.GetParamValue(0).ulVal);

            if(pLead)
            {
               nStatus = m_LEADNet1.InetGetMagGlassData(pLead->GetBitmap(),
                                                        &vColorBuffer,
                                                        Packet.GetParamValue(2),
                                                        Packet.GetParamValue(3).iVal,
                                                        Packet.GetParamValue(4).iVal);

               UpdateStatusbar("Received GetMagGlassDataCmd");
            }
            else

               nStatus = -13;//ERROR_INV_PARAMETER; // invalid parameter

            m_LEADNet1.InetSendGetMagGlassDataRsp(nCommandID,
                                                 vColorBuffer,
                                                  Packet.GetParamValue(2),
                                                  Packet.GetParamValue(3).iVal,
                                                  Packet.GetParamValue(4).iVal,
                                                  0, NULL, nStatus);
            return;
         }
         break;
      }
   }
   //return an error response
   m_LEADNet1.InetSendRsp(InetCommand, nCommandID, NULL, 0, NULL, nStatus);
}


InetSendSound Example for C++ 4.0 and later

// This example uses LEAD Capture control to capture audio from the microphone and uses the LEAD //Internet Control to send it to a remote computer.  For an example of starting and stopping recording
//refer to the LEAD Capture control documentation.

void CCap:: CapAudioData(const VARIANT FAR& pData, long lBytesRecorded, short iIndex)
{
// send sound to remote computer (items in SendList property)
   	// you should be connected to a remote computer first by using the
   	// InetConnect method of the Internet ActiveX

   	VARIANT var;

 	var = m_LEADCap1.GetCapWaveExtraData(iIndex);

   	m_LEADNet1.InetSendSound(m_LEADCap1.GetCapWaveFormatTag(iIndex),
                           m_LEADCap1.GetCapWaveChannels(iIndex),
                           m_LEADCap1.GetCapWaveSamplesPerSec(iIndex),
                           m_LEADCap1.GetCapWaveAvgBytesPerSec(iIndex),
                           m_LEADCap1.GetCapWaveBlockAlign(iIndex),
                           m_LEADCap1.GetCapWaveBitsPerSample(iIndex),
                           (short)m_LEADCap1.GetCapWaveExtraSize(iIndex),
                           &var,
                           (VARIANT *)&pData,
                           lBytesRecorded);

   	VariantClear(&var);
}


InetServerClose Example for C++ 4.0 and later

void CNet::Method(short iServer)
{
    	// shutdown server on exit
    	m_LEADNet1.InetServerClose(iServer);
}


InetServerInit Example for C++ 4.0 and later

void CNet::Method(short iServer)
{
    	// initialize port 1000 to wait for connections
    	m_LEADNet1.InetServerInit(iServer, 1000);
}


Tutorial for Delphi 2.0 Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS Internet Features ActiveX.

Note:	These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.
Initializing a Computer as a Server and Accepting Connections

Connecting to a Remote Computer

Sending Images to a Remote Computer

Receiving and Displaying Images from a Remote Computer

Miscellaneous Examples


Initializing a Computer as a Server and Accepting Connections (Delphi 2.0)

Take the following steps to start a project and to add some code that will let you initialize a computer as a server and accept connections.

1.	Start Delphi 2.0.

2. 	In the File menu, choose New Application.

3.	On the Delphi toolbar, click the OCX tab.   If you have used a LEAD ActiveX control before, the icon appears on the toolbar.  Otherwise, add the LEAD Controls as follows:

a.	On the Component menu choose Install. (We assume that the LEAD control has already been registered).

b.	In the Install Components dialog box, click the OCX button.

c.	In the Import OLE control dialog box, click LEAD Internet Control (14) and click OK.  Click OK on the Install Components dialog box to update the toolbar. (This may take a little while.)

d.	In the Project menu, select Add to Project and add the LEADDEF.PAS and LTNETOCX.PAS files to your project.

e.	Click the Unit1 tab in the Unit1.Pas window.  In the File menu, select Use Unit.  Highlight LEADDEF and click OK.  Again select Use Unit in the File menu.  Highlight LTNETOCX and click OK.

4.	Select the LEAD Internet Control on the OCX toolbar and add it to the form. Change the Name to LEADNet1.

5.	Add a command button to your form and name it as follows:

Name	Caption
ServerInit	Init Server
6.	Define a global variable as follows:

var
hServer : Smallint;

7.	Code the FormCreate procedure as follows:

procedure TForm1.FormCreate(Sender: TObject);

begin
{ Disable errors so we can trap our own}
LEADNet1.EnableMethodErrors := 0;
end;

8.	Code the ServerInitClick procedure as follows:

procedure TForm1.ServerInitClick(Sender: TObject);
var
nRet : Smallint;
begin
{initialize server on port 1000}
nRet := LEADNet1.InetServerInit(hServer, 1000);
if (nRet <> 0) then
   ShowMessage('Error initializing server' + IntToStr(nRet));
end;

9.	Code the LEADNet1InetAccept procedure as follows:

procedure TForm1.LEADNet1InetAccept(Sender: TObject; iServer: Smallint);
var
hComputer : Smallint;
hName : string; { Note that this needs to be Wstring in Delphi 3.0 }
nRet : Smallint;
begin
nRet := LEADNet1.InetAcceptConnect(hServer, hComputer);
if (nRet <> 0) then
   ShowMessage('Error accepting connection:' + IntToStr(nRet));
LEADNet1.InetGetHostName(hComputer, HOST_NAME_DESCRP, hName);
{add to our send list}
LEADNet1.SendList[LEADNet1.SendListNum] := hComputer;
ShowMessage('Connection accepted from:' + hName);
end;

10.	Code the FormClose procedure as follows:

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
i : Smallint;
begin
{disconnect all connections}
for i := 0 to LEADNet1.ConnectListNum - 1 do
begin
     LEADNet1.InetDisconnect(LEADNet1.ConnectList[i]);
end;
end;

11.	Run your program to test it.

12.	Save the project to use as a starting point for other tasks in the tutorial.  Create an EXE that you can run outside Delphi.


Connecting to a Remote Computer (Delphi 2.0)

Take the following steps to start a project and to add some code that will let you connect to a remote computer that is acting as a server.

1.	Run the server example (the .EXE) created in Initializing a Computer as a Server and Accepting Connections.  Start the server.

2.	Start Delphi 2.0.

3. 	In the File menu, choose New Application.

4.	On the Delphi toolbar, click the OCX tab.   If you have used a LEAD ActiveX Control before, the icon appears on the toolbar.  Otherwise, add the LEAD Controls as follows:

a.	On the Component menu choose Install. (We assume that the LEAD control has already been registered).

b.	In the Install Components dialog box, click the OCX button.

c.	In the Import OLE control dialog box, click LEAD Internet Control (14) and click OK.  Click OK on the Install Components dialog box to update the toolbar. (This may take a little while.)

d.	In the Project menu, select Add to Project and add the LEADDEF.PAS and LTNETOCX.PAS files to your project.

e.	Click the Unit1 tab in the Unit1.Pas window.  In the File menu, select Use Unit.  Highlight LEADDEF and click OK.  Again select Use Unit in the File menu.  Highlight LTNETOCX and click OK.

5.	Select the LEAD Internet control on the OCX toolbar and add it to the form.  Change the Name to LEADNet1.

6.	Add an Edit box to the form and name it as follows:

Name
RemoteComputer

7.	Add two command buttons to the form and name them as follows:

Name	Caption
Connect	Connect To Remote
Disconnect	Disconnect From Remote
8.	Code the ConnectClick procedure as follows:

procedure TForm1.ConnectClick(Sender: TObject);
var
nRet : Smallint;
begin
{Disable errors so we can trap our own}
LEADNet1.EnableMethodErrors := 0;
{connect to remote computer on port 1000}
nRet := LEADNet1.InetConnect(RemoteComputer.Text, 1000);
if (nRet <> 0) then
   ShowMessage('Error connecting to:' + RemoteComputer.Text);
end;

9.	Code the DisconnectClick procedure as follows:

procedure TForm1.DisconnectClick(Sender: TObject);
var
nRet : Smallint;
begin
{we are assuming only one connection in this example, therefore the handle
to the remote computer will be in the first position in the SendList }
nRet := LEADNet1.InetDisconnect(LEADNet1.SendList[0]);
if (nRet <> 0) then
   ShowMessage ('Error disconnecting from remote:' + IntToStr(nRet));
end;

10.	Code the LEADNet1InetConnected procedure as follows:

procedure TForm1.LEADNet1InetConnected(Sender: TObject;
  iComputer: Smallint);
var
sRemote : string; { Note that this needs to be Wstring in Delphi 3.0 }
begin
{get remote host name}
LEADNet1.InetGetHostName(iComputer, HOST_NAME_DESCRP, sRemote);
{add this connection to our SendList}
LEADNet1.SendList[LEADNet1.SendListNum] := iComputer;
ShowMessage('Successfully connected to :' + sRemote);
end;

11.	Code the LEADNet1InetDisconnected procedure as follows:

procedure TForm1.LEADNet1InetDisconnected(Sender: TObject;
  iComputer: Smallint);
begin
ShowMessage('Disconnect from remote computer.');
end;

12.	Run your program to test it.  Enter the name of the computer that is acting as the server, in the text box.

13.	Save the project to use as a starting point for other tasks in the tutorial.


Sending Images to a Remote Computer (Delphi 2.0)

Take the following steps to add some code that will let you send images to a remote computer.

1.	Start with the example you created in Initializing a Computer as a Server and Accepting Connections.

2.	On the Delphi toolbar, click the OCX tab.   If you have used a LEAD ActiveX control before, the icon appears on the toolbar.  Otherwise, add the LEAD Controls as follows:

a.	On the Component menu choose Install. (We assume that the LEAD control has already been registered).

b.	In the Install Components dialog box, click the OCX button.

c.	In the Import OLE control dialog box, click LEAD Capture Control (14) and click OK.  Click OK on the Install Components dialog box to update the toolbar. (This may take a little while.)

d.	In the Project menu, select Add to Project and add the LTCAPOCX.PAS file to your project.

e.	Click the Unit1 tab in the Unit1.Pas window.  In the File menu, select Use Unit.  Highlight LTCAPOCX and click OK.

3.	Select the LEAD Capture Control on the OCX toolbar and add it to the form.  Size and position the control as you want it to appear at run time.  Change the Name to LEADCap1.

4.	Add a command button to your form and name it as follows:

Name	Caption
Send	Send Bitmaps
5.	Define a global variable as follows:

var
bSendImages : Wordbool;

6.	Add the following line to the FormCreate procedure:

bSendImages := False;

7.	Code the FormActivate procedure as follows:

procedure TForm1.FormActivate(Sender: TObject);
var
nRet : Smallint;
begin
nRet := LEADCap1.CapConnect(0);
if (nRet <> 0) then
   ShowMessage('Error connecting to capture device:' + IntToStr(nRet))
else
begin
     LEADCap1.CapDisplayMode := DISPLAY_PREVIEW;
     LEADCap1.EnableCaptureEvents := 1;
end;
end;

8.	Code the SendClick procedure as follows:

procedure TForm1.SendClick(Sender: TObject);
begin
bSendImages := not(bSendImages);
end;

9.	Code the LEADCap1VideoData procedure as follows:

procedure TForm1.LEADCap1CapVideoData(Sender: TObject; hDib,
  lTime: Integer);
begin
if (bSendImages) then
begin
     LEADNet1.InetSendDIB(hDib, FILE_CMP, 24, 75);
end;
Application.ProcessMessages;
end;

10.	Run your program to test it.

11.	Save the project to use for other tasks in the tutorial.  Create an EXE that will run outside Delphi.


Receiving and Displaying Images from a Remote Computer (Delphi 2.0)

Take the following steps to add some code that will let you receive and display images received from a computer acting as a server.

1.	Start with the example you created in Sending Images to a Remote Computer.  This example will serve as the server to the client application created in this example.  Start the server.

2.	Start Delphi.

3.	Start with the example you created in Connecting to a Remote Computer.

4.	On the Delphi toolbar, click the OCX tab.   If you have used a LEAD ActiveX Control before, the icon appears on the toolbar.  Otherwise, add the LEAD controls as follows:

a.	On the Component menu choose Install. (We assume that the LEAD control has already been registered).

b.	In the Install Components dialog box, click the OCX button.

c.	In the Import OLE control dialog box, click LEAD Main Control (14) and click OK.  Click OK on the Install Components dialog box to update the toolbar. (This may take a little while.)

5.	Select the LEAD Main Control on the OCX toolbar and add it to the form.  Size and position the control as you want it to appear at run time.  Change the Name to LEAD1.  Set the BackErase property to False.

6.	Code the LEADNet1InetReceiveBitmap procedure as follows:

procedure TForm1.LEADNet1InetReceiveBitmap(Sender: TObject;
  iComputer: Smallint; hBitmap: Integer);
begin
{assign bitmap to LEAD Main control}
LEAD1.Bitmap := hBitmap;
Application.ProcessMessages;
end;

7.	Run your program to test it.


Miscellaneous Examples (Delphi)
Miscellaneous Examples (Delphi 2.0)

You can test the following examples by either adding a command button to one of the previous lessons in the tutorial and pasting the sample code in the Click procedure, or by cutting and pasting event code into the appropriate event in a lesson.

Bitmap Example for Delphi 2.0

EnableMethodErrors Example for Delphi 2.0

InetAcceptConnect Example for Delphi 2.0

InetClearQueue Example for Delphi 2.0

InetConnected Example for Delphi 2.0

InetDataSent Example for Delphi 2.0

InetDisconnect Example for Delphi 2.0

InetDisconnected Example for Delphi 2.0

InetError Example for Delphi 2.0

InetGetData Example for Delphi 2.0

InetReceiveBitmap Example for Delphi 2.0

InetReceiveData Example for Delphi 2.0

InetReceiveSound Example for Delphi 2.0

InetReceiveStart Example for Delphi 2.0

InetReceiving Example for Delphi 2.0

InetSendBitmap Example for Delphi 2.0

InetSendData Example for Delphi 2.0

InetSendDIB Example for Delphi 2.0

InetSending Example for Delphi 2.0

InetSendSound Example for Delphi 2.0

InetServerClose Example for Delphi 2.0

InetServerInit Example for Delphi 2.0


Bitmap Example for Delphi 2.0

{ this procedure is called once a second }

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  { should be connected to capture device }

  {assign current frame to LEAD Main Control }
  LeadCtrl1.Bitmap:=LEADCap1.Bitmap;
end;


EnableMethodErrors Example for Delphi 2.0

This is also the example for the InetConnect method.

procedure TForm1.ConnectClick(Sender: TObject);
var
  nRet: Integer;
  msg: String;
begin
  LEADNet1.EnableMethodErrors := 0;

  { connect to computer 127.0.0.1 }
  nRet := LEADNet1.InetConnect('127.0.0.1',1000);
  if(nRet<>0) then
   begin
     msg := 'Error: ' + IntToStr(nRet) + ' trying to connect';
     ShowMessage(msg);
   end
end;


InetAcceptConnect Example for Delphi 2.0

This is also the example for the InetAccept event, the SendList property and the SendListNum property.

Dim icomputer As Integer

var
  hComputer: SmallInt;

procedure TForm1.LEADNet1InetAccept(Sender: TObject; iServer: Smallint);
begin
  { accept connection }
  if LEADNet1.InetAcceptConnect(iServer,hComputer) = 0 then
   begin
     { add connection to send list }
     LEADNet1.SendList[LEADNet1.SendListNum] := hComputer
   end;
end;


InetClearQueue Example for Delphi 2.0

This is also the example for the InetQueueSize property.

{ This example checks the size of computers in the send lists before it sends data to the remote
  computer. It uses the LEAD Capture Control for recording audio data.  Refer to the LEAD Capture
  Control documentation for an example of recording audio data }

procedure TMainForm.LEADCap1CapAudioData(Sender: TObject;
  pData: Variant; lBytesRecorded: Integer; iIndex: Smallint);
var
  eData: Variant;
  sData: Variant;
  i: Integer;
  qSize: LongInt;
begin
  { check the queue size of all computers in SendList }
  for i:=0 to SoundNet.SendListNum -1 do
   begin
     qSize:=SoundNet.InetQueueSize[SoundNet.SendList[i]];
     { clear queue there is more than 10 seconds worth of sound data }
     if qSize > (LEADCap1.CapWaveAvgBytesPerSec[iIndex] * 10) then
       SoundNet.InetClearQueue(SoundNet.SendList[i]);
   end;

  sData:=LEADCap1.CapGetAudioData ();
  eData:=LEADCap1.CapWaveExtraData [iIndex];
  SoundNet.InetSendSound(LEADCap1.CapWaveFormatTag [iIndex],
                         LEADCap1.CapWaveChannels [iIndex],
                         LEADCap1.CapWaveSamplesPerSec [iIndex],
                         LEADCap1.CapWaveAvgBytesPerSec [iIndex],
                         LEADCap1.CapWaveBlockAlign [iIndex],
                         LEADCap1.CapWaveBitsPerSample [iIndex],
                         LEADCap1.CapWaveExtraSize [iIndex],eData,
                         sData, lBytesRecorded);

  VarClear(eData);
  VarClear(sData);
  Application.ProcessMessages;
end;


InetConnected Example for Delphi 2.0

This is also the example for the InetGetHostName method.

procedure TForm1.LEADNet1InetConnected(Sender: TObject;
  iComputer: Smallint);
var
  hostname: String;
  msg: String;
begin
  { add to sendlist }
  LEADNet1.SendList[LEADNet1.SendListNum] := iComputer;
  { get host name }
  LEADNet1.InetGetHostName(iComputer,HOST_NAME_IP,hostname);
  msg := 'Computer ' + IntToStr(iComputer) + ' connected with ' + hostname;
  ShowMessage(msg);
end;


InetDataSent Example for Delphi 2.0

procedure TForm1.LEADNet1InetDataSent(Sender: TObject;
  iComputer: Smallint; lSize: Integer);
var
  msg: String;
begin
  { display amount sent }
  msg := 'Data sent: ' + IntToStr(lSize) + ' bytes';
  ShowMessage(msg);
end;


InetDisconnect Example for Delphi 2.0

This is also the example for the ConnectList property and ConnectListNum property.

procedure TForm1.DisconnectClick(Sender: TObject);
var
  i: Integer;
begin
  { disconnect all connections }
  for i:=0 to LEADNet1.ConnectListNum - 1 do
    LEADNet1.InetDisconnect(LEADNet1.ConnectList[i]);
end;


InetDisconnected Example for Delphi 2.0

procedure TForm1.LEADNet1InetDisconnected(Sender: TObject;
  iComputer: Smallint);
begin
  ShowMessage('Computer: ' + IntToStr(iComputer) + ' disconnected');
end;


InetError Example for Delphi 2.0

procedure TForm1.LEADNet1InetError(Sender: TObject; iComputer, iMessage, iError: Smallint);
var
  msg: String;
begin
  msg := 'Computer: ' + IntToStr(iComputer) + ' had error ' + IntToStr(iError) + ' (iMessage = ' + IntToStr(iMessage) + ')';
  ShowMessage(msg);
end;


InetGetData Example for Delphi 2.0

procedure TMainForm.LEADNet1InetReceiveData(Sender: TObject;
  iComputer: Smallint; pData: Variant; lSize: Integer; iType: Smallint);
var
  data: Variant;
  pRecData: Pointer;
  command: String;
begin
  data:=LEADNet1.InetGetData();
  pRecData:=VarArrayLock(data);
  if pRecData<>Nil then
   begin
     command:=StrPas(pRecData);
     { show the command received }
     ShowMessage(command);
     VarArrayUnlock(data);
   end;
  VarClear(data);
end;


InetReceiveBitmap Example for Delphi 2.0

procedure TForm1.LEADNet1InetReceiveBitmap(Sender: TObject;
  iComputer: Smallint; hBitmap: Integer);
begin
  { assing bitmap to main LEAD Control }
  LeadCtrl1.Bitmap := hBitmap;
end;


InetReceiveData Example for Delphi 2.0

procedure TForm1.LEADNet1InetReceiveData(Sender: TObject;
  iComputer: Smallint; pData: Variant; lSize: Integer; iType: Smallint);
  var
    msg: String;
begin
  msg:= 'You received: ' + IntToStr(lSize) + ' bytes of data';
  ShowMessage(msg);
end;


InetReceiveSound Example for Delphi 2.0

{ this example uses the LEAD Capture Module for sound playback }
{ for examples on its use please refer to the Capture Module
  documentation }

procedure TForm1.LEADNet1 InetReceiveSound(Sender: TObject; iComputer,
  iFormatTag, nChannels: Smallint; lSamplesPerSec,
  lAvgBytesPerSec: Integer; iBlockAlign, iBitsPerSample,
  iExtraDataSize: Smallint; pExtraData, pData: Variant;
  lDataSize: Integer);
 begin
  if not bInit then
   begin
     { this method only returns valid data during this event }
     LEADCap1.CapWaveFormatTag [CAP_AUDIO_FEED] := iFormatTag;
     LEADCap1.CapWaveChannels [CAP_AUDIO_FEED] := nChannels;
     LEADCap1.CapWaveSamplesPerSec [CAP_AUDIO_FEED] := lSamplesPerSec;
     LEADCap1.CapWaveAvgBytesPerSec [CAP_AUDIO_FEED] := lAvgBytesPerSec;
     LEADCap1.CapWaveBlockAlign [CAP_AUDIO_FEED] := iBlockAlign;
     LEADCap1.CapWaveBitsPerSample [CAP_AUDIO_FEED] := iBitsPerSample;
     LEADCap1.CapWaveExtraData [CAP_AUDIO_FEED] := pExtraData;
     LEADCap1.CapWaveExtraSize [CAP_AUDIO_FEED] := iExtraDataSize;
     nRet:=LEADCap1.CapStartFeedSound ('', -1, 0, CAP_FEED_PLAYDATA, hSound);
     if nRet=0 then
      begin
       LEADCap1.CapFeedSound (hSound,pData,lDataSize);
       bInit := True;
     end;
   end
  else
    LEADCap1.CapFeedSound(hSound,pData,lDataSize);
    { CapCloseFeedSound should be called somewhere in the program to close the
      feed sound process }
end;


InetReceiveStart Example for Delphi 2.0

procedure TForm1.LEADNet1InetReceiveStart(Sender: TObject;
  iComputer: Smallint; lSize: Integer);
var
  msg: String;
begin
  { display amount we expect to receive }
  msg := 'Will receive: ' + IntToStr(lSize) + ' bytes';
end;


InetReceiving Example for Delphi 2.0

procedure TForm1.LEADNet1InetReceiving(Sender: TObject;
  iComputer: Smallint; lSize: Integer);
var
  msg: String;
begin
  { display amount we have received }
  msg := 'Receiving: ' + IntToStr(lSize) + ' bytes';
  ShowMessage(msg);
end;


InetSendBitmap Example for Delphi 2.0

procedure TForm1.SendBitmapClick(Sender: TObject);
begin
  { send bitmap to everybody in SendList property }
  { bitmap should be loaded in main LEAD control  }
  LEADNet1.InetSendBitmap(LeadCtrl1.Bitmap,FILE_CMP,24,255);
end;


InetSendData Example for Delphi 2.0

procedure TForm1.SendDataClick(Sender: TObject);
var
  data: Variant;
  pData: Pointer;
  nRet: Integer;
begin
  { create a byte array of data }
  data := VarArrayCreate([0, 5], varByte);
  pData := VarArrayLock(data);
  StrCopy(pData,'Hello'); { copy some data into our array }
  VarArrayUnlock(data);
  nRet:=LEADNet1.InetSendData(data,5,IDATA_USER4);
  VarClear(data);
end;


InetSendDIB Example for Delphi 2.0

procedure TForm1.SendDibClick(Sender: TObject);
begin
  LeadCtrl1.Load('d:\\ltwin11x\\images\\sample4.cmp',0,0,1);
  { send dib to every computer in send list }
  LEADNet1.InetSendDIB(LeadCtrl1.GetDIB,FILE_CMP,24,255);
  LeadCtrl1.Bitmap := 0;
end;


InetSending Example for Delphi 2.0

procedure TForm1.LEADNet1InetSending(Sender: TObject;
  iComputer: Smallint; lSize: Integer);
var
  msg: String;
begin
  { display amount sending }
  msg := 'Sending: ' + IntToStr(lSize) + ' bytes';
  ShowMessage(msg);
end;


InetSendSound Example for Delphi 2.0

This is also the example for the CapGetAudioData method.

{ This example uses the LEAD Capture Control to capture audio from the microphone and uses the LEAD Internet control to send the captured audio to a remote computer.  For information on starting and stopping recording, refer to the CapStartRecord and CapStopRecord methods in the LEAD Capture control documentation.  For an example of connecting to a remote computer please refer to the InetConnect method in the LEAD Internet control documentation. }

{ Capture audio event }
procedure TForm1.LEADCap1CapAudioData (Sender: TObject; pData: Variant;
  lBytesRecorded: Integer; iIndex: Smallint);
var
  sData: Variant;
  eData: Variant;
begin
  { this call is needed because delphi doesn't handle the
    variant parameters correctly }
  sData:=LEADCap1.CapGetAudioData ();
  eData:=LEADCap1.CapWaveExtraData [iIndex];

  { send sound to remote computer (items in SendList property)
    you should be connected to a remote computer first by using the
    InetConnect method of the Internet ActiveX
  }

   LEADNet1.InetSendSound(LEADCap1.CapWaveFormatTag [iIndex],
      LEADCap1.CapWaveChannels [iIndex], LEADCap1.CapWaveSamplesPerSec [iIndex],
      LEADCap1.CapWaveAvgBytesPerSec [iIndex], LEADCap1.CapWaveBlockAlign [iIndex],
      LEADCap1.CapWaveBitsPerSample [iIndex], LEADCap1.CapWaveExtraSize [iIndex],
      eData, sData, lBytesRecorded);

   VarClear(sData);
   VarClear(eData);
end;


InetServerClose Example for Delphi 2.0

var
  hServer: SmallInt;

{ hServer should be initialized with InetServerInit }
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  { close server on form close }
  LEADNet1.InetServerClose(hServer);
end;


InetServerInit Example for Delphi 2.0

var
  hServer: SmallInt;

procedure TForm1.FormCreate(Sender: TObject);
begin
  { intialize port 1000 to wait for connections }
  LEADNet1.InetServerInit(hServer,1000);
  { refer to the InetAccept event to find out out to
    accept connect requests }
end;


Data Types

New Internet Data Types

InetCmdType

InetParamType

DisplayRectType

Internet Interfaces

ILTInetPacket


InetCmdType

typedef enum tagInetCmdType

{

   INETCMD_LOAD = 0, /* load a file	*/
   INETCMD_SAVE = 1, /* save a file */
   INETCMD_CREATE_WIN = 2, /* create a window */
   INETCMD_SIZE_WIN = 3, /* size a new window */
   INETCMD_CLOSE_WIN = 4, /* close a window */
   INETCMD_SHOW_WIN = 5, /* show/hide the window */
   INETCMD_SET_RECT = 6, /* set bitmap display rectangles */
   INETCMD_SEND_ANN = 7, /* not implemented yet */
   INETCMD_ATTACH_BITMAP = 8, /* attach the bitmap to the control */
   INETCMD_FREE_BITMAP = 9, /* free the bitmap */
   INETCMD_GET_MAGGLASS_DATA = 10,	/* get MagGlass needed data */
   INETCMD_USER_REG   = 10000, /* start of registered user command values */
   INETCMD_USER_CUSTOM = 20000,   /* start of custom user command values */

} InetCmdType;

The InetCmdType data type contains the predefined commands used by the Internet command methods.

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.


InetParamType

typedef enum tagInetParamType

{
   PARAM_TYPE_INT32, /* signed integer */
   PARAM_TYPE_UINT32, /* unsigned integer */
   PARAM_TYPE_CHAR, /* signed character */
   PARAM_TYPE_UCHAR, /* unsigned character */
   PARAM_TYPE_STRING, /* strings */
   PARAM_TYPE_LONG, /* long */
   PARAM_TYPE_UINT16, /* unsigned short */
   PARAM_TYPE_INT16, /* signed short */
   PARAM_TYPE_USTRING, /* unsigned string */
} InetParamType;

The InetParamType data type contains the parameter types used by the Internet command methods.


DisplayRectType

typedef enum tagDisplayRectType
{
   DISPLAY_RECT_SRC, /* source */
   DISPLAY_RECT_SRCCLIP, /* source clip */
   DISPLAY_RECT_DST, /* destination */
   DISPLAY_RECT_DSTCLIP, /* destination clip */
} DisplayRectType;

The DisplayRectType data type contains the display rectangle types used by the Internet command methods.


ILTInetPacket

The ILTInetPacket represents a LEADTOOLS Internet Data Packet. It contains parameter data sent to an event.

Properties:

Property Name	Data Type	Description	Examples
EnableMethodErrors	VARIANT_BOOL	Specifies whether LEADTOOLS generates runtime exceptions (in addition to method return values).  If EnableMethodErrors is TRUE, the runtime exceptions will be generated.  If FALSE, they will not be generated.	Visual Basic Example  Visual C++ 4.0 Example
ParamCount	long	Gets/Sets the number of parameters for the packet.  Set this to > 0 to set the number of parameters for the packet.  Set this to 0 to free all existing parameters. If this property is >0, it must first be set to 0 before changing its value.	Visual Basic Example  Visual C++ 4.0 Example
ParamType (long nIndex)	InetParamType	Gets/Sets the type of the specified parameter.  Each parameter sent to the event has a type. Note, you cannot change a non-string type to a string, and you cannot change a string to a non-string type.	Visual Basic Example  Visual C++ 4.0 Example
ParamValue (long nIndex)	VARIANT	Gets/Sets the value of the specified parameter. For each parameter sent to the event, there is a parameter value.	Visual Basic Example  Visual C++ 4.0 Example
Comments

Setting ParamCount to a value greater than 0 allocates the memory for the specified number of parameters. Therefore, if ParamCount is 2, then memory has been allocated for two parameters. In order to change ParamCount to 3, it must first be set to 0 to free the existing parameters and then set to 3 to allocate the memory for the new parameters.


Error Codes

For a list of all possible error codes for LEADTOOLS Internet OCX functions, refer to LEADTOOLS OCX Error Codes in the Main OCX help file (Ltocxn.hlp).


Introduction

The LEADTOOLS Internet features are included in the LEADTOOLS Multimedia, LEADTOOLS Multimedia Pro, and the LEADTOOLS Internet Imaging Pro toolkits.  The Internet features provide the ability to add Internet capabilities to your application.  LEADTOOLS Internet ActiveX (OCX) includes the following custom control developed by LEAD Technologies, Inc.:

 LEAD Internet Control Module is a custom control for incorporating Internet functionality, including video conferencing, into your applications.

The Internet functionality requires Winsock 2.0 to be installed.

NOTE:	Please note that the LEAD Internet Control Module and this help file also contain methods for sending and responding to messages between local and remote computers. These methods are available only in the LEADTOOLS Internet Imaging Pro toolkit. These methods are indicated in the documentation by (Internet only).
Executable demos are included in all LEADTOOLS products.  The executable demos provide a quick and easy way to evaluate the Internet features and performance.

You can use the LEADTOOLS Internet features in any programming environment that supports OLE custom controls, including the following:

Visual C++ 4.0 and later (32-bit)
Visual Basic 4.0 and later (32-bit)
Delphi 2.0 and later (32-bit)
Visual Java++ 1.0 and later (32-bit)

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.


Miscellaneous Examples (Visual Java++)

You can test the following examples by either adding a command button to one of the previous lessons in the tutorial and pasting the sample code in the Click procedure, or by cutting and pasting event code into the appropriate event in a lesson.

EnableMethodErrors Example for Visual J++

InetAcceptConnect Example for Visual J++

InetClearQueue Example for Visual J++

InetConnect Example for Visual J++

InetConnected Example for Visual J++

InetDataSent Example for Visual J++

InetDisconnect Example for Visual J++

InetDisconnected Example for Visual J++

InetError Example for Visual J++

InetReceiveBitmap Example for Visual J++

InetReceiveData Example for Visual J++

InetReceiveSound Example for Visual J++

InetReceiveStart Example for Visual J++

InetReceiving Example for Visual J++

InetSendBitmap Example for Visual J++

InetSendData Example for Visual J++

InetSendDIB Example for Visual J++

InetSending Example for Visual J++

InetSendSound Example for Visual J++

InetServerClose Example for Visual J++

InetServerInit Example for Visual J++


EnableMethodErrors Example for Visual J++

private void button1_click(Object source, Event e)
{
   LEADNet1.setEnableMethodErrors( 0 );
   int i = LEADNet1.InetConnect( "DummyName", (short) 1000 );
   if( i != 0 )
      MessageBox.show( "Error: " + i + " trying to connect" );
}


InetAcceptConnect Example for Visual J++

This is also the example for the InetAccept event, the SendList property and the SendListNum property.

private void LEADNet1_inetAccept(Object source, ltnet14n.LEADNet.InetAcceptEvent e)
{
   short piComp[] = { 0 };
   LEADNet1.InetAcceptConnect( e.iServer, piComp );

   // add connection to send list
   LEADNet1.setSendList( LEADNet1.getSendListNum(), piComp[ 0 ] );
}


InetClearQueue Example for Visual J++

This is also the example for the InetQueueSize property.

private void LEADCap1_CapAudioData (Object source, ltcap14n.LEADCap.CapAudioDataEvent e)
{
   // check the queue size of all computers in SendList
   // this is the list of computers that are connected to us
   for( short i = 0 ; i < LEADServer.GetSendListNum() ; i++ )
   {
      int qSize = LEADServer.GetInetQueueSize( LEADServer.getSendList( i ) );

      // clear queue there is more than 10 seconds worth of sound data
      if( qSize >   ( LEADCap1.GetCapWaveAvgBytesPerSec ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ) * 10 ) )
         LEADServer.InetClearQueue( LEADServer.getSendList( i ) );
   }

   // send data to all clients in the server send list
   if( LEADServer.GetSendListNum() > 0 )
      LEADServer.InetSendSound( LEADCap1.GetCapWaveFormatTag ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                LEADCap1.GetCapWaveChannels ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                LEADCap1.GetCapWaveSamplesPerSec ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                LEADCap1.GetCapWaveAvgBytesPerSec ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                LEADCap1.GetCapWaveBlockAlign ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                LEADCap1.GetCapWaveBitsPerSample ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                (short) LEADCap1.GetCapWaveExtraSize ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                LEADCap1.GetCapWaveExtraData ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                e.pData,
                                e.lBytesRecorded );

   // check the queue size of all computers in SendList
   // this is the list of computers that we are connected to
   for( short i = 0 ; i < LEADServer.getSendListNum() ; i++ )
   {
      int qSize = LEADClient.GetInetQueueSize( LEADClient.getSendList( i ) );
      // clear queue there is more than 10 seconds worth of sound data
      if( qSize > ( LEADCap1.GetCapWaveAvgBytesPerSec ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ) * 10 ) )
         LEADClient.InetClearQueue( LEADClient.getSendList( i ) );
   }

   // send data to all servers in the client send list
   if( LEADClient.GetSendListNum() > 0 )
      LEADClient.InetSendSound( LEADCap1.GetCapWaveFormatTag ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                LEADCap1.GetCapWaveChannels ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                LEADCap1.GetCapWaveSamplesPerSec ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                LEADCap1.GetCapWaveAvgBytesPerSec ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                LEADCap1.GetCapWaveBlockAlign ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                LEADCap1.GetCapWaveBitsPerSample ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                (short) LEADCap1.GetCapWaveExtraSize ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                LEADCap1.GetCapWaveExtraData ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ),
                                e.pData,
                                e.lBytesRecorded );
}


InetConnect Example for Visual J++

private void button1_click(Object source, Event e)
{
   // connect to computer 127.0.0.1
   LEADNet1.InetConnect( "127.0.0.1", (short) 1000 );
}


InetConnected Example for Visual J++

This is also the example for the InetGetHostName method.

private void LEADNet1_InetConnected(Object source, ltnet14n.LEADNet.InetConnectedEvent e)
{
   // add remote computer to our send list

   LEADNet1.SetSendList( LEADNet1.GetSendListNum(), e.iComputer );

   // get remote computer name
   String hostname[] = { "" };
   LEADNet1.InetGetHostName( e.iComputer, (short) ltnet14n.tagInetAddressType.HOST_NAME_DESCRP, hostname );

   // display host descriptive name
   MessageBox.show( hostname[ 0 ] );
}


InetDataSent Example for Visual J++

private void LEADNet1_InetDataSent(Object source, ltnet14n.LEADNet.InetDataSentEvent e)
{
   // display the amount of data sent
   MessageBox.show( "Data Sent: " + e.lSize + " bytes" );
}


InetDisconnect Example for Visual J++

This is also the example for the ConnectList property and ConnectListNum property.

private void button1_click(Object source, Event e)
{
   // disconnect all connections
   for( short i = 0 ; i < LEADNet1.GetConnectListNum() ; i++ )
      LEADNet1.InetDisconnect( LEADNet1.GetConnectList( i ) );
}


InetDisconnected Example for Visual J++

private void LEADNet1_InetDisconnected(Object source, ltnet14n.LEADNet.InetDisconnectedEvent e)
{
   MessageBox.show(  e.iComputer + " disconnected" ) ;
}


InetError Example for Visual J++

private void LEADNet1_InetError(Object source, ltnet14n.LEADNet.InetErrorEvent e)
{
   MessageBox.show( "Computer: " + e.iComputer + " had Error: " + e.iError + " at: " + e.iMessage );
}


InetReceiveBitmap Example for Visual J++

private void LEADNet1_InetReceiveBitmap(Object source, ltnet14n.LEADNet.InetReceiveBitmapEvent e)
{
   // assign bitmap to main lead control
   LEAD2.SetBitmap( e.hBitmap );
}


InetReceiveData Example for Visual J++

private void LEADNet1_InetReceiveData(Object source, ltnet14n.LEADNet.InetReceiveDataEvent e)
{
   // convert to a string
   String strData = "";
   for( int i = 0 ; i < e.lSize ; i++ )
      strData += e.pData.toSafeArray().getChar( i );

   MessageBox.show( e.iComputer + ": " + strData );
}


InetReceiveSound Example for Visual J++

private boolean m_bInit = false;

private void LEADNet1_InetReceiveSound(Object source, ltnet14n.LEADNet.InetReceiveSoundEvent e)
{
   // this example uses the LEAD Capture Module for sound playback

   if( !m_bInit )
   {
      LEADCap1.SetCapWaveFormatTag ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_FEED, e.iFormatTag );
      LEADCap1.SetCapWaveChannels ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_FEED, e.nChannels );
      LEADCap1.SetCapWaveSamplesPerSec ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_FEED, e.lSamplesPerSec );
      LEADCap1.SetCapWaveAvgBytesPerSec ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_FEED, e.lAvgBytesPerSec );
      LEADCap1.SetCapWaveBlockAlign ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_FEED, e.iBlockAlign );
      LEADCap1.SetCapWaveBitsPerSample ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_FEED, e.iBitsPerSample );
      LEADCap1.SetCapWaveExtraData ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_FEED, e.pExtraData );
      LEADCap1.SetCapWaveExtraSize ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_FEED, e.iExtraDataSize );

      // initialize feed sound process
      int piSound[] = { 0 };
      LEADCap1.CapStartFeedSound ( "c:\\capture.wav", (short) 0, (short) 2, (short) ltcap14n.tagFeedSoundFlagsEnums.CAP_FEED_SAVEDATA, piSound );
      m_hSound = piSound[ 0 ];
      m_bInit = true;
   }
   else
      LEADCap1.CapFeedSound ( m_hSound, e.pData, e.lDataSize );

   // when finished playing sound LEADCap1.CapStopFeedSound should be called, a good
   //  place to do it would be in the InetDisconnected event
}


InetReceiveStart Example for Visual J++

private void LEADNet1_InetReceiveStart(Object source, ltnet14n.LEADNet.InetReceiveStartEvent e)
{
   // Display amount expected
   edit1.setText( "Will receive: " + e.lSize + " bytes." );
}


InetReceiving Example for Visual J++

private void LEADNet1_InetReceiving(Object source, ltnet14n.LEADNet.InetReceivingEvent e)
{
   // display data size as we get it
   edit1.setText( "Computer: " + e.iComputer + " received " + e.lSize );
}


InetSendBitmap Example for Visual J++

private void button1_click(Object source, Event e)
{
   // send bitmap to everybody in SendList property
   LEADNet1.InetSendBitmapmethod( LEAD1.GetBitmap(), (short) ltocx14n.FileConstants.FILE_CMP, (short) 24, (short) 255 );
}


InetSendData Example for Visual J++

private void menuItem32_click(Object source, Event e)
{
   String s = "This is a test";
   LEADNet1.InetSendData( new Variant( s ), s.length(), (short) ltnet14n.tagInetDataTypes.IDATA_USER1 );
}


InetSendDIB Example for Visual J++

private void button1_click(Object source, Event e)
{
   LEAD1.Load( "c:\\lead\\images\\sample4.cmp", (short) 0, (short) 0, (short) 1 );

   // send dib to remote computer
   LEADNet1.InetSendDIB( LEAD1.GetDIB(), (short) ltocx14n.FileConstants.FILE_CMP, (short) 24, (short) 255 );
}


InetSending Example for Visual J++

private void LEADNet1_InetSending(Object source, ltnet14n.LEADNet.InetSendingEvent e)
{
   // display the about of data we are sending
   MessageBox.show( "Sending: " + e.lSize + " bytes" );
}


InetSendSound Example for Visual J++

This example uses LEAD Capture control to capture audio from the microphone and send it to a remote computer.  For Example of starting and stopping recording refer to the LEAD Capture control documentation.

private void StartRecord_click(Object source, Event e)
{
   // the capture doesn't have to be connected to use the following functions
   LEADCap1.SetCapAudioFormat ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD,
                               (short) ltcap14n.tagAudioFormatEnums.FILE_WAV_1M08 );

   // open recording device
   LEADCap1.CapOpenRecord ( (short) 0, (short) 2,
      LEADCap1.GetCapWaveAvgBytesPerSec ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD ) );
   LEADCap1.CapStartRecord ();
}

private void LEADCap1_CapAudioData (Object source, ltcap14n.LEADCap.CapAudioDataEvent e)
{
   // send sound to remote computer (items in SendList property)
   // you should be connected to a remote computer first by using the
   // InetConnect method of the Internet ActiveX
   LEADNet1.InetSendSound( LEADCap1.GetCapWaveFormatTag ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD),
                           LEADCap1.GetCapWaveChannels ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD),
                           LEADCap1.GetCapWaveSamplesPerSec ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD),
                           LEADCap1.GetCapWaveAvgBytesPerSec ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD),
                           LEADCap1.GetCapWaveBlockAlign ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD),
                           LEADCap1.GetCapWaveBitsPerSample ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD),
                           (short) LEADCap1.GetCapWaveExtraSize ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD),
                           LEADCap1.GetCapWaveExtraData ( (short) ltcap14n.tagAudioListConstants.CAP_AUDIO_RECORD),
                           e.pData,
                           e.lBytesRecorded );
   Application.doEvents();
}


InetServerClose Example for Visual J++

private void Form1_closing(Object source, CancelEvent e)
{
   // shutdown server on exit
   LEADNet1.InetServerClose( m_hServer );
}


InetServerInit Example for Visual J++

public Form1()
{
   //.
   // Other lines of code
   //.

   // TODO: Add any constructor code after initForm call

   // initialize port 1000 to wait for connections
   short psServer[] = { 0 };
   LEADNet1.InetServerInit( psServer, (short) 1000 );
   m_hServer = psServer[ 0 ];

   //.
   // Other lines of code
   //.
}


Implementing Internet Functionality

The LEADTOOLS Internet Features provide functionality that allows you to create client server applications that transfer data over the Internet or local intranets.  All of the LEADTOOLS Internet functionality require that a network connection be established.  You can connect to a remote computer using the InetConnect method.  This generates an InetAccept event on the remote computer, indicating that a computer requests a connection.  You can setup a local computer to act as a server and listen for incoming connection requests using the InetServerInit method.  If your application is acting as a server, it can accept connection requests using the InetAcceptConnect method.  This generates an InetConnected event.  A list of the connected computers is maintained in the ConnectList property and the number of connected computers is maintained in the ConnectListNum property.  You can determine the name of the host computer using the InetGetHostName method.

While a network connection is open, you can:

1. transfer data and sound between local and remote computers.

2. send commands and responses between a local and a remote computer.

To disconnect a remote computer, call InetDisconnect method.  This generates an InetDisconnected event on the remote computer.  To shutdown a server started with InetServerInit method, call InetServerClose method.


Transferring Data and Sound

While a network connection is open, you can transfer data between local and remote computers.  To send data, use the InetSendData method.  This generates an InetReceiveData event on the remote computer.  To send a bitmap to a remote computer, call the InetSendBitmap method or InetSendDIB method.  A call to either of these methods generates an InetReceiveBitmap event on the remote computer.  To send sound data, use the InetSendSound method.  This generates an InetReceiveSound event on the remote computer.  During the sending process, data not immediately sent is held in a queue.  As data is removed from the queue and sent to the remote computer, an InetSending event is generated.   Prior to the first InetReceiveData event, an InetReceiveStart event is generated to indicate that a computer is about to start receiving data from a remote computer.  Right after the InetReceiveStart event is generated, an InetReceiving event is generated.  This event is generated for each chunk of data received.  To send data to more than one computer, use the SendList property.  The SendListNum property contains the number of computers in the SendList array.  The InetClearQueue method lets you clear the internal queue and abort data transfers.  To determine the size of the internal queue, use the InetQueueSize property.  Network errors generate an InetError event.


Sending Commands and Responses

LEADTOOLS provides a number of methods and events 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.

When a command is received from a remote computer, the InetReceiveCmd event is triggered locally. The supported command methods include the following:

InetSendCmd method

InetSendLoadCmd method

InetSendSaveCmd method

InetSendCreateWinCmd method

InetSendAttachBitmapCmd method

InetSendSizeWinCmd method

InetSendCloseWinCmd method

InetSendShowWinCmd method

InetSendSetRectCmd method

InetSendFreeBitmapCmd method

InetSendGetMagGlassDataCmd method

The computer that receives the command should then send a response to the computer that sent the command. The supported response methods include the following:

InetSendRsp method

InetSendLoadRsp method

InetSendSaveRsp method

InetSendCreateWinRsp method

InetSendAttachBitmapRsp method

InetSendSizeWinRsp method

InetSendCloseWinRsp method

InetSendShowWinRsp method

InetSendSetRectRsp method

InetSendFreeBitmapRsp method

InetSendGetMagGlassDataRsp method

When a response is received from a remote computer, the InetReceiveRsp event is triggered.

While the InetSendLoadCmd method, the InetSendLoadRsp method, the InetSendSaveCmd method, the InetSendSaveRsp method, etc. provide standard image processing commands and responses, the InetSendCmd method and InetSendRsp method provide a means of creating user-defined commands and responses. 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 methods and events calls used to send commands and responses.

Client	Action	Server
	Set the computer to act as a server and listen for connection requests	InetServerInit method
InetConnect method	-------------------------------------------> The client requests a connection with the server. This generates an InetAccept event on the server.	InetAccept event
InetConnected event	<-------------------------------------------- The server accepts the connection request. This generates an InetConnected event on the client.	InetAcceptConnect method
InetSendLoadCmd method	-------------------------------------------> The client sends a load command to the server to load a specific image. This generates an InetReceiveCmd event on the server.	InetReceiveCmd event
InetReceiveRsp event	<-------------------------------------------- The server receives the load command and responds by calling the InetSendLoadRsp method. This generates an InetReceiveRsp event on the client.	InetSendLoadRsp method
InetSendCmd method	--------------------------------------------> The client sends a flip command using the InetSendCmd method. This generates another InetReceiveCmd event on the server.	InetReceiveCmd event
InetReceiveRsp event	<-------------------------------------------- The server calls the InetSendRsp methodin response to receiving the InetSendCmd method call from the client. This generates another InetReceiveRsp event on the client.	InetSendRsp method
InetSendSaveCmd method	--------------------------------------------> The client sends a save command using the InetSendSaveCmd method. This generates another InetReceiveCmd event on the server.	InetReceiveCmd event
InetReceiveRsp event	<-------------------------------------------- The server calls the InetSendSaveRsp method in response to receiving the InetSendSaveCmd method call from the client. This generates another InetReceiveRsp eventon the client.	InetSendSaveRsp method
InetDisconnect method	-------------------------------------------> The client has finished sending all the commands and closes the connection to the server. This generates an InetDisconnected event on the server.	InetDisconnected event


ConnectList property (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short ConnectList (short iIndex)
Overview	Refer to Implementing Internet Functionality.
Remarks

(Read only) An array of computer handles of current connections.  The connections can result from InetConnect or InetAcceptConnect.

Use this property to keep track of current connections.  Computer handles are automatically added and deleted from this array as connections are made or dropped.

Note:	The ConnectList property contains handles to all computers that are connected, regardless of the server which accepted the connection.  If you wish to keep up with connections on a per server basis, you should use one control per server.
See Also

Elements:	ConnectListNum property, InetConnect method, SendList property
Topics	Internet Features Properties, methods, and events: Internet


iIndex Parameter For ConnectList
iIndex

index into the array.


ConnectListNum property (Inet Control)
ConnnectListNum property (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short ConnectListNum
Overview	Refer to Implementing Internet Functionality.
Remarks

(Read Only) Gets the number of items in the ConnectList array.

See Also

Elements:	ConnectList property, SendList property
Topics	Internet Features Properties, methods, and events: Internet


EnableMethodErrors property (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	long EnableMethodErrors
Overview	Refer to Implementing Internet Functionality.
Remarks

Specifies whether LEADTOOLS generates runtime exceptions (in addition to method return values).  If EnableMethodErrors is TRUE, the runtime exceptions will be generated.  If FALSE, they will not be generated.

See Also

Topics	Internet Features Properties, methods, and events: Internet


InetAccept event (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	void InetAccept (short iServer);
Overview	Refer to Implementing Internet Functionality.
Remarks

Occurs when there is a computer waiting to be connected to a local server.

This event is generated in response to a remote computer requesting a connection.  To connect to a remote computer using the Internet Control, use the InetConnect method.

The InetAcceptConnect method should be called in response to this event in order to accept the connection.

To disconnect the computer after the connection has been accepted, use the InetDisconnect method.

See Also

Elements:	InetConnect method, InetAcceptConnect method, InetDisconnect method
Topics	Internet Features Properties, methods, and events: Internet


iServer Parameter For InetAccept
iServer

handle to the server that is receiving the connect request


InetAcceptConnect method (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short InetAcceptConnect (short iServer, short *piComputer);
Overview	Refer to Implementing Internet Functionality.
Remarks

Accepts a requested connection from a remote computer, on the server specified by iServer.

This method should be called only in response to the InetAccept event.

Before connection events can be generated, the local computer must call InetServerInit to setup a port as a server.

After establishing a connection to a remote computer, you can then send data to the remote computer using the InetSendBitmap, InetSendDIB, InetSendSound and InetSendData methods.  InetReceiveBitmap, InetReceiveData, InetReceiveSound and InetReceiveStart events indicate that data has been received from a remote computer.

The newly created connection is added to the end of the ConnectList property.  ConnectList(ConnectListNum - 1) is the handle of the connection created if InetAcceptConnect is successful.

You can disconnect connected remote computers by using the InetDisconnect method.

See Also

Elements:	InetServerInit method, InetConnect method, InetSendBitmap method, InetSendDIB method, InetSendData method, InetReceiveBitmap event, InetReceiveData event, InetReceiveStart event, InetError event, InetDisconnect method
Topics	Internet Features Properties, methods, and events: Internet


iServer Parameter For InetAcceptConnect
iServer

handle to the server on which to accept the connection.


piComputer Parameter For InetAcceptConnect
piComputer

address of the variable to be updated with the handle to the remote computer.


Return for InetAcceptConnect
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetClearQueue method (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short InetClearQueue (short iComputer);
Overview	Refer to Implementing Internet Functionality.
Remarks

You can use this method to abort data transfers.  This method 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 method you send data using InetSendData, InetSendBitmap, InetSendSound, or InetSendDIB methods, then the remote end will be able to detect that new data is being sent and it will abort the previous download.

See Also

Elements:	InetQueueSize property, InetSendBitmap method, InetSendDIB method, InetSendData method, InetSendSound method
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetClearQueue
iComputer

handle to a remote computer


Return for InetClearQueue
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetConnect method (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short InetConnect (BSTR pszComputer, short iPort);
Overview	Refer to Implementing Internet Functionality.
Remarks

Connects to a remote computer on the specified port.

This method will generate an InetAccept event on the host computer, if the server was initialized using the Internet Control.

After establishing a connection to a remote computer, you can then send data to the remote computer using the InetSendBitmap, InetSendDIB, InetSendSound, and InetSendData methods and receive data using the InetReceiveBitmap, InetReceiveData InetReceiveSound, and InetReceiveStart events.

To setup a computer as a server, you must call the InetServerInit method on the host computer.

You can disconnect from a host computer by using the InetDisconnect method.

See Also

Elements:	InetServerInit method, InetSendBitmap method, InetSendDIB method, InetSendData method, InetReceiveBitmap event, InetReceiveData event, InetReceiveStart event, InetAccept event, InetError event, InetDisconnect method, ConnectList property
Topics	Internet Features Properties, methods, and events: Internet


pszComputer Parameter For InetConnect
pszComputer

Character string containing the name of the remote computer to which you wish to connect.  This may be a URL like www.leadtools.com or an IP address.


iPort Parameter For InetConnect
iPort

the number of the port on the remote computer that is set up as a server.  Possible values are:

Value	Meaning
0x015	FTP
0x050	Web server
0x077	News
0x019	Mail
0x017	Telnet


Return for InetConnect
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetConnected event (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	void InetConnected (short iComputer);
Overview	Refer to Implementing Internet Functionality.
Remarks

Generated when the local computer is successfully connected to a remote computer.

A connection can be made in two ways:

1) setup the local computer as a server and listen for connections using the InetServerInit method.  When connection requests are received, open the connection using the InetAcceptConnect method.

2) connect to an existing server using the InetConnect method.

To disconnect from a remote computer, use the InetDisconnect method

See Also

Elements:	InetServerInit method, InetConnect method, InetAcceptConnect method, InetAccept event, InetDisconnected event, InetError event, InetDisconnect method, ConnectList property
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetConnected
iComputer

handle to the remote computer that has just been connected


InetDataSent event (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	void InetDataSent (short iComputer, long lSize);
Overview	Refer to Implementing Internet Functionality.
Remarks

This event is generated when all data for a specific object, such as a bitmap, has been sent to the remote computer that requested it.

It is possible for InetSendData, InetSendDib, InetSendSound method and InetSendBitmap to return before all data is actually sent to the remote computer.  This event doesn't guarantee that the data got to the other end, it just indicates that all the data was sent.  For example, if you call InetSendBitmap twice, you will get the InetDataSent event twice, once for each object (bitmap).

As data is being sent, the InetSending event will be generated.

See Also

Elements:	InetSendBitmap method, InetSendDIB method, InetSendData method, InetSendSound method, InetSending event
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetDataSent
iComputer

handle to the computer that received the data.


lSize Parameter For InetDataSent
lSize

the total amount of data that was sent to the remote computer.


InetDisconnect method (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short InetDisconnect (short iComputer);
Overview	Refer to Implementing Internet Functionality.
Remarks

Closes an open network connection.

Use this method to disconnect from a remote computer.

See Also

Elements:	InetConnect method, ConnectList property
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetDisconnect
iComputer

handle to the connected computer


Return for InetDisconnect
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetDisconnected event (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	void InetDisconnected (short iComputer);
Overview	Refer to Implementing Internet Functionality.
Remarks

Generated when the local computer is disconnected from a remote computer.

To disconnect from a remote computer, use the InetDisconnect method.

See Also

Elements:	InetServerInit method, InetConnect method, InetAcceptConnect method, InetAccept event, InetDisconnected event, InetError event, InetDisconnect method, ConnectList property
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetDisconnected
iComputer

handle to the remote computer that has just been disconnected


InetError event (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	void InetError (short iComputer, short iMessage, short iError);
Overview	Refer to Implementing Internet Functionality.
Remarks

Generated when a network error has occurred.

Possible network errors are:

Setting	Description
ERROR_HOST_RESOLVE	20270 can't resolve hostname
ERROR_CANT_INITIALIZE	20271 can't initialize network
ERROR_NO_CONNECTION	20272 no open network connections
ERROR_HOST_NOT_FOUND	20273 hostname not found
ERROR_NOT_SERVER	20274 computer is not a server
ERROR_NO_CONNECTIONS	20275 no connection requests waiting
ERROR_CONNECT_REFUSED	20276 connection was refused
ERROR_IS_CONNECTED	20277 computer is connected
ERROR_NET_UNREACH	20278 network is unreachable from host
ERROR_TIME_OUT	20279 connect attempt time out without connecting
ERROR_NET_DOWN	20280 network subsystem is down
ERROR_NO_BUFFERS	20281 no buffer space is available, to many connections
ERROR_NO_FILE_DESCR	20282 no more file handle available
ERROR_DATA_QUEUED	20283 data has been queued to send later
ERROR_UNKNOWN	20284 unknown network error has occurred
ERROR_CONNECT_RESET	20285 connection was reset - socket might be unusable
ERROR_TRANSFER_ABORTED	20286 transfer was aborted
For a complete list of error codes, refer to ErrorCodes.

See Also

Elements:	InetConnect method, InetAcceptConnect method, InetAccept event, InetDisconnect method, InetSendData method, InetSendBitmap method, InetSendDIB method, InetSendSound method
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetError
iComputer

handle to computer that received the error


iMessage Parameter For InetError
iMessage

iMessage is one of the following:

Setting	Description
INET_CONNECT	[0x0000] error occured connecting to remote computer
INET_DATA_READY	[0x0001] internal error - call tech support
INET_CLOSE	[0x0002] error occured closing a connection
INET_CONNECT_REQUEST	[0x0003] error occured while requesting to connect
INET_DATA_SENT	[0x0004] error occured at the end of the send
INET_DATA_SENDING	[0x0005] error occured while sending data
INET_DATA_START	[0x0006] error occured starting to receive data
INET_DATA_RECEIVING	[0x0007] error occured receiving data of unknown type
INET_IMAGE_RECEIVED	[0x0008] error occured receiving an image
INET_MMEDIA_RECEIVED	[0x0009] error occured receiving a Internet object
INET_SOUND_RECEIVED	[0x000A] error occured receiving sound data
INET_USER1_RECEIVED	[0x000B] error occured receiving user data 1
INET_USER2_RECEIVED	[0x000C] error occured receiving user data 2
INET_USER3_RECEIVED	[0x000D] error occured receiving user data 3
INET_USER4_RECEIVED	[0x000E] error occured receiving user data 4


iError Parameter For InetError
iError

error code received


InetGetData method (Inet Control)

Delphi 2.0 example

Syntax	VARIANT InetGetData ();
Overview	Refer to Implementing Internet Functionality.
Remarks

Returns the user defined data sent through an Internet connection.  This method should only be used with Delphi. Delphi doesn't handle the Variant parameters correctly for the InetReceiveData event.  In order to get the data for the pData parameter, use this method.

See Also

Elements:	InetReceiveData event
Topics	Internet Features Properties, methods, and events: Internet


Return for InetGetData
Return Value

Return	Meaning
VARIANT	The extra data associated with a sound format.


InetGetHostName method (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short InetGetHostName (short iComputer, short iType, BSTR *pszHostName);
Overview	Refer to Implementing Internet Functionality.
Remarks

This method retrieves the host name of iComputer (the computer that is connected at the other end).  If iComputer is invalid, this method will generate an error.

See Also

Elements:	InetConnect method, InetConnected event
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetGetHostName
iComputer

handle to a remote computer


iType Parameter For InetGetHostName
iType

type of name to get on the remote computer.  Possible values are:

Value	Meaning
HOST_NAME_DESCP	the descriptive name of the remote computer.
HOST_NAME_IP	the IP address for the remote computer.


pszHostName Parameter For InetGetHostName
pszHostName

address of variable to be updated with host name.


Return for InetGetHostName
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetQueueSize property (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	long InetQueueSize (short iComputer);
Overview	Refer to Implementing Internet Functionality.
Remarks

(Read Only) Returns the size of the internal queue used by the iComputer computer handle. If this property returns 0 for iComputer, then there is no data in the queue. If it returns a value between 1 and 0xFFFFFFFE, then it represents the number of bytes in the queue, not counting any LEADTOOLS headers. If this property return -1, then there is no data but the queue is not empty and consists only of LEADTOOLS' headers used for auto processing data sent and received over the connection.

Note:	Even if this property is 0, there is no guarantee that all bytes have been sent. A zero just means there is no data currently waiting to be sent.
See Also

Elements:	InetClearQueue method, InetSendBitmap method, InetSendDIB method, InetSendData method, InetSendSound method
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetQueueSize
iComputer

handle to a remote computer


Return for InetQueueSize
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetReceiveBitmap event (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	void InetReceiveBitmap (short iComputer, long hBitmap);
Overview	Refer to Implementing Internet Functionality.
Remarks

Generated when an image file has been received over an open network connection.

This event is generated in response to a remote computer calling the InetSendBitmap or InetSendDib methods.

hBitmap should be copied to a Main Control to save the data. It will be freed after this event returns.

Before you can receive data from a remote computer, you must have an open connection.

You can open a connection in two ways:

1) setup the local computer as a server and listen for connections using the InetServerInit method.  When connection requests are received, open the connection using the InetAcceptConnect method.

2) connect to an existing server using the InetConnect method.

Events occur in this order:

- InetReceiveStart event is generated once.

- InetReceiveBitmap event is generated when the image is completely received.

See Also

Elements:	InetServerInit method, InetConnect method, InetAcceptConnect method, InetAccept event, InetSendBitmap method, InetSendDIB method, InetSendData method, InetReceiveData event, InetReceiveStart event, InetError event
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetReceiveBitmap
iComputer

handle to the computer that received the bitmap


hBitmap Parameter For InetReceiveBitmap
hBitmap

handle to the received bitmap


InetReceiveCmd event (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	void InetReceiveCmd (short iComputer, InetCmdType Command, long nCommandID, short nError, ILTInetPacket Params, long nExtraDataSize, VARIANT ExtraData);
Overview	Refer to Sending Commands and Responses
Remarks

Occurs when a computer receives a command request from a remote computer.

See Also

Elements:	InetReceiveRsp event, InetSendCmd method, InetSendLoadCmd method, InetSendSaveCmd method, InetSendCreateWinCmd method, InetSendAttachBitmapCmd method, InetSendSizeWinCmd method, InetSendCloseWinCmd method, InetSendShowWinCmd method, InetSendSetRectCmd method, InetSendFreeBitmapCmd method, InetSendGetMagGlassDataCmd method, InetSendGetMagGlassDataRsp method


iComputer Parameter For InetReceiveCmd
iComputer

Handle to the remote computer that sent the command.


Command Parameter For InetReceiveCmd
Command

Command received from the remote computer. For a list of possible values, refer to InetCmdType.


nCommandID Parameter For InetReceiveCmd
nCommandID

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 Parameter For InetReceiveCmd
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).


Params Parameter For InetReceiveCmd
Params

Contains the parameter data sent with the command.


nExtraDataSize Parameter For InetReceiveCmd
nExtraDataSize

Size of any extra data sent with the command. Unused if ExtraData is NULL.


ExtraData Parameter For InetReceiveCmd
ExtraData

Extra data sent with the command.


InetReceiveData event (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	void InetReceiveData (short iComputer, VARIANT pData, long lSize, short iType);
Overview	Refer to Implementing Internet Functionality.
Remarks

Generated when data has been completely received over an open network connection.

This event is generated in response to a remote computer calling the InetSendData method.

This event occurs after the last chunk of data has been received and the InetReceiving event has been generated for the last chunk in the transfer.

Before you can receive data from a remote computer, you must have an open connection.

You can open a connection in two ways:

1) setup the local computer as a server and listen for connections using the InetServerInit method.  When connection requests are received, open the connection using the InetAcceptConnect method.

2) connect to an existing server using the InetConnect method.

Events occur in this order:

the InetReceiveStart event is generated once.

the InetReceiving event is generated once for each chunk of data.

the InetReceiveData event is generated when the last chunk of data has been received.

Note: For Delphi, you must use the InetGetData method instead of the pData parameter.  This method is only valid during the InetReceiveData event.

See Also

Elements:	InetServerInit method, InetConnect method, InetAcceptConnect method, InetAccept event, InetSendBitmap method, InetSendDIB method, InetSendData method, InetReceiveBitmap event, InetReceiveStart event, InetError event
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetReceiveData
iComputer

handle to the computer that received the data


pData Parameter For InetReceiveData
pData

variant containing the received data


lSize Parameter For InetReceiveData
lSize

the size of the data buffer


iType Parameter For InetReceiveData
iType

type of data being received.  Possible values are:

Value	Meaning
IDATA_USER1	user defined data 1
IDATA_USER2	user defined data 2
IDATA_USER3	user defined data 3
IDATA_USER4	user defined data 4


InetReceiveRsp event (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	void InetReceiveRsp (short iComputer, InetCmdType Command, long nCommandID, short nError, short nStatus, ILTInetPacket Params, long nExtraDataSize, VARIANT* ExtraData);
Overview	Refer to Sending Commands and Responses
Remarks

Occurs when a computer receives a response from a remote computer.

Note: The parameters (Params) and the extra data (ExtraData) 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 ExtraData are only valid during this call. Do not free this data and don’t try to keep references to the strings. If the data is needed outside this event, allocate buffers and copy the data into them.

See Also

Elements:	InetReceiveCmd event, InetSendRsp method, InetSendLoadRsp method, InetSendSaveRsp method, InetSendCreateWinRsp method, InetSendAttachBitmapRsp method, InetSendSizeWinRsp method, InetSendCloseWinRsp method, InetSendShowWinRsp method, InetSendSetRectRsp method, InetSendFreeBitmapRsp method, InetSendGetMagGlassDataCmd method, InetSendGetMagGlassDataRsp method
Topics:	A Client-Server Diagram: Sending Commands and Responses


iComputer Parameter For InetReceiveRsp
iComputer

Handle to the remote computer that sent this response.


Command Parameter For InetReceiveRsp
Command

The command type which prompted this response. For a list of possible values, refer to InetCmdType.


nCommandID Parameter For InetReceiveRsp
nCommandID

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 Parameter For InetReceiveRsp
nError

Indicates whether the response 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 Parameter For InetReceiveRsp
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.


Params Parameter For InetReceiveRsp
Params

Contains the parameter data sent with the response.


nExtraDataSize Parameter For InetReceiveRsp
nExtraDataSize

Size of any extra data sent with the response.


ExtraData Parameter For InetReceiveRsp
ExtraData

Extra data sent with the response.


InetReceiveSound event (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	void InetReceiveSound (short iComputer, short iFormatTag, short iChannels, long lSamplesPerSec, long lAvgBytesPerSec, short iBlockAlign, short iBitsPerSample, short iExtraDataSize, VARIANT pExtraData, VARIANT pData, long lDataSize);
Overview	Refer to Implementing Internet Functionality.
Remarks

This event is triggered when wave data is received by iComputer.  It is generated in response to a remote computer calling the InetSendSound method.  The following parameters can be used to update the sound format:

iFormatTag, iChannels, lSamplesPerSec, AvgBytesPerSec, iBlockAlign, iBitsPerSample, iExtraDataSize, pExtraData.  pData is the actual sound data that is received. Sound data can be sent to a remote computer by using the InetSendSound method.

Events occur in this order:

- InetReceiveStart is generated once.

- InetReceiveSound is generated when sound is completely received.

See Also

Elements:	InetSendSound method, InetServerInit method, InetConnect method, InetAcceptConnect method, InetAccept event, InetReceiveStart event, InetError event
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetReceiveSound
iComputer

handle to computer receiving the sound.


iFormatTag Parameter For InetReceiveSound
iFormatTag

value indicating the format of the audio data


iChannels Parameter For InetReceiveSound
iChannels

value indicating the number of channels.


lSamplesPerSec Parameter For InetReceiveSound
lSamplesPerSec

value indicating the sample rate.


lAvgBytesPerSec Parameter For InetReceiveSound
lAvgBytesPerSec

variable used for internal buffer estimation.


iBlockAlign Parameter For InetReceiveSound
iBlockAlign

value indicating the block size of the data.


iBitsPerSample Parameter For InetReceiveSound
iBitsPerSample

value indicating the number of bits per sample.


iExtraDataSize Parameter For InetReceiveSound
iExtraDataSize

value indicating the size of the extra data.


pExtraData Parameter For InetReceiveSound
pExtraData

variant array of bytes that holds the extra data.


pData Parameter For InetReceiveSound
pData

variant array of bytes of the actual sound data.


lDataSize Parameter For InetReceiveSound
lDataSize

value indicating the amount of actual sound data.


InetReceiveStart event (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	void InetReceiveStart (short iComputer, long lSize);
Overview	Refer to Implementing Internet Functionality.
Remarks

Generated when a computer is about to start receiving data from a remote computer.

This event is generated in response to a remote computer calling the InetSendData, InetSendBitmap, InetSendSound or InetSendDIB methods.

The data will be received in the InetReceiveData event.

Before you can receive data from a remote computer, you must have an open connection.

You can open a connection in two ways:

1) setup the local computer as a server and listen for connections using the InetServerInit method.  When connection requests are received, open the connection using the InetAcceptConnect method.

2) connect to an existing server using the InetConnect method.

Events occur in this order:

- InetReceiveStart is generated once.

- InetReceiving is generated for each chunk, if InetSendData was used by the remote computer.

- InetReceiveBitmap, InetReceiveSound, or InetReceiveData is generated when all data has been received.

If an error occurs during downloading, an InetError event is generated.

See Also

Elements:	InetServerInit method, InetConnect method, InetAcceptConnect method, InetAccept event, InetSendBitmap method, InetSendDIB method, InetSendData method, InetSendSound method, InetReceiveData event, InetReceiveBitmap event, InetError event
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetReceiveStart
iComputer

handle to computer which is about to receive data


lSize Parameter For InetReceiveStart
lSize

total size of the data that will be received


InetReceiving event (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	void InetReceiving (short iComputer, long lSize);
Overview	Refer to Implementing Internet Functionality.
Remarks

Generated when a computer is receiving data from a remote computer.  This event is generated for each chunk of data received.  It is generated after the InetReceiveStart event.

This event is generated in response to a remote computer calling the InetSendData method.

The data will be received in the InetReceiveData event.

Before you can receive data from a remote computer, you must have an open connection.

You can open a connection in two ways:

1) setup the local computer as a server and listen for connections using the InetServerInit method.  When connection requests are received, open the connection using the InetAcceptConnect method.

2) connect to an existing server using the InetConnect method.

See Also

Elements:	InetServerInit method, InetConnect method, InetAcceptConnect method, InetAccept event, InetSendBitmap method, InetSendDIB method, InetSendData method, InetReceiveData event, InetReceiveBitmap event, InetError event
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetReceiving
iComputer

handle to computer which is about to receive data


lSize Parameter For InetReceiving
lSize

total size of the data that will be received


InetSendAttachBitmapCmd method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendAttachBitmapCmd (long nCommandID, long nBitmapID, long nWindowID);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends an attach bitmap command to a remote computer.

The remote computer should respond by calling the InetSendAttachBitmapRsp method in its InetReceiveCmd event.

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 the InetSendSetRectCmd method.

The InetReceiveCmd event will receive the nBitmapID and nWindowID information in the Params parameter. The nBitmapID information will be in Params.ParamValue(0) and the nWindowID information will be in Params.ParamValue(1).

When a response is received from a remote computer, the InetReceiveRsp event is triggered.

See Also

Elements:	InetSendAttachBitmapRsp method, InetReceiveRsp event, InetReceiveCmd event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendAttachBitmapCmd
nCommandID

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.


nBitmapID Parameter For InetSendAttachBitmapCmd
nBitmapID

The ID of the bitmap being attached. If the bitmap is successfully attached, then this bitmap will be painted whenever the window paints itself.


nWindowID Parameter For InetSendAttachBitmapCmd
nWindowID

The id of the window that was just created.


Return for InetSendAttachBitmapCmd
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendAttachBitmapRsp method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendAttachBitmapRsp (long nCommandID, long nExtraDataSize, VARIANT* ExtraData, short nStatus);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends an attach bitmap response to a remote computer.

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

When a command request is received from a remote computer, the InetReceiveCmd event is triggered.

See Also

Elements:	InetSendAttachBitmapCmd method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendAttachBitmapRsp
nCommandID

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.


nExtraDataSize Parameter For InetSendAttachBitmapRsp
nExtraDataSize

Size of any extra data to send with the response. Unused if ExtraData is NULL.


ExtraData Parameter For InetSendAttachBitmapRsp
ExtraData

Extra data to send with the response. Pass NULL if the response does not need to pass any extra data.


nStatus Parameter For InetSendAttachBitmapRsp
nStatus

Status of the original command. If the command completes successfully, this should be 0. Otherwise, it should be one of the Error Codes.


Return for InetSendAttachBitmapRsp
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendBitmap method (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short InetSendBitmap (long hBitmap, short iFormat, short iBitsPerPixel, short iQuality);
Overview	Refer to Implementing Internet Functionality.
Remarks

Sends a bitmap to all the remote computers in the SendList and generates an InetReceiveBitmap event on the remote computer(s).

The bitmap is first saved as a file in memory in the format specified by iFormat.  If you require additional options when saving a file (such as Progressive JPEG, Interlaced GIF, etc.) then you should use the SaveMemory method in the Main Control.  You can then send the image using InetSendData, with iType set to IDATA_IMAGE.

This means you can send files in any of the supported compressed or uncompressed formats.

Before you can send data to a remote computer, you must have an open connection.

You can open a connection in two ways:

1) setup the local computer as a server and listen for connections using the InetServerInit method.  When connection requests are received, open the connection using the InetAcceptConnect method.

2) connect to an existing server using the InetConnect method.

See Also

Elements:	InetServerInit method, InetConnect method, InetAcceptConnect method, InetAccept event, InetSendDIB method, InetSendData method, InetReceiveBitmap event, InetReceiveData event, InetReceiveStart event, InetError event, SendList property, InetSendSound method, InetReceiveSound event
Topics	Internet Features Properties, methods, and events: Internet


hBitmap Parameter For InetSendBitmap
hBitmap

The Main Control's bitmap to send to the remote computer.


iFormat Parameter For InetSendBitmap
iFormat

Output file format. For valid values, refer to Formats of Output Files.


iBitsPerPixel Parameter For InetSendBitmap
iBitsPerPixel

Resulting file's pixel depth.

The output file pixel depth. Note that not all bits per pixel are available to all file formats.  Support for 12 and 16-bit grayscale  images is available only in the Document/Medical toolkits.  For valid values, refer to Formats of Output Files.


iQuality Parameter For InetSendBitmap
iQuality

This parameter is used when saving an image file to LEAD or JPEG formats. Qfactor is a number that determines the degree of loss in the compression process.

For possible values, refer to Compression Quality Factors.


Return for InetSendBitmap
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendCloseWinCmd method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendCloseWinCmd (long nCommandID, long nWindowID);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a close window command to a remote computer.

The remote computer should respond by calling the InetSendCloseWinRsp method in its InetReceiveCmd event.

The InetReceiveCmd event will receive the nWindowID information in the Params parameter. The nWindowID information will be in Params.ParamValue(0).

When a response is received from a remote computer, the InetReceiveRsp event is triggered.

See Also

Elements:	InetSendCloseWinRsp method, InetReceiveRsp event, InetReceiveCmd event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendCloseWinCmd
nCommandID

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.


nWindowID Parameter For InetSendCloseWinCmd
nWindowID

The id of the window to close.


Return for InetSendCloseWinCmd
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendCloseWinRsp method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendCloseWinRsp (long nCommandID, long _nExtraDataSize, VARIANT* ExtraData, short nStatus);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a close window response to a remote computer.

This method sends a response to a command that was sent from a remote computer using the InetSendCloseWinCmd method.

When a command request is received from a remote computer, the InetReceiveCmd event is triggered.

See Also

Elements:	InetSendCloseWinCmd method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendCloseWinRsp
nCommandID

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.


nExtraDataSize Parameter For InetSendCloseWinRsp
nExtraDataSize

Size of any extra data to send with the response. Unused if ExtraData is NULL.


ExtraData Parameter For InetSendCloseWinRsp
ExtraData

Extra data to send with the response. Pass NULL if the response does not need to pass any extra data.


nStatus Parameter For InetSendCloseWinRsp
nStatus

Status of the original command. If the command completes successfully, this should be 0. Otherwise, it should be one of the Error Codes.


Return for InetSendCloseWinRsp
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendCmd method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendCmd (InetCmdType Command, long nCommandID, ILTInetPacket Params, long nExtraDataSize, VARIANT ExtraData);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a command to a remote computer.

The remote computer should respond by calling the InetSendRsp method in its InetReceiveCmd event.

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 the InetSendLoadCmd method will send the bitmap ID while responses to the InetSendCreateWinCmd method will send the window identifier (which can be used to resize or close the window).

When a response is received from a remote computer, the InetReceiveRsp event is triggered.

See Also

Elements:	InetSendRsp method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


Command Parameter For InetSendCmd
Command

The command to send. For a list of possible values, refer to InetCmdType.


nCommandID Parameter For InetSendCmd
nCommandID

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.


Params Parameter For InetSendCmd
Params

ILTInetPacket that contains parameter data to send with the command. For information about the information included in this parameter, refer to ILTInetPacket.


nExtraDataSize Parameter For InetSendCmd
nExtraDataSize

Size of any extra data to send with the command. Unused if ExtraData is NULL.


ExtraData Parameter For InetSendCmd
ExtraData

Extra data to send with the command. Pass NULL if the command does not need to pass any extra data.


Return for InetSendCmd
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendCreateWinCmd method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendCreateWinCmd (long nCommandID, BSTR pszClassName, BSTR pszWindowName, long ulFlags, long nLeft, long nTop, long nWidth, long nHeight, long nParentID);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a create win command to a remote computer.

The remote computer should respond by calling the InetSendCreateWinRsp method in its InetReceiveCmd event.

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.

When a response is received from a remote computer, the InetReceiveRsp event is triggered.

The InetReceiveCmd event will receive the pszClassName, pszWindowName, ulFlags, nLeft, nTop, nWidth, nHeight and nParentID information in the Params parameter. The pszClassName information will be in Params.ParamValue(0). The pszWindowName information will be in Params.ParamValue(1), the ulFlags information will be in Params.ParamValue(2), and so forth.

See Also

Elements:	InetSendCreateWinRsp method, InetReceiveRsp event, InetReceiveCmd event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendCreateWinCmd
nCommandID

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 Parameter For InetSendCreateWinCmd
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 Parameter For InetSendCreateWinCmd
pszWindowName

Character string containing the name of the window. This parameter can be an empty string ("").


ulFlags Parameter For InetSendCreateWinCmd
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 Parameter For InetSendCreateWinCmd
nLeft

X coordinate for the origin of the window to create.


nTop Parameter For InetSendCreateWinCmd
nTop

Y coordinate for the origin of the window to create.


nWidth Parameter For InetSendCreateWinCmd
nWidth

Requested width of the window's client area.


nHeight Parameter For InetSendCreateWinCmd
nHeight

Requested height of the window's client area.


nParentID Parameter For InetSendCreateWinCmd
nParentID

Id of the parent or owner window of the window being created.


Return for InetSendCreateWinCmd
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendCreateWinRsp method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendCreateWinRsp (long nCommandID, long nWindowID, long nExtraDataSize, VARIANT* ExtraData, short nStatus);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a create window response to a remote computer.

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

When a command request is received from a remote computer, the InetReceiveCmdevent evet is triggered.

The InetReceiveRsp event will receive the nWindowID information in the Params parameter. The nWindowID information will be in Params.ParamValue(0).

See Also

Elements:	InetSendCreateWinCmd method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendCreateWinRsp
nCommandID

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.


nWindowID Parameter For InetSendCreateWinRsp
nWindowID

The id of the window that was just created.  This id should be unique for each create request.


nExtraDataSize Parameter For InetSendCreateWinRsp
nExtraDataSize

Size of any extra data to send with the response. Unused if ExtraData is NULL.


ExtraData Parameter For InetSendCreateWinRsp
ExtraData

Extra data to send with the response. Pass NULL if the response does not need to pass any extra data.


nStatus Parameter For InetSendCreateWinRsp
nStatus

Status of the original command. If the command completes successfully, this should be 0. Otherwise, it should be one of the Error Codes.


Return for InetSendCreateWinRsp
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendData method (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short InetSendData (VARIANT *pData, long lSize, short iType);
Overview	Refer to Implementing Internet Functionality.
Remarks

Sends the specified number of bytes to all the remote computers in the SendList and generates an InetReceiveData event on the remote computer(s).

Fill pData with the data you wish to send before calling this method.  The data should be specified in a byte array.

Before you can send data to a remote computer, you must have an open connection.

You can open a connection in two ways:

1) setup the local computer as a server and listen for connections using the InetServerInit method.  When connection requests are received, open the connection using the InetAcceptConnect method.

2) connect to an existing server using the InetConnect method.

See Also

Elements:	InetServerInit method, InetConnect method, InetAcceptConnect method, InetAccept event, InetSendBitmap method, InetSendDIB method, InetReceiveBitmap event, InetReceiveData event, InetReceiveStart event, InetError event, SendList property, InetSendSound method, InetReceiveSound event, InetReceiving event
Topics	Internet Features Properties, methods, and events: Internet


pData Parameter For InetSendData
pData

pointer to the data to be sent to the remote computer. The data should be in a byte array.


lSize Parameter For InetSendData
lSize

the size in bytes of the data buffer


iType Parameter For InetSendData
iType

type of data to send to the remote computer.  Possible values are:

Value	Meaning
INETDATA_IMAGE	send an image; you would use this parameter if you have raw data for an image, if you have a DIB use the InetSendDib method instead, use InetSendBitmap method if you have the bitmap property from the LEADTOOLS main ActiveX control
INETDATA_MMEDIA	Internet object
INETDATA_USER1	user defined data 1
INETDATA_USER2	user defined data 2
INETDATA_USER3	user defined data 3
INETDATA_USER4	user defined data 4


Return for InetSendData
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendDIB method (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short InetSendDIB (long hDib, short iFormat, short iBitsPerPixel, short iQuality);
Overview	Refer to Implementing Internet Functionality.
Remarks

Sends a Windows device independent bitmap (DIB) to all the remote computers in the SendList and generates an InetReceiveBitmap event on the remote computer(s).

The DIB is first saved as a file in memory in the format specified by iFormat.

This means you can send files in any of the supported compressed or uncompressed formats.

Before you can send data to a remote computer, you must have an open connection.

You can open a connection in two ways:

1) setup the local computer as a server and listen for connections using the InetServerInit method.  When connection requests are received, open the connection using the InetAcceptConnect method.

2) connect to an existing server using the InetConnect method.

See Also

Elements:	InetServerInit method, InetConnect method, InetAcceptConnect method, InetAccept event, InetSendBitmap method, InetSendData method, InetReceiveBitmap event, InetReceiveData event, InetReceiveStart event, InetError event, SendList property, InetSendSound method, InetReceiveSound event
Topics	Internet Features Properties, methods, and events: Internet


hDib Parameter For InetSendDIB
hDib

handle to the Windows device independent bitmap to send


iFormat Parameter For InetSendDIB
iFormat

Output file format. For valid values, refer to Formats of Output Files.


iBitsPerPixel Parameter For InetSendDIB
iBitsPerPixel

Resulting file's pixel depth.

The output file pixel depth. Note that not all bits per pixel are available to all file formats.  Support for 12 and 16-bit grayscale  images is available only in the Document/Medical toolkits.  For valid values, refer to Formats of Output Files.


iQuality Parameter For InetSendDIB
iQuality

This parameter is used when saving an image file to LEAD or JPEG formats. Qfactor is a number that determines the degree of loss in the compression process.

For possible values, refer to Compression Quality Factors.

This method can be used in any ControlMode.


Return for InetSendDIB
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendFreeBitmapCmd method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendFreeBitmapCmd (long nCommandID, long nBitmapID);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a free bitmap command to a remote computer.

The remote computer should free the bitmap associated with nBitmapID and respond by calling the InetSendFreeBitmapRsp method in its InetReceiveCmd event.

The InetReceiveCmd event will receive the nBitmapID information in the Params parameter. The nBitmapID information will be in Params.ParamValue(0).

When a response is received from a remote computer, the InetReceiveRsp event is triggered.

See Also

Elements:	InetSendFreeBitmapRsp method, InetReceiveRsp event, InetReceiveCmd event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendFreeBitmapCmd
nCommandID

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.


nBitmapID Parameter For InetSendFreeBitmapCmd
nBitmapID

The ID of the bitmap that should be freed.


Return for InetSendFreeBitmapCmd
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendFreeBitmapRsp method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendFreeBitmapRsp (long nCommandID, long nExtraDataSize, VARIANT* ExtraData, short nStatus);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a free bitmap response to a remote computer.

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

When a command request is received from a remote computer, the InetReceiveCmd event is triggered.

See Also

Elements:	InetSendFreeBitmapCmd method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendFreeBitmapRsp
nCommandID

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.


nExtraDataSize Parameter For InetSendFreeBitmapRsp
nExtraDataSize

Size of any extra data to send with the response. Unused if ExtraData is NULL.


ExtraData Parameter For InetSendFreeBitmapRsp
ExtraData

Extra data to send with the response. Pass NULL if the response does not need to pass any extra data.


nStatus Parameter For InetSendFreeBitmapRsp
nStatus

Status of the original command. If the command completes successfully, this should be 0. Otherwise, it should be one of the Error Codes.


Return for InetSendFreeBitmapRsp
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSending event (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	void InetSending (short iComputer, long lSize);
Overview	Refer to Implementing Internet Functionality.
Remarks

This event is generated as data is moved out of an internal queue and sent to iComputer.

It is possible for InetSendData, InetSendDIB, InetSendSound and InetSendBitmap to return before all data is actually sent to the remote computer. Any data that isn't immediately sent, will be queued to send later.  This event informs you when data is taken from the queue and sent to the remote computer.

When all data has been sent, the InetDataSent event will be generated.

See Also

Elements:	InetSendBitmap method, InetSendDIB method, InetSendData method, InetSendSound method, InetDataSent event
Topics	Internet Features Properties, methods, and events: Internet


iComputer Parameter For InetSending
iComputer

handle to the computer that is receiving the data.


lSize Parameter For InetSending
lSize

amount of data that was sent to the remote computer.


InetSendLoadCmd method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendLoadCmd (long nCommandID, BSTR pszFile, short nBitsPerPixel, short nOrder);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a load command to a remote computer.

The remote computer should respond by calling the InetSendLoadRsp method in its InetReceiveCmd event.

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 the InetSendAttachBitmapCmd method). The bitmap identifier will be sent in the response.

When a response is received from a remote computer, the InetReceiveRsp event is triggered.

The InetReceiveCmd event will receive the pszFile, nBitsPerPixel and nOrder information in the Params parameter. The pszFile information will be in Params.ParamValue(0). The nBitsPerPixel information will be in Params.ParamValue(1), and so forth.

See Also

Elements:	InetSendLoadRsp method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendLoadCmd
nCommandID

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 Parameter For InetSendLoadCmd
pszFile

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 Parameter For InetSendLoadCmd
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 Parameter For InetSendLoadCmd
nOrder

Color order for 16-, 24-, `-, 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 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 toolkits 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 toolkits only.


Return for InetSendLoadCmd
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendLoadRsp method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendLoadRsp (long nCommandID, long nBitmapID, long nExtraDataSize, VARIANT* ExtraData, short nStatus);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a load response to a remote computer.

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

When a command request is received from a remote computer, the InetReceiveCmd event is triggered.

The InetReceiveRsp event will receive the nBitmapID information in the Params parameter. The nBitmapID information will be in Params.ParamValue(0).

See Also

Elements:	InetSendLoadCmd method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendLoadRsp
nCommandID

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.


nBitmapID Parameter For InetSendLoadRsp
nBitmapID

The id of the bitmap that was loaded.  This id should be unique for each load request.


nExtraDataSize Parameter For InetSendLoadRsp
nExtraDataSize

Size of any extra data to send with the response. Unused if ExtraData is NULL.


ExtraData Parameter For InetSendLoadRsp
ExtraData

Extra data to send with the response. Pass NULL if the response does not need to pass any extra data.


nStatus Parameter For InetSendLoadRsp
nStatus

Status of the original command. If the command completes successfully, this should be 0. Otherwise, it should be one of the Error Codes.


Return for InetSendLoadRsp
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendRsp method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendRsp (InetCmdType Command, long nCommandID, ILTInetPacket Params, long nExtraDataSize, VARIANT* ExtraData, short nStatus);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a response to a remote computer.

This method sends a response to a command that was sent from a remote computer using the InetSendCmd method.

When a command request is received from a remote computer, the InetReceiveCmd event is triggered.

See Also

Elements:	InetSendCmd method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


Command Parameter For InetSendRsp
Command

The command type which prompted this response. For a list of possible values, refer to InetCmdType.


nCommandID Parameter For InetSendRsp
nCommandID

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.


Params Parameter For InetSendRsp
Params

ILTInetPacket that contains parameter data to send with the command. For information about the information included in this parameter, refer to ILTInetPacket. You can pass NULL if the only parameter needed is nStatus.


nExtraDataSize Parameter For InetSendRsp
nExtraDataSize

Size of any extra data to send with the response. Unused if ExtraData is NULL.


ExtraData Parameter For InetSendRsp
ExtraData

Extra data to send with the response. Pass NULL if the response does not need to pass any extra data.


nStatus Parameter For InetSendRsp
nStatus

Status of the original command. If the command completes successfully, this should be 0. Otherwise, it should be one of the Error Codes.


Return for InetSendRsp
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendSaveCmd method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendSaveCmd (long nCommandID, long nBitmapID, BSTR pszFile, short nFormat, short nBitsPerPixel, short nQFactor, VARIANT_BOOL bSaveMulti);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a save command to a remote computer.

The remote computer should respond by calling the InetSendSaveRsp method in its InetReceiveCmd event.

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

When a response is received from a remote computer, the InetReceiveRsp event is triggered.

The InetReceiveCmd event will receive the nBitmapID, pszFile, nFormat, nBitsPerPixel, nQFactor and bSaveMulti information in the Params parameter. The nBitmapID information will be in Params.ParamValue(0). The pszFile information will be in Params.ParamValue(1), the nFormat information will be in Params.ParamValue(2), and so forth.

See Also

Elements:	InetSendSaveRsp method, InetReceiveRsp event, InetReceiveCmd event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendSaveCmd
nCommandID

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.


nBitmapID Parameter For InetSendSaveCmd
nBitmapID

Id of the bitmap to save.


pszFile Parameter For InetSendSaveCmd
pszFile

String containing the name of the image file to save.


nFormat Parameter For InetSendSaveCmd
nFormat

Output file format. For valid values, refer to Formats of Output Files.


nBitsPerPixel Parameter For InetSendSaveCmd
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 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 Parameter For InetSendSaveCmd
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.


bSaveMulti Parameter For InetSendSaveCmd
bSaveMulti

Flag that indicates how to save a file as a multi-page file. Possible values are:

Value	Meaning
SAVE_OVERWRITE	[0x0000] Overwrite the file.
SAVE_APPEND	[0x0001] Append to the end of the file.
SAVE_REPLACE	[0x0002] Replace a page.
SAVE_INSERT	[0x0003] Insert a page.


Return for InetSendSaveCmd
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendSaveRsp method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendSaveRsp (long nCommandID, long nExtraDataSize, VARIANT* ExtraData, short nStatus);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a save response to a remote computer.

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

When a command request is received from a remote computer, the InetReceiveCmd event is triggered.

See Also

Elements:	InetSendSaveCmd method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendSaveRsp
nCommandID

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.


nExtraDataSize Parameter For InetSendSaveRsp
nExtraDataSize

Size of any extra data to send with the response. Unused if ExtraData is NULL.


ExtraData Parameter For InetSendSaveRsp
ExtraData

Extra data to send with the response. Pass NULL if the response does not need to pass any extra data.


nStatus Parameter For InetSendSaveRsp
nStatus

Status of the original command. If the command completes successfully, this should be 0. Otherwise, it should be one of the Error Codes.


Return for InetSendSaveRsp
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendSetRectCmd method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendSetRectCmd (long nCommandID, long nWindowID, DisplayRectType RectType, long nLeft, long nTop, long nWidth, long nHeight);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a set rectangle command to a remote computer.

The remote computer should respond by calling the InetSendSetRectRsp method in its InetReceiveCmd event.

The InetReceiveCmd event will receive the nWindowID, RectType, nLeft, nTop, nWidth and nHeight information in the Params parameter. The nWindowID information will be in Params.ParamValue(0). The DisplayRectType information will be in Params.ParamValue(1), and so forth.

When a response is received from a remote computer, the InetReceiveRsp event is triggered.

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

See Also

Elements:	InetSendSetRectRsp method, InetReceiveRsp event, InetReceiveCmd event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendSetRectCmd
nCommandID

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.


nWindowID Parameter For InetSendSetRectCmd
nWindowID

The id of the window to receive the command.


RectType Parameter For InetSendSetRectCmd
RectType

Type of rectangle to set. For possible values, refer to DisplayRectType.


nLeft Parameter For InetSendSetRectCmd
nLeft

X coordinate of the origin of the display rectangle.


nTop Parameter For InetSendSetRectCmd
nTop

Y coordinate of the origin of the display rectangle.


nWidth Parameter For InetSendSetRectCmd
nWidth

Width of the display rectangle.


nHeight Parameter For InetSendSetRectCmd
nHeight

Height of the display rectangle.


Return for InetSendSetRectCmd
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendSetRectRsp method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendSetRectRsp (long nCommandID, long nExtraDataSize, VARIANT* ExtraData, short nStatus);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a set rectangle response to a remote computer.

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

When a command request is received from a remote computer, the InetReceiveCmd event is triggered.

See Also

Elements:	InetSendSetRectCmd method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendSetRectRsp
nCommandID

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.


nExtraDataSize Parameter For InetSendSetRectRsp
nExtraDataSize

Size of any extra data to send with the response. Unused if ExtraData is NULL.


ExtraData Parameter For InetSendSetRectRsp
ExtraData

Extra data to send with the response. Pass NULL if the response does not need to pass any extra data.


nStatus Parameter For InetSendSetRectRsp
nStatus

Status of the original command. If the command completes successfully, this should be 0. Otherwise, it should be one of the Error Codes.


Return for InetSendSetRectRsp
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendShowWinCmd method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendShowWinCmd (long nCommandID, long nWindowID, long nCmdShow);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a show window command to a remote computer.

The remote computer should respond by calling the InetSendShowWinRsp method in its InetReceiveCmd event.

The InetReceiveCmd event will receive the nWindowID and the nCmdShow information in the Params parameter. The nWindowID information will be in Params.ParamValue(0) and the nCmdShow information will be in Params.ParamValue(1).

When a response is received from a remote computer, the InetReceiveRsp event is triggered.

See Also

Elements:	InetSendShowWinRsp method, InetReceiveRsp event, InetReceiveCmd event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendShowWinCmd
nCommandID

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.


nWindowID Parameter For InetSendShowWinCmd
nWindowID

The id of the window to show.


nCmdShow Parameter For InetSendShowWinCmd
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.


Return for InetSendShowWinCmd
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendShowWinRsp method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendShowWinRsp (long nCommandID, long nExtraDataSize, VARIANT* ExtraData, short nStatus);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a show window response to a remote computer.

This method sends a response to a show window command that was sent from a remote computer using the InetSendShowWinCmd method.

When a command request is received from a remote computer, the InetReceiveCmd event is triggered.

See Also

Elements:	InetSendShowWinCmd method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendShowWinRsp
nCommandID

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.


nExtraDataSize Parameter For InetSendShowWinRsp
nExtraDataSize

Size of any extra data to send with the response. Unused if ExtraData is NULL.


ExtraData Parameter For InetSendShowWinRsp
ExtraData

Extra data to send with the response. Pass NULL if the response does not need to pass any extra data.


nStatus Parameter For InetSendShowWinRsp
nStatus

Status of the original command. If the command completes successfully, this should be 0. Otherwise, it should be one of the Error Codes.


Return for InetSendShowWinRsp
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendSizeWinCmd method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendSizeWinCmd (long nCommandID, long nWindowID, long nLeft, long nTop, long nWidth, long nHeight);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a size window command to a remote computer.

The remote computer should respond by calling the InetSendSizeWinRsp method in its InetReceiveCmd event.

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

When a response is received from a remote computer, the InetReceiveRsp event is triggered.

The InetReceiveCmd event will receive the nWindowID, nLeft, nTop, nWidth and nHeight information in the Params parameter. The nWindowID information will be in Params.ParamValue(0). The nLeft information will be in Params.ParamValue(1), and so forth.

See Also

Elements:	InetSendSizeWinRsp method, InetReceiveRsp event, InetReceiveCmd event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendSizeWinCmd
nCommandID

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.


nWindowID Parameter For InetSendSizeWinCmd
nWindowID

The id of the window to size.  This id should be unique for each window.


nLeft Parameter For InetSendSizeWinCmd
nLeft

X coordinate of the new origin of the window.


nTop Parameter For InetSendSizeWinCmd
nTop

Y coordinate of the new origin of the window.


nWidth Parameter For InetSendSizeWinCmd
nWidth

New width of window.


nHeight Parameter For InetSendSizeWinCmd
nHeight

New height of window.


Return for InetSendSizeWinCmd
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendSizeWinRsp method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendSizeWinRsp (long nCommandID, long nExtraDataSize, VARIANT* ExtraData, short nStatus);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a size window response to a remote computer.

This method sends a response to a size window command that was sent from a remote computer using the InetSendSizeWinCmd method.

When a command request is received from a remote computer, the InetReceiveCmd event is triggered.

See Also

Elements:	InetSendSizeWinCmd method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendSizeWinRsp
nCommandID

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.


nExtraDataSize Parameter For InetSendSizeWinRsp
nExtraDataSize

Size of any extra data to send with the response. Unused if ExtraData is NULL.


ExtraData Parameter For InetSendSizeWinRsp
ExtraData

Size of any extra data to send with the response. Unused if ExtraData is NULL.


nStatus Parameter For InetSendSizeWinRsp
nStatus

Status of the original command. If the command completes successfully, this should be 0. Otherwise, it should be one of the Error Codes.


Return for InetSendSizeWinRsp
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendGetMagGlassDataCmd method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendGetMagGlassDataCmd (long nCommandID, long nBitmapID, VARIANT vMaskPlane, short nMaskPlaneStart, short nMaskPlaneEnd);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a get Magnifying Glass data command to a remote computer.

The remote computer should call InetGetMagGlassData method to get the needed data from the bitmap associated with nBitmapID and respond by calling the InetSendGetMagGlassDataRsp method in its InetReceiveCmd event.

The InetReceiveCmd event will receive the nBitmapID, vMaskPlane, nMaskPlaneStart and nMaskPlaneEnd information in the Params parameter. The nBitmapID information will be in Params.ParamValue(0). The vMaskPlane information will be in Params.ParamValue(1), and so forth.

When a response is received from a remote computer, the InetReceiveRsp event is triggered.

See Also

Elements:	InetSendGetMagGlassDataRsp method, InetReceiveRsp event, InetReceiveCmd event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendGetMagGlassDataCmd
nCommandID

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.


nBitmapID Parameter For InetSendGetMagGlassDataCmd
nBitmapID

The ID of the bitmap to get Magnifying Glass data from.


vMaskPlane Parameter For InetSendGetMagGlassDataCmd
vMaskPlane

An array of bit flags which represent a mask plane. This array works as a plane for the parts of the bitmap that are not yet updated.


nMaskPlaneStart Parameter For InetSendGetMagGlassDataCmd
nMaskPlaneStart

The start index of the mask plane array.


nMaskPlaneEnd Parameter For InetSendGetMagGlassDataCmd
nMaskPlaneEnd

The end index of the mask plane array.


Return for InetSendGetMagGlassDataCmd
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendGetMagGlassDataRsp method (Inet Control)

Visual Basic Example	Visual C++ 4.0 Example
Syntax	short InetSendGetMagGlassDataRsp (long nCommandID, VARIANT* vColorBuffer, VARIANT* vMaskPlane, short nMaskPlaneStart, short nMaskPlaneEnd, long nExtraDataSize, VARIANT* ExtraData, short nStatus);
Overview	Refer to Sending Commands and Responses
Remarks

(Internet only) Sends a get Magnifying Glass data response to a remote computer.

This method sends a response to a get Magnifying Glass data command that was sent from a remote computer using the InetSendGetMagGlassDataCmd method.

When a command request is received from a remote computer, the InetReceiveCmd event is triggered.

See Also

Elements:	InetSendGetMagGlassDataCmd method, InetGetMagGlassData method, InetReceiveCmd event, InetReceiveRsp event
Topics:	A Client-Server Diagram: Sending Commands and Responses


nCommandID Parameter For InetSendGetMagGlassDataRsp
nCommandID

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.


vColorBuffer Parameter For InetSendGetMagGlassDataRsp
vColorBuffer

A VARIANT byte array of colors that match the position of needed data on the mask plane array. This array of colors is obtained by calling the InetGetMagGlassData method.


vMaskPlane Parameter For InetSendGetMagGlassDataRsp
vMaskPlane

An array of bit flags which represent a mask plane. This array works as a plane for the parts of the bitmap that are not yet updated.


nMaskPlaneStart Parameter For InetSendGetMagGlassDataRsp
nMaskPlaneStart

The start index of the mask plane array.


nMaskPlaneEnd Parameter For InetSendGetMagGlassDataRsp
nMaskPlaneEnd

The end index of the mask plane array.


nExtraDataSize Parameter For InetSendGetMagGlassDataRsp
nExtraDataSize

Size of any extra data to send with the response. Unused if ExtraData is NULL.


ExtraData Parameter For InetSendGetMagGlassDataRsp
ExtraData

Extra data to send with the response. Pass NULL if the response does not need to pass any extra data.


nStatus Parameter For InetSendGetMagGlassDataRsp
nStatus

Status of the original command. If the command completes successfully, this should be 0. Otherwise, it should be one of the Error Codes.


Return for InetSendGetMagGlassDataRsp
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetGetMagGlassData method (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Visual J++ example
Syntax	short InetGetMagGlassData (long hBitmap, VARIANT *pvColorBuffer, VARIANT vMaskPlane, short nMaskPlaneStart, short nMaskPlaneEnd);
Overview	Refer to Implementing Internet Functionality.
Remarks

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

See Also

Elements:	InetConnect method, InetConnected event
Topics	Internet Features Properties, methods, and events: Internet


hBitmap Parameter For InetGetMagGlassData
hBitmap

Handle to the bitmap from which to get the Magnifying Glass data.


pvColorBuffer Parameter For InetGetMagGlassData
pvColorBuffer

Address of the VARIANT byte array to be updated with the required colors that match the position of needed data on the mask plane array.


vMaskPlane Parameter For InetGetMagGlassData
vMaskPlane

An array of bit flags which represent a mask plane. This array works as a plane for the parts of the bitmap that are not yet updated.


nMaskPlaneStart Parameter For InetGetMagGlassData
nMaskPlaneStart

The start index of the mask plane array.


nMaskPlaneEnd Parameter For InetGetMagGlassData
nMaskPlaneEnd

The end index of the mask plane array.


Return for InetGetMagGlassData
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetSendSound method (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short InetSendSound (short iFormatTag, short iChannels, long lSamplesPerSec, long lAvgBytesPerSec, short iBlockAlign, short iBitsPerSample, short iExtraDataSize, VARIANT pExtraData, VARIANT pData, long lDataSize);
Overview	Refer to Implementing Internet Functionality.
Remarks

Sends wave sound data to all the remote computers in the SendList property.

This generates an InetReceiveSound event on the remote computer(s).

Before you can send data to a remote computer, you must have an open connection.

You can open a connection in two ways:

1) setup the local computer as a server and listen for connections using the InetServerInit method.  When connection requests are received, open the connection using the InetAcceptConnect method.

2) connect to an existing server using the InetConnect method.

See Also

Elements:	SendList property, InetServerInit method, InetConnect method, InetAcceptConnect method, InetAccept event, InetSendBitmap method, InetSendDIB method, InetSendData, InetReceiveBitmap event, InetReceiveData event, InetReceiveStart event, InetReceiveSound event, InetError event
Topics	Internet Features Properties, methods, and events: Internet


iFormatTag Parameter For InetSendSound
iFormatTag

value indicating the format of the audio data.


iChannels Parameter For InetSendSound
iChannels

value indicating the number of channels.


lSamplesPerSec Parameter For InetSendSound
lSamplesPerSec

value indicating the sample rate.


lAvgBytesPerSec Parameter For InetSendSound
lAvgBytesPerSec

variable used for internal buffer estimation.


iBlockAlign Parameter For InetSendSound
iBlockAlign

value indicating the block size of the data.


iBitsPerSample Parameter For InetSendSound
iBitsPerSample

value indicating the number of bits per sample.


iExtraDataSize Parameter For InetSendSound
iExtraDataSize

value indicating the size of the extra data.


pExtraData Parameter For InetSendSound
pExtraData

variant array of bytes that holds the extra data.


pData Parameter For InetSendSound
pData

variant array of bytes of the actual sound data.


lDataSize Parameter For InetSendSound
lDataSize

value indicating the amount of actual sound data.


Return for InetSendSound
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetServerClose method (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short InetServerClose (short iServer);
Overview	Refer to Implementing Internet Functionality.
Remarks

Shutdowns the server on the local computer.

Call this method to shutdown a server that was started using the InetServerInit method.

Once this method is completed, remote computers will not be able to connect until InetServerInit has been called to restart the server.

This method does not close any open connections.  It only stops any new connection request from being accepted.  To close open connections, you must use the InetDisconnect method.

See Also

Elements:	InetServerInit method, InetConnect method, InetError event, InetDisconnect method
Topics	Internet Features Properties, methods, and events: Internet


iServer Parameter For InetServerClose
iServer

handle to a server computer, obtained by calling the InetServerInit method


Return for InetServerClose
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


InetServerInit method (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short InetServerInit (short* piServer, short iPort);
Overview	Refer to Implementing Internet Functionality.
Remarks

Initializes the computer as a server.

This will allow other computers to connect to the server and transfer data.

Calling this method sets up iPort to listen for connection requests from remote computers.

Connection requests will be received in the InetAccept event, and can be accepted using the InetAcceptConnect method.

The InetServerInit method must be called by the host computer before other computers can connect using the InetConnect method.

To shut down the server, call the InetServerClose method.

Note:	The ConnectList property contains handles to all computers that are connected, regardless of the server which accepted the connection.  If you wish to keep up with connections on a per server basis, you should use one control per server.
See Also

Elements:	InetConnect method, InetServerClose method, InetAccept event, InetAcceptConnect method, InetError event, InetDisconnect method
Topics	Internet Features Properties, methods, and events: Internet


piServer Parameter For InetServerInit
piServer

address of the variable to update with the handle of the initialized server


iPort Parameter For InetServerInit
iPort

the number of the port to set up as a server

Value	Meaning
0x015	FTP
0x050	Web server
0x077	News
0x019	Mail
0x017	Telnet


Return for InetServerInit
Return Value

Return	Meaning
0	The function was successful.
<>0	An error occurred. Refer to Error Codes.


SendList property (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short SendList (short iIndex)
Overview	Refer to Implementing Internet Functionality.
Remarks

An array of computer handles to which data will be sent.

Use this property to create a list of remote computers to which you wish to send data using  the InetSendData, InetSendBitmap, InetSendSound or InetSendDIB methods.

To remove a computer from the list, set the value of the desired index to 0.  This will update the list and the SendListNum property.

When connections are removed from the ConnectList property in response to a call to InetDisconnected event, the corresponding computer handle is automatically removed from the SendList array.

See Also

Elements:	SendListNum property, InetSendData method, InetSendBitmap method, InetSendDIB method, InetSendSound method, InetSendSound method, ConnectList property
Topics	Internet Features Properties, methods, and events: Internet


iIndex Parameter For SendList
iIndex

index into the array.


SendListNum property (Inet Control)

Visual Basic example	Visual C++ 4.0 example	Delphi 2.0 example	Visual J++ example
Syntax	short SendListNum
Overview	Refer to Implementing Internet Functionality.
Remarks

(Read Only) Gets the number of items in the SendList array.

See Also

Elements:	SendList property, InetSendData method, InetSendBitmap method, InetSendDIB method
Topics	Internet Features Properties, methods, and events: Internet


Internet Features Properties, methods, and events

Internet


Internet Features Properties, methods, and events:
Internet

Working With Network Connections using the Internet Component:

ConnectList property (Inet Control)

ConnnectListNum property (Inet Control)

EnableMethodErrors property (Inet Control)

InetAccept event (Inet Control)

InetAcceptConnect method (Inet Control)

InetConnect method (Inet Control)

InetConnected event (Inet Control)

InetDisconnect method (Inet Control)

InetDisconnected event (Inet Control)

InetError event (Inet Control)

InetServerClose method (Inet Control)

InetServerInit method (Inet Control)

Sending and Receiving Data Over a Network Connection using the Internet Component:

InetClearQueue method (InetControl)

InetDataSent event (Inet Control)

InetGetData (Inet Control)

InetGetHostName method (Inet Control)

InetQueueSize property (Inet Control)

InetReceiveBitmap event (Inet Control)

InetReceiveData event (Inet Control)

InetReceiveSound event (InetControl)

InetReceiveStart event (Inet Control)

InetReceiving event (Inet Control)

InetSendBitmap method (Inet Control)

InetSendData method (Inet Control)

InetSendDIB method (Inet Control)

InetSending event (Inet Control)

InetSendSound method (Inet Control)

SendList property (Inet Control)

SendListNum property (Inet Control)

Command Messages

InetReceiveCmd event

InetSendCmd method

InetSendLoadCmd method

InetSendSaveCmd method

InetSendCreateWinCmd method

InetSendSizeWinCmd method

InetSendCloseWinCmd method

InetSendShowWinCmd method

InetSendSetRectCmd method

InetSendFreeBitmapCmd method

InetSendGetMagGlassDataCmd method

Response Messages

InetReceiveRsp event

InetSendRsp method

InetSendLoadRsp method

InetSendSaveRsp method

InetSendCreateWinRsp method

InetSendAttachBitmapRsp method

InetSendSizeWinRsp method

InetSendCloseWinRsp method

InetSendShowWinRsp method

InetSendSetRectRsp method

InetSendFreeBitmapRsp method

InetSendGetMagGlassDataRsp method

Working with Magnifying Glass

InetGetMagGlassData method


Tutorial for Visual Basic Programmers

The following topics provide brief and simple examples to help you learn how to use the LEADTOOLS Internet features ActiveX.

Note:	These tutorial examples are intended to be easy to understand and easy to test. The example programs in the EXAMPLES subdirectory provide more in depth design and more detailed code.
Initializing a Computer as a Server and Accepting Connections

Connecting to a Remote Computer

Sending Images to a Remote Computer

Receiving and Displaying Images from a Remote Computer

Miscellaneous Examples


Initializing a Computer as a Server and Accepting Connections (Visual Basic)

Take the following steps to start a project and to add some code that will let you initialize a computer as a server and accept connections.

1.	Start Visual Basic.  Select Standard EXE and click Open.

2.	Add the LEAD Internet Control to your project.

For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD Internet (14).

For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Internet (14).

3.	Select the LEAD Internet Control; then add the control to your main form.

4.	Add a command button and name it as follows:

Name	Caption
ServerInit	Init Server
5.	Define a global variable as follows:

Dim hServer as Integer ' handle to server

6.	Code the Form_Load() procedure as follows:

Private Sub Form_Load()

LEADNet1.EnableMethodErrors = False
End Sub

7.	Code the ServerInit_Click procedure as follows:

Private Sub ServerInit_Click()
Dim nRet As Integer

' initialize server on port 1000
nRet = LEADNet1.InetServerInit(hServer, 1000)

If nRet <> 0 Then
  MsgBox "Error initializing server:" + CStr(nRet)
End If
End Sub

8.	Code the LEADNet1_InetAccept procedure as follows:

Private Sub LEADNet1_InetAccept(ByVal iServer As Integer)
Dim hComputer As Integer
Dim hName As String

nRet = LEADNet1.InetAcceptConnect(hServer, hComputer)

If nRet <> 0 Then
  MsgBox "Error accepting connection:" + CStr(nRet)
  Exit Sub
End If

LEADNet1.InetGetHostName hComputer, HOST_NAME_DESCRP, hName

'add to our list
LEADNet1.SendList(LEADNet1.SendListNum) = hComputer

MsgBox "Connection accepted from:" + hName
End Sub

9.	Code the main form's Form_Unload procedure as follows:

Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer

'disconnect all connections
For i = 0 To LEADNet1.ConnectListNum - 1
  LEADNet1.InetDisconnect LEADNet1.ConnectList(i)
Next i
End Sub

10.	Run your program to test it.

11.	Save the project to use as the server for other tutorials.  Create an EXE that you can run from outside Visual Basic.


Connecting to a Remote Computer (Visual Basic)

Take the following steps to start a project and to add some code that will let you connect to a remote computer that is acting as a server.

1.	Run the server exe you created in Initializing a Computer as a Server and Accepting Connections from out side Visual Basic.

2.	Start Visual Basic.  On the New tab, select Standard EXE and click Open to create a new application.

3.	Add the LEAD Internet Control to your project.

For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD Internet (14).

For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Internet (14).

4.	Select the LEAD Internet Control; then add the control to your main form.

5.	Add a Text box to the main form and name it as follows:

Name
RemoteComputer.

Set the Text property to the name of the computer you will use as a server, or set it to 207.238.49.190.

6.	Add two command buttons to the form and give them the following names:

Name	Caption
Connect	Connect To Remote
Disconnect	Disconnect From Remote
7.	Code the Connect_Click procedure as follows:

Private Sub Connect_Click()
Dim nRet As Integer

LEADNet1.EnableMethodErrors = False

'connect to remote computer on port 1000
nRet = LEADNet1.InetConnect(RemoteComputer.Text, 1000)

If nRet <> 0 Then
  MsgBox "Error connecting to:" + RemoteComputer.Text + ":" + CStr(nRet)
  Exit Sub
End If
End Sub

8.	Code the Disconnect_Click procedure as follows:

Private Sub Disconnect_Click()
Dim nRet As Integer

'we are assuming on one connection in this example, therefore the handle
'to the remote computer will be in the first position in the SendList
nRet = LEADNet1.InetDisconnect(LEADNet1.SendList(0))

If nRet <> 0 Then
  MsgBox "Error disconnecting from remote:" + CStr(nRet)
End If
End Sub

9.	Code the LEADNet1_InetConnected event as follows:

Private Sub LEADNet1_InetConnected(ByVal iComputer As Integer)

Dim sRemote As String

'get remote host name
LEADNet1.InetGetHostName iComputer, HOST_NAME_DESCRP, sRemote

'add this connection to our SendList
LEADNet1.SendList(LEADNet1.SendListNum) = iComputer
MsgBox "Successfully connected to remote computer:" + sRemote
End Sub

10.	Code the LEADNet1_InetDisconnected event as follows:

Private Sub LEADNet1_InetDisconnected(ByVal iComputer As Integer)

MsgBox "Disconnect from remote computer"

End Sub

11.	Run your program to test it.  Enter the name of the computer that is serving as the server in the text box.  For testing purposes you might want to run both the server and the remote programs on the same computer.

12.	Save the project to use as a starting point for other tutorials.


Sending Images to a Remote Computer (Visual Basic)

Take the following steps to add some code that will let you send images to a remote computer.

1.	Start with the project you created in Initializing a Computer as a Server and Accepting Connections.

2	Add the LEAD Capture Control to your project.

For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD Capture (14).

For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Capture (14).

3.	Select the LEAD Capture Control; then add the control to your main form.  Size and position the control, as you want it to appear at run time.

4.	Add a command button to the form and name it as follows:

Name	Caption
Send	Send Bitmaps
5.	Define a global variable as follows:

Dim bSendImages As Boolean

6.	Append the following code to the Form_Load procedure:

bSendImages = False

nRet = LEADCap1.CapConnect (0) 'connect to default driver

If nRet <> 0 Then
  MsgBox "Error connecting to capture device:" + CStr(nRet)
Else
  'setting the display mode to preview will allow us to get a callback for
  'each frame that is displayed
  LEADCap1.CapDisplayMode = DISPLAY_PREVIEW
  LEADCap1.EnableCaptureEvents = True
End If

7.	Code the Send_Click procedure as follows:

Private Sub Send_Click()

bSendImages = Not bSendImages

End Sub

8.	Code the LEADCap1_CapVideoData procedure as follows:

Private Sub LEADCap1_CapVideoData (ByVal hDib As Long, ByVal lTime As Long)

If bSendImages Then
  'send the images to the remote computer
  LEADNet1.InetSendDIB hDib, FILE_CMP, 24, 75
End If
DoEvents
End Sub

9.	Run your program to test it.

10.	Make an EXE from this tutorial to use as a server for other tutorials.


Receiving and Displaying Images from a Remote Computer (Visual Basic)

Take the following steps to add some code that will let you receive and display images received from a computer acting as a server.

1.	Run the EXE you created in Sending Images to a Remote Computer from outside Visual Basic.

2.	Start Visual Basic.

3.	Open the example you created in Connecting to a Remote Computer.

4.	Add the LEAD Main Control to the project.

For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD Main (14).

For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Main (14).

5.	Select the LEAD Main Control; then add the control to your main form. Size and position the control as you want it to appear at run time.  Set the BackErase property to False.

6.	Code the LEADNet1_InetReceiveBitmap event as follows:

Private Sub LEADNet1_InetReceiveBitmap(ByVal iComputer As Integer, ByVal hBitmap As Long)

'assign bitmap to LEAD Main control
LEAD1.Bitmap = hBitmap
DoEvents
End Sub

7.	Run your program to test it.


Miscellaneous Examples (Visual Basic)

You can test the following examples by either adding a command button to one of the previous lessons in the tutorial and pasting the sample code in the Click procedure, or by cutting and pasting event code into the appropriate event in a lesson.

EnableMethodErrors Example for Visual Basic

InetAcceptConnect Example for Visual Basic

InetClearQueue Example for Visual Basic

InetConnect Example for Visual Basic

InetConnected Example for Visual Basic

InetDataSent Example for Visual Basic

InetDisconnect Example for Visual Basic

InetDisconnected Example for Visual Basic

InetError Example for Visual Basic

InetReceiveBitmap Example for Visual Basic

InetReceiveCmd Example for Visual Basic

InetReceiveData Example for Visual Basic

InetReceiveRsp Example for Visual Basic

InetReceiveSound Example for Visual Basic

InetReceiveStart Example for Visual Basic

InetReceiving Example for Visual Basic

InetSendAttachBitmapCmd Example Visual Basic

InetSendBitmap Example for Visual Basic

InetSendCloseWinCmd Example for Visual Basic

InetSendCloseWinRsp Example for Visual Basic

InetSendCmd Example for Visual Basic

InetSendCreateWinCmd Example for Visual Basic

InetSendData Example for Visual Basic

InetSendDIB Example for Visual Basic

InetSendFreeBitmapCmd Example for Visual Basic

InetSendFreeBitmapRsp Example for Visual Basic

InetSendGetMagGlassDataCmd Example for Visual Basic

InetSendGetMagGlassDataRsp Example for Visual Basic

InetSending Example for Visual Basic

InetSendLoadCmd Example for Visual Basic

InetSendLoadRsp Example for Visual Basic

InetSendSaveCmd Example for Visual Basic

InetSendSetRectCmd Example for Visual Basic

InetSendSetRectRsp Example for Visual Basic

InetSendShowWinCmd Example for Visual Basic

InetSendShowWinRsp Example for Visual Basic

InetSendSizeWinCmd Example for Visual Basic

InetSendSizeWinRsp Example for Visual Basic

InetSendSound Example for Visual Basic

InetServerClose Example for Visual Basic

InetServerInit Example for Visual Basic


EnableMethodErrors example for Visual Basic
EnableMethodErrors (Inet Control) Example for Visual Basic

LEADNet1.EnableMethodErrors = False


InetAcceptConnect Example for Visual Basic

This is also the example for the InetAccept event, the SendList property and the SendListNum property.

Private Sub LEADNet1_InetAccept(ByVal iServer As Integer)
    Dim iComp As Integer

    LEADNet1.InetAcceptConnect iServer, iComp
    ' add connection to send list
    LEADNet1.SendList(LEADNet1.SendListNum) = iComp
End Sub


InetClearQueue Example for Visual Basic

This is also the example for the InetQueueSize property.

' This example checks the size of computers in the send lists before it sends data to the remote
' computer. It uses the LEAD Capture Control for recording audio data.  Refer to the LEAD Capture
' Control documentation for an example of recording audio data

Private Sub LEADCap1_CapAudioData (ByVal pData As Variant, ByVal lBytesRecorded As Long, ByVal iIndex As Integer)
    Dim i As Integer
    Dim qSize As Long

    ' check the queue size of all computers in SendList
    ' this is the list of computers that are connected to us
    For i = 0 To LEADServer.SendListNum - 1
      qSize = LEADServer.InetQueueSize(LEADServer.SendList(i))
      ' clear queue there is more than 10 seconds worth of sound data
      If qSize > (LEADCap1.CapWaveAvgBytesPerSec (CAP_AUDIO_RECORD) * 10) Then
        LEADServer.InetClearQueue (LEADServer.SendList(i))
      End If
    Next

    'send data to all clients in the server send list
    If (LEADServer.SendListNum > 0) Then
        LEADServer.InetSendSound LEADCap1.CapWaveFormatTag (CAP_AUDIO_RECORD), LEADCap1.CapWaveChannels (CAP_AUDIO_RECORD), LEADCap1.CapWaveSamplesPerSec (CAP_AUDIO_RECORD), _
                                 LEADCap1.CapWaveAvgBytesPerSec(CAP_AUDIO_RECORD), LEADCap1.CapWaveBlockAlign (CAP_AUDIO_RECORD), LEADCap1.CapWaveBitsPerSample (CAP_AUDIO_RECORD), _
                                 LEADCap1.CapWaveExtraSize(CAP_AUDIO_RECORD), LEADCap1.CapWaveExtraData (CAP_AUDIO_RECORD), pData, lBytesRecorded
    End If

    ' check the queue size of all computers in SendList
    ' this is the list of computers that we are connected to
    For i = 0 To LEADServer.SendListNum - 1
      qSize = LEADClient.InetQueueSize(LEADClient.SendList(i))
      ' clear queue there is more than 10 seconds worth of sound data
      If qSize > (LEADCap1.CapWaveAvgBytesPerSec(CAP_AUDIO_RECORD) * 10) Then
        LEADClient.InetClearQueue (LEADClient.SendList(i))
      End If
    Next

    'send data to all servers in the client send list
    If (LEADClient.SendListNum > 0) Then
        LEADClient.InetSendSound LEADCap1.CapWaveFormatTag(CAP_AUDIO_RECORD), LEADCap1.CapWaveChannels(CAP_AUDIO_RECORD), LEADCap1.CapWaveSamplesPerSec(CAP_AUDIO_RECORD), _
                                 LEADCap1.CapWaveAvgBytesPerSec(CAP_AUDIO_RECORD), LEADCap1.CapWaveBlockAlign(CAP_AUDIO_RECORD), LEADCap1.CapWaveBitsPerSample(CAP_AUDIO_RECORD), _
                                 LEADCap1.CapWaveExtraSize(CAP_AUDIO_RECORD), LEADCap1.CapWaveExtraData(CAP_AUDIO_RECORD), pData, lBytesRecorded
    End If
End Sub


InetConnect Example for Visual Basic

Private Sub Command1_Click()
' connect to computer 127.0.0.1
    LEADNet1.InetConnect "127.0.0.1", 1000
End Sub


InetConnected Example for Visual Basic

This is also the example for the InetGetHostName method.

Private Sub LEADNet1_InetConnected (ByVal iComputer As Integer)
Dim hostname As String

  ' add remote computer to our send list
  LEADNet1.SendList(LEADNet1.SendListNum) = iComputer
  ' get remote computer name
  LEADNet1.InetGetHostName iComputer, HOST_NAME_DESCRP, hostname
  ' display host descriptive name
  MsgBox hostname
End Sub


InetDataSent Example for Visual Basic

Private Sub LEADNet1_InetDataSent (ByVal iComputer As Integer, ByVal lSize As Long)
  ' display the amount of data sent
  MsgBox "Data Sent: " + CStr(lSize) + " bytes"
End Sub


InetDisconnect Example for Visual Basic

This is also the example for the ConnectList property and ConnectListNum property.

Private Sub Command4_Click()
    Dim i As Integer

    ' disconnect all connections
    For i = 0 To LEADNet1.ConnectListNum - 1
        LEADNet1.InetDisconnect LEADNet1.ConnectList(i)
    Next i
End Sub


InetDisconnected Example for Visual Basic

Private Sub LEADNet1_InetDisconnected (ByVal iComputer As Integer)
    MsgBox CStr(iComputer) + " disconnected"
End Sub


InetError Example for Visual Basic

Private Sub LEADNet1_InetError (ByVal iComputer As Integer, ByVal iMessage As Integer, ByVal iError As Integer)
   MsgBox "Computer: " + CStr(iComputer) + " had Error: " + CStr(iError) + " at: " + CStr(iMessage)
End Sub


InetReceiveBitmap Example for Visual Basic

Private Sub LEADNet1_InetReceiveBitmap (ByVal iComputer As Integer, ByVal hBitmap As Long)
    ' assign bitmap to main lead control
    LEAD2.Bitmap = hBitmap
End Sub


InetReceiveCmd Example for Visual Basic

' my user defined commands
Private Const INETCMD_FLIP = INETCMD_USER_CUSTOM

Private Function ProcessFlipCommand(ByVal nID&) As Integer
    MsgBox "Flip"
    ProcessFlipCommand = 0
End Function

Private Sub LEADNet1_InetReceiveCmd(ByVal iComputer As Integer, ByVal InetCommand As Integer, ByVal nCommandID As Long, ByVal nError As Integer, ByVal Params As LEADNetLibCtl.ILTInetPacket, ByVal nExtraDataSize As Long, ByVal ExtraData As Variant)
    Dim szOut$
    Dim nRet As Integer
    Dim nStatus As Integer
    Dim i As Integer
    Dim pszData As String

    nStatus = ERROR_FEATURE_NOT_SUPPORTED

    szOut$ = "Command " & CStr(InetCommand) & " id=" & CStr(nCommandID) & ", nError=" & CStr(nError) & " nParams=" & CStr(Params.ParamCount) & " received"
    If (nExtraDataSize > 0) Then
        szOut$ = szOut$ & ", nExtraDataSize=" & CStr(nExtraDataSize)
    End If
    Debug.Print (szOut$)
    If (nExtraDataSize > 0) Then
        ' convert to a string
        For i = 0 To nExtraDataSize - 1
            pszData = pszData + Chr(ExtraData(i))
        Next
        Debug.Print "ExtraData: " & pszData
    End If

    If (nError <> 0) Then
        nStatus = ERROR_TRANSFER_ABORTED
    Else
        Select Case InetCommand
            Case INETCMD_FLIP:
                If ((Params.ParamCount = 1) And (Params.ParamType(0) = PARAM_TYPE_UINT32)) Then
                    'Note: This is a function you have to create
                    nStatus = ProcessFlipCommand(CLng(Params.ParamValue(0)))
                Else
                    nStatus = ERROR_INV_PARAMETER
                End If
        End Select
    End If
    'return an error response
    LEADNet1.InetSendRsp InetCommand, nCommandID, Nothing, 0, Null, nStatus
End Sub


InetReceiveData Example for Visual Basic

Private Sub LEADNet1_InetReceiveData(ByVal iComputer As Integer, ByVal pData As Variant, ByVal lSize As Long, ByVal iType As Integer)
  Dim i As Integer
  Dim pszData As String

  ' convert to a string
  For i = 0 To lSize - 1
    pszData = pszData + Chr(pData(i))
  Next
  MsgBox CStr(iComputer) + ": " + pszData
End Sub


InetReceiveRsp Example for Visual Basic

Private Sub LEADNet1_InetReceiveRsp(ByVal iComputer As Integer, ByVal InetCommand As Integer, ByVal nCommandID As Long, ByVal nError As Integer, ByVal nStatus As Integer, ByVal Params As LEADNetLibCtl.ILTInetPacket, ByVal nExtraDataSize As Long, ByVal ExtraData As Variant)
    Dim nRet As Integer
    Dim szOut$
    Dim i As Integer
    Dim pszData As String

    szOut$ = "Command " & CStr(InetCommand) & " id=" & CStr(nCommandID) & ", nError=" & CStr(nError) & " nStatus=" & CStr(nStatus) & " nParams=" & CStr(Params.ParamCount) & " received"
    If (nExtraDataSize > 0) Then
        szOut$ = szOut$ & ", nExtraDataSize=" & CStr(nExtraDataSize)
    End If
    Debug.Print (szOut$)
    If (nExtraDataSize > 0) Then
        ' convert to a string
        For i = 0 To nExtraDataSize - 1
            pszData = pszData + Chr(ExtraData(i))
        Next
        Debug.Print "ExtraData: " & pszData
    End If

    If (nError <> 0) Then Exit Sub

    Select Case InetCommand
        Case INETCMD_LOAD
            If ((nStatus = 0) Or (nStatus = 1)) Then
                If ((Params.ParamCount = 1) And (Params.ParamType(0) = PARAM_TYPE_UINT32)) Then
                    Debug.Print "Load SUCCEEDED!"
                Else
                    Debug.Print "Load failed with error code " & CStr(nStatus)
                End If
            End If
    End Select
End Sub


InetReceiveSound Example for Visual Basic

Dim bInit As Boolean

Private Sub LEADNet1_InetReceiveSound (ByVal iComputer As Integer, ByVal iFormatTag As
Integer, ByVal nChannels As Integer, ByVal lSamplesPerSec As Long, ByVal lAvgBytesPerSec
As Long, ByVal iBlockAlign As Integer, ByVal iBitsPerSample As Integer, ByVal
iExtraDataSize As Integer, ByVal pExtraData As Variant, ByVal pData As Variant, ByVal
lDataSize As Long)
  ' this example uses the LEAD Capture Module for sound playback

  If Not bInit Then
    LEADCap1.CapWaveFormatTag (CAP_AUDIO_FEED) = iFormatTag
    LEADCap1.CapWaveChannels (CAP_AUDIO_FEED) = nChannels
    LEADCap1.CapWaveSamplesPerSec (CAP_AUDIO_FEED) = lSamplesPerSec
    LEADCap1.CapWaveAvgBytesPerSec (CAP_AUDIO_FEED) = lAvgBytesPerSec
    LEADCap1.CapWaveBlockAlign (CAP_AUDIO_FEED) = iBlockAlign
    LEADCap1.CapWaveBitsPerSample (CAP_AUDIO_FEED) = iBitsPerSample
    LEADCap1.CapWaveExtraData (CAP_AUDIO_FEED) = pExtraData
    LEADCap1.CapWaveExtraSize (CAP_AUDIO_FEED) = iExtraDataSize
    ' initialize feed sound process
    LEADCap1.CapStartFeedSound " c:\capture.wav", 0, 2, CAP_FEED_SAVEDATA, hSound
    bInit = True
  Else
    LEADCap1.CapFeedSound hSound, pData, lDataSize
  End If

  ' when finished playing sound LEADCap1.CapStopFeedSound should be called, a good
  '  place to do it would be in the InetDisconnected event
End Sub


InetReceiveStart Example for Visual Basic

Private Sub LEADNet1_InetReceiveStart (ByVal iComputer As Integer, ByVal iSize As Long)
    ' Display amount expected
    Text1.Text = "Will receive: " + CStr(iSize) + " bytes."
End Sub


InetReceiving Example for Visual Basic

Private Sub LEADNet1_InetReceiving (ByVal iComputer As Integer, ByVal lSize As Long)
   ' display data size as we get it
   Text1.Text = "Computer: " + CStr(iComputer) + " received " + CStr(iSize)
End Sub


InetSendAttachBitmapCmd Example for Visual Basic

Dim nRet As Integer

    nRet = LEADNet1.InetSendAttachBitmapCmd(999, 1, 1)

    If ((nRet <> 0) And (nRet <> ERROR_DATA_QUEUED)) Then

        MsgBox "ERROR " & CStr(nRet) & " calling InetSendAttachBitmapCmd."

    Else

        MsgBox "InetSendAttachBitmapCmd Executed."

    End If


InetSendBitmap Example for Visual Basic

Private Sub Command2_Click()
    ' send bitmap to everybody in SendList property
    LEADNet1.InetSendBitmap LEAD1.Bitmap, FILE_CMP, 24, 255
End Sub


InetSendCloseWinCmd Example for Visual Basic

Dim nRet As Integer

    nRet = LEADNet1.InetSendCloseWinCmd(999, 1)
    If ((nRet <> 0) And (nRet <> ERROR_DATA_QUEUED)) Then
        MsgBox "ERROR " & CStr(nRet) & " calling InetSendCloseWinCmd."
    Else
        MsgBox "InetSendCloseWinCmd Executed."
    End If


InetSendCloseWinRsp Example for Visual Basic

Private Sub LEADNet1_InetReceiveCmd(ByVal iComputer As Integer, ByVal InetCommand As Integer, ByVal nCommandID As Long, ByVal nError As Integer, ByVal Params As LEADNetLibCtl.ILTInetPacket, ByVal nExtraDataSize As Long, ByVal ExtraData As Variant)
    Dim nRet As Integer
    Dim nStatus As Integer

    If (nError <> 0) Then
        nStatus = ERROR_TRANSFER_ABORTED
    Else
        Select Case InetCommand
            Case INETCMD_CLOSE_WIN
                ' check the validity of the parameters
                If ((Params.ParamCount = 1) And _

                    (Params.ParamType(0) = PARAM_TYPE_UINT32)) Then
                    'Note this is a function you must create
                    nStatus = ProcessCloseWinCommand(Params.ParamValue(0))
                    nRet = LEADNet1.InetSendCloseWinRsp (nCommandID, 0, Null, nStatus)
                    Exit Sub
                End If
        End Select
    End If
    'return an error response
    LEADNet1.InetSendRsp InetCommand, nCommandID, Nothing, 0, Null, nStatus
End Sub


InetSendCmd Example for Visual Basic

' my user defined commands
Private Const INETCMD_FLIP = INETCMD_USER_CUSTOM

    Dim nRet As Integer
    Dim Params As New LTInetPacket
    Dim ExtraData As String
    Dim lSize As Long

    Params.ParamCount = 1
    Params.ParamValue(0) = 1
    Params.ParamType(0) = PARAM_TYPE_UINT32

    ExtraData = "This is Flip"
    lSize = Len(ExtraData)

    nRet = LEADNet1.InetSendCmd(INETCMD_FLIP, 999, Params, lSize, ExtraData)


InetSendCreateWinCmd Example for Visual Basic

Dim nRet As Integer

    nRet = LEADNet1.InetSendCreateWinCmd(999, "", "Window created by remote
computer", 0, 100, 50, 300, 150, 0)
    If ((nRet <> 0) And (nRet <> ERROR_DATA_QUEUED)) Then
        Debug.Print "ERROR " & CStr(nRet) & " calling InetSendCreateWinCmd."
    Else
        Debug.Print "InetSendCreateWinCmd Executed."
    End If


InetSendData Example for Visual Basic

Private Sub Command2_Click()
    Dim s As String
    Dim l As Integer

    s = "This is a test"
    l = Len(s)
    LEADNet1.InetSendData "This is a test", l, IDATA_USER1
End Sub


InetSendDIB Example for Visual Basic

Private Sub Lead1_Click()
    LEAD1.Load "d:\ltwin10x\images\sample4.cmp", 0, 0, 1
    'send dib to remote computer
    LEADNet1.InetSendDIB LEAD1.GetDIB, FILE_CMP, 24, 255
End Sub


InetSendFreeBitmapCmd Example for Visual Basic

Dim nRet As Integer
    nRet = LEADNet1.InetSendFreeBitmapCmd(999, 1)
    If ((nRet <> 0) And (nRet <> ERROR_DATA_QUEUED)) Then
        MsgBox "ERROR " & CStr(nRet) & " calling InetSendFreeBitmapCmd."
    Else
        MsgBox "InetSendFreeBitmapCmd Executed."
    End If


InetSendFreeBitmapRsp Example for Visual Basic

Private Sub LEADNet1_InetReceiveCmd(ByVal iComputer As Integer, ByVal InetCommand As Integer, ByVal nCommandID As Long, ByVal nError As Integer, ByVal Params As LEADNetLibCtl.ILTInetPacket, ByVal nExtraDataSize As Long, ByVal ExtraData As Variant)
    Dim nRet As Integer
    Dim nStatus As Integer

    If (nError <> 0) Then
        nStatus = ERROR_TRANSFER_ABORTED
    Else
        Select Case InetCommand
            Case INETCMD_FREE_BITMAP
                ' check the validity of the parameters
                If ((Params.ParamCount = 1) And (Params.ParamType(0) = PARAM_TYPE_UINT32)) Then
                    'Note this is a function you must create
                    nStatus = ProcessFreeBitmapCommand(Params.ParamValue(0))
                    nRet = LEADNet1.InetSendFreeBitmapRsp(nCommandID, 0, Null, nStatus)
                    Exit Sub
                End If
        End Select
    End If
    'return an error response
    LEADNet1.InetSendRsp InetCommand, nCommandID, Nothing, 0, Null, nStatus
End Sub


InetSendGetMagGlassDataCmd Example for Visual Basic

Public gnCommandID As Long

.

.

.

// … Assume that the following function will be called from inside the MagGlassExt event that

// belongs to LEAD Main OCX control

Public Function GetMagGlassData(nBitmapID As Long, vMaskPlane As Variant, nMaskPlaneStart As Integer, nMaskPlaneEnd As Integer)

    Dim nRet As Integer

    gnCommandID = gnCommandID + 1

    nRet = LEADNet1.InetSendGetMagGlassDataCmd(gnCommandID, nBitmapID, CVar(vMaskPlane), nMaskPlaneStart, nMaskPlaneEnd)

    If ((nRet <> 0) And (nRet <> ERROR_DATA_QUEUED)) Then

        StatusUpdate "ERROR " & CStr(nRet) & " calling InetSendGetMagGlassDataCmd."

    Else

        StatusUpdate "InetSendGetMagGlassDataCmd Executed."

    End If

End Function


InetSendGetMagGlassDataRsp Example for Visual Basic

Private Sub LEADNet1_InetReceiveCmd(ByVal iComputer As Integer, ByVal InetCommand As Integer, ByVal nCommandID As Long, ByVal nError As Integer, ByVal Params As LEADNetLibCtl.ILTInetPacket, ByVal nExtraDataSize As Long, ByVal ExtraData As Variant)
    Dim nStatus As Integer

    Dim nBitmapIndex As Long

    Dim vColorBuffer As Variant

    If (nError <> 0) Then
        nStatus = ERROR_TRANSFER_ABORTED
    Else
        Select Case InetCommand
            Case INETCMD_GET_MAGGLASS_DATA
                ' check the validity of the parameters
                If ((Params.ParamCount = 5) And (Params.ParamType(0) = PARAM_TYPE_UINT32) _

                    And (Params.ParamType(1) = PARAM_TYPE_UINT32) And (Params.ParamType(2) = PARAM_TYPE_USTRING) _

                    And (Params.ParamType(3) = PARAM_TYPE_INT16) And (Params.ParamType(4) = PARAM_TYPE_INT16)) Then

                    nBitmapIndex = CLng(Params.ParamValue(0))

                    'Note: Assume that gBitmaps is array that holds all bitmaps that clients loaded on server
                    nStatus = LEADNet1.InetGetMagGlassData (gBitmaps(nBitmapIndex).Bitmap, vColorBuffer, CVar(Params.ParamValue(2)), Params.ParamValue(3), Params.ParamValue(4))

                    LEADNet1.InetSendGetMagGlassDataRsp nCommandID, CVar(vColorBuffer), CVar(Params.ParamValue(2)), Params.ParamValue(3), Params.ParamValue(4), 0, Null, nStatus
                    Exit Sub
                End If
        End Select
    End If
    'return an error response
    LEADNet1.InetSendRsp InetCommand, nCommandID, Nothing, 0, Null, nStatus
End Sub


InetSending Example for Visual Basic

Private Sub LEADNet1_InetSending (ByVal iComputer As Integer, ByVal lSize As Long)
  ' display the about of data we are sending
  MsgBox "Sending: " + CStr(lSize) + " bytes"
End Sub


InetSendLoadCmd Example for Visual Basic

Dim nRet As Integer

    nRet = LEADNet1.InetSendLoadCmd(999, "v:\images\eagle.cmp", 0, 1)
    If ((nRet <> 0) And (nRet <> ERROR_DATA_QUEUED)) Then
        MsgBox "ERROR " & CStr(nRet) & " calling InetSendLoadCmd."
    Else
        MsgBox "InetSendLoadCmd Executed."
    End If


InetSendLoadRsp Example for Visual Basic

Private Sub LEADNet1_InetReceiveCmd(ByVal iComputer As Integer, ByVal InetCommand As Integer, ByVal nCommandID As Long, ByVal nError As Integer, ByVal Params As LEADNetLibCtl.ILTInetPacket, ByVal nExtraDataSize As Long, ByVal ExtraData As Variant)
    Dim nRet As Integer
    Dim nStatus As Integer
    Dim szOut$
    Dim i As Integer
    Dim pszData As String

    nStatus = ERROR_FEATURE_NOT_SUPPORTED

    szOut$ = "Command " & CStr(InetCommand) & " id=" & CStr(nCommandID) & ", nError=" & CStr(nError) & " nParams=" & CStr(Params.ParamCount) & " received"
    If (nExtraDataSize > 0) Then
        szOut$ = szOut$ & ", nExtraDataSize=" & CStr(nExtraDataSize)
    End If
    Debug.Print (szOut$)
    If (nExtraDataSize > 0) Then
        ' convert to a string
        For i = 0 To nExtraDataSize - 1
            pszData = pszData + Chr(ExtraData(i))
        Next
        Debug.Print "ExtraData: " & pszData
    End If

    If (nError <> 0) Then
        nStatus = ERROR_TRANSFER_ABORTED
    Else
        Select Case InetCommand
            Case INETCMD_LOAD
                ' check the validity of the parameters
                If ((Params.ParamCount = 4) And (Params.ParamType(0) = PARAM_TYPE_STRING) And (Params.ParamType(1) = PARAM_TYPE_INT32) And (Params.ParamType(2) = PARAM_TYPE_INT32) And (Params.ParamType(3) = PARAM_TYPE_UINT32)) Then
                    'Note, this is a function you must create
                    nStatus = ProcessLoadCommand(Params.ParamValue(0))
                    Debug.Print "Received LoadBitmapCmd - Loaded Bitmap " & Params.ParamValue(0)
                    LEADNet1.InetSendLoadRsp nCommandID, gnBitmapID, 0, Null, nStatus
                    Exit Sub
                End If

            Case INETCMD_CREATE_WIN
                ' check the validity of the parameters
                If ((Params.ParamCount = 8) And (Params.ParamType(0) = PARAM_TYPE_STRING) And (Params.ParamType(1) = PARAM_TYPE_STRING) _
                   And (Params.ParamType(2) = PARAM_TYPE_UINT32) And (Params.ParamType(3) = PARAM_TYPE_INT32) And (Params.ParamType(4) = PARAM_TYPE_INT32) _
                   And (Params.ParamType(5) = PARAM_TYPE_INT32) And (Params.ParamType(6) = PARAM_TYPE_INT32) And (Params.ParamType(7) = PARAM_TYPE_UINT32)) Then
                    'Note, this is a function you must create
                    nRet = ProcessCreateWinCommand(Params.ParamValue(1), _
                                                   Params.ParamValue(3), _
                                                   Params.ParamValue(4), _
                                                   Params.ParamValue(5), _
                                                   Params.ParamValue(6), True)
                    nRet = LEADNet1.InetSendCreateWinRsp(nCommandID, nRet, 0, Null, 0)
                    Exit Sub
                End If
            Case INETCMD_ATTACH_BITMAP:
                If ((Params.ParamCount = 2) And (Params.ParamType(0) = PARAM_TYPE_UINT32) And (Params.ParamType(1) = PARAM_TYPE_UINT32)) Then
                    'Note, this is a function you must create
                    nStatus = ProcessAttachBitmapCommand(CLng(Params.ParamValue(0)))
                Else
                    nStatus = ERROR_INV_PARAMETER
                End If
                LEADNet1.InetSendAttachBitmapRsp nCommandID, 0, Null, nStatus
                Exit Sub
            Case INETCMD_SAVE
                If ((Params.ParamCount = 6) And (Params.ParamType(0) = PARAM_TYPE_STRING) And (Params.ParamType(1) = PARAM_TYPE_UINT32) _
                  And (Params.ParamType(2) = PARAM_TYPE_INT32) And (Params.ParamType(3) = PARAM_TYPE_INT32) _
                  And (Params.ParamType(4) = PARAM_TYPE_INT32) And (Params.ParamType(5) = PARAM_TYPE_UINT32)) Then
                    'Note, this is a function you must create
                    nStatus = ProcessSaveCommand(Params.ParamValue(0), Params.ParamValue(2), Params.ParamValue(3), Params.ParamValue(4))
                    LEADNet1.InetSendSaveRsp nCommandID, 0, Null, nStatus
                    Exit Sub
                Else
                    nStatus = ERROR_INV_PARAMETER
                End If
        End Select
    End If
    'return an error response
    LEADNet1.InetSendRsp InetCommand, nCommandID, Nothing, 0, Null, nStatus
End Sub


InetSendSaveCmd Example for Visual Basic

Dim nRet As Integer

    nRet = LEADNet1.InetSendSaveCmd(999, 1, "d:\temp\remote.tif", FILE_TIF, 0, 0, True)
    If ((nRet <> 0) And (nRet <> ERROR_DATA_QUEUED)) Then
        MsgBox "ERROR " & CStr(nRet) & " calling InetSendSaveCmd."
    Else
        MsgBox "InetSendSaveCmd Executed."
    End If


InetSendSetRectCmd Example for Visual Basic

Dim nRet As Integer
    Dim SW_SHOW As Integer
    SW_SHOW = 0
    nRet = LEADNet1.InetSendSetRectCmd(999, 1, DISPLAY_RECT_DST, 0, 0, 100, 100)
    If ((nRet <> 0) And (nRet <> ERROR_DATA_QUEUED)) Then
        MsgBox "ERROR " & CStr(nRet) & " calling InetSendSetRectCmd."
    Else
        MsgBox "InetSendSetRectCmd Executed."
    End If


InetSendSetRectRsp Example for Visual Basic

Private Sub LEADNet1_InetReceiveCmd(ByVal iComputer As Integer, ByVal InetCommand As Integer, ByVal nCommandID As Long, ByVal nError As Integer, ByVal Params As LEADNetLibCtl.ILTInetPacket, ByVal nExtraDataSize As Long, ByVal ExtraData As Variant)
    Dim nRet As Integer
    Dim nStatus As Integer

    If (nError <> 0) Then
        nStatus = ERROR_TRANSFER_ABORTED
    Else
        Select Case InetCommand
            Case INETCMD_SET_RECT
                ' check the validity of the parameters
                If ((Params.ParamCount = 6) And (Params.ParamType(0) = PARAM_TYPE_UINT32) _
                   And (Params.ParamType(1) = PARAM_TYPE_INT32) _
                   And (Params.ParamType(2) = PARAM_TYPE_INT32) _
                   And (Params.ParamType(3) = PARAM_TYPE_INT32) _
                   And (Params.ParamType(4) = PARAM_TYPE_INT32) _
                   And (Params.ParamType(5) = PARAM_TYPE_INT32)) Then
                    'Note this is a function you must create
                    nStatus = ProcessSetRectCommand(Params.ParamValue(0), _
                              Params.ParamValue(1), _
                              Params.ParamValue(2), _
                              Params.ParamValue(3), _
                              Params.ParamValue(4), _
                              Params.ParamValue(5))
                    nRet = LEADNet1.InetSendSetRectRsp(nCommandID, 0, Null, nStatus)
                    Exit Sub
                End If
        End Select
    End If
    'return an error response
    LEADNet1.InetSendRsp InetCommand, nCommandID, Nothing, 0, Null, nStatus
End Sub


InetSendShowWinCmd Example for Visual Basic

Dim nRet As Integer
    Dim SW_SHOW As Integer
    SW_SHOW = 0
    nRet = LEADNet1.InetSendShowWinCmd(999, 1, SW_SHOW)
    If ((nRet <> 0) And (nRet <> ERROR_DATA_QUEUED)) Then
        MsgBox "ERROR " & CStr(nRet) & " calling InetSendShowWinCmd."
    Else
        MsgBox "InetSendShowWinCmd Executed."
    End If


InetSendShowWinRsp Example for Visual Basic

Private Sub LEADNet1_InetReceiveCmd(ByVal iComputer As Integer, ByVal InetCommand As Integer, ByVal nCommandID As Long, ByVal nError As Integer, ByVal Params As LEADNetLibCtl.ILTInetPacket, ByVal nExtraDataSize As Long, ByVal ExtraData As Variant)
    Dim nRet As Integer
    Dim nStatus As Integer

    If (nError <> 0) Then
        nStatus = ERROR_TRANSFER_ABORTED
    Else
        Select Case InetCommand
            Case INETCMD_SHOW_WIN
                ' check the validity of the parameters
                If ((Params.ParamCount = 2) And (Params.ParamType(0) = PARAM_TYPE_UINT32) _
                   And (Params.ParamType(1) = PARAM_TYPE_INT32)) Then
                    'Note this is a function you must create
                    nStatus = ProcessShowWinCommand(Params.ParamValue(0), Params.ParamValue(1))
                    nRet = LEADNet1.InetSendShowWinRsp(nCommandID, 0, Null, nStatus)
                    Exit Sub
                End If
        End Select
    End If
    'return an error response
    LEADNet1.InetSendRsp InetCommand, nCommandID, Nothing, 0, Null, nStatus
End Sub


InetSendSizeWinCmd Example for Visual Basic

Dim nRet As Integer

    nRet = LEADNet1.InetSendSizeWinCmd(999, 1, 0, 0, 100, 100)
    If ((nRet <> 0) And (nRet <> ERROR_DATA_QUEUED)) Then
        MsgBox "ERROR " & CStr(nRet) & " calling InetSendSizeWinCmd."
    Else
        MsgBox "InetSendSizeWinCmd Executed."
    End If


InetSendSizeWinRsp Example for Visual Basic

Private Sub LEADNet1_InetReceiveCmd(ByVal iComputer As Integer, ByVal InetCommand As Integer, ByVal nCommandID As Long, ByVal nError As Integer, ByVal Params As LEADNetLibCtl.ILTInetPacket, ByVal nExtraDataSize As Long, ByVal ExtraData As Variant)
    Dim nRet As Integer
    Dim nStatus As Integer

    If (nError <> 0) Then
        nStatus = ERROR_TRANSFER_ABORTED
    Else
        Select Case InetCommand
            Case INETCMD_SIZE_WIN
                ' check the validity of the parameters
                If ((Params.ParamCount = 5) And (Params.ParamType(0) = PARAM_TYPE_UINT32) _
                   And (Params.ParamType(1) = PARAM_TYPE_INT32) And (Params.ParamType(2) = PARAM_TYPE_INT32) _
                   And (Params.ParamType(3) = PARAM_TYPE_INT32) And (Params.ParamType(4) = PARAM_TYPE_INT32)) Then
                    'Note this is a function you must create
                    nStatus = ProcessSizeWinCommand(Params.ParamValue(0), Params.ParamValue(1), Params.ParamValue(2), Params.ParamValue(3), Params.ParamValue(4))
                    nRet = LEADNet1.InetSendSizeWinRsp(nCommandID, 0, Null, nStatus)
                    Exit Sub
                End If
        End Select
    End If
    'return an error response
    LEADNet1.InetSendRsp InetCommand, nCommandID, Nothing, 0, Null, nStatus
End Sub


InetSendSound Example for Visual Basic

' This example uses LEAD Capture control to capture audio from the microphone and send it to
'  a remote computer.  For Example of starting and stopping recording refer to the LEAD Capture
'  control documentation.

Private Sub StartRecord_Click()
  ' the capture doesn't have to be connected to use the following functions
  LEADCap1.CapAudioFormat (CAP_AUDIO_RECORD) = FILE_WAV_1M08
  ' open recording device
  LEADCap1.CapOpenRecord 0, 2, LEADCap1.CapWaveAvgBytesPerSec(CAP_AUDIO_RECORD)
  LEADCap1.CapStartRecord
End Sub

Private Sub LEADCap1_CapAudioData(ByVal pData As Variant, ByVal lBytesRecorded As Long)
   ' send sound to remote computer (items in SendList property)
   ' you should be connected to a remote computer first by using the
   ' InetConnect method of the Internet ActiveX
   LEADNet1.InetSendSound LEADCap1.CapWaveFormatTag (CAP_AUDIO_RECORD),  LEADCap1.CapWaveChannels (CAP_AUDIO_RECORD), _
      LEADCap1.CapWaveSamplesPerSec (CAP_AUDIO_RECORD), LEADCap1.CapWaveAvgBytesPerSec (CAP_AUDIO_RECORD), _
      LEADCap1.CapWaveBlockAlign (CAP_AUDIO_RECORD), LEADCap1.CapWaveBitsPerSample (CAP_AUDIO_RECORD), _
      LEADCap1.CapWaveExtraSize (CAP_AUDIO_RECORD), LEADCap1.CapWaveExtraData (CAP_AUDIO_RECORD), pData, lBytesRecorded
DoEvents
End Sub


InetServerClose Example for Visual Basic

Private Sub Form_Unload(Cancel As Integer)
    ' shutdown server on exit
    LEADNet1.InetServerClose hServer
End Sub


InetServerInit Example for Visual Basic

Private Sub Form_Load()
    ' initialize port 1000 to wait for connections
    LEADNet1.InetServerInit hServer, 1000
End Sub


Version History

Current version:	14.5
Last update:	October 13, 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 OCX has not changed from Version 14.


Changes from Version 13 to Version 14

Version 14 of the LEADTOOLS Internet OCX has not changed from Version 13.


Changes from Version 12.1 to Version 13

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


Changes from Version 12 to Version 12.1

Version 12.1 of the LEADTOOLS Internet OCX has not changed from Version.

Please note that the Internet properties, methods and events contained in this manual were previously located in the LEADTOOLS Multimedia OCX help file.

The LEADTOOLS Multimedia toolkits currently include many of the methods documented in the Ltnetocxn.hlp help file. This is the final version of the LEADTOOLS Multimedia toolkit that will contain those methods. In future releases, the methods documented in the Ltnetocxn.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 ActiveX has changed from version 11.5 as follows:

 LEADTOOLS now provides methods 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 audio streams has been added.

 Additional Windows NT compatibility is now provided.

The following are new methods in version 12.

InetReceiveCmd event

InetReceiveRsp event

InetSendAttachBitmapCmd method

InetSendAttachBitmapRsp method

InetSendCloseWinCmd method

InetSendCloseWinRsp method

InetSendCmd method

InetSendCreateWinCmd method

InetSendCreateWinRsp method

InetSendFreeBitmapCmd method

InetSendFreeBitmapRsp method

InetSendLoadCmd method

InetSendLoadRsp method

InetSendSaveCmd method

InetSendSaveRsp method

InetSendSetRectCmd method

InetSendSetRectRsp method

InetSendShowWinCmd method

InetSendShowWinRsp method

InetSendSizeWinCmd method

InetSendSizeWinRsp method

InetSendRsp method


Changes from Version 11 to Version 11.5

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


Changes from Version 10 to Version 11

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

 The Internet features now support MPEG-2.

The rest of this topic lists the new properties, methods and events in version 11.


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 Express, LEADTOOLS Document Express Suite and LEADTOOLS Medical Express.

 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 ActiveX has not changed from version 9.0.


Version 9.0

Version 9.0 is the first version of LEADTOOLS Internet ActiveX.

The rest of this topic lists the new properties, methods, and events in version 9.0.

ConnectList property (Inet Control)

ConnnectListNum property (Inet Control)

EnableMethodErrors property (Inet Control)

InetAccept event (Inet Control)

InetAcceptConnect method (Inet Control)

InetClearQueue method (Inet Control)

InetConnect method (Inet Control)

InetConnected event (Inet Control)

InetDataSent event (Inet Control)

InetDisconnect method (Inet Control)

InetDisconnected event (Inet Control)

InetError event (Inet Control)

InetGetData method (Inet Control)

InetGetHostName method (Inet Control)

InetQueueSize property (Inet Control)

InetReceiveBitmap event (Inet Control)

InetReceiveData event (Inet Control)

InetReceiveSound event (Inet Control)

InetReceiveStart event (Inet Control)

InetReceiving event (Inet Control)

InetSendBitmap method (Inet Control)

InetSendData method (Inet Control)

InetSendDIB method (Inet Control)

InetSending event (Inet Control)

InetSendSound method (Inet Control)

InetServerClose method (Inet Control)

InetServerInit method (Inet Control)

IsSupportLocked method (Inet Control)

SendList property (Inet Control)

SendListNum property (Inet Control)

UnlockSupport method (Inet Control)


Example Programs

Note:	You can run some of the example programs on your system by clicking the appropriate buttons in online help. An error message will appear if you try to run an example program that is not on your system, or if you try to run a Delphi example without Delphi on your system.
The executable files for these examples were compiled with Document/Medical capabilities.  To get Document/Medical capabilities, you must buy a LEADTOOLS Document/Medical toolkit.  To get Internet capabilities, you must buy one of the toolkits which includes the Internet features.  Otherwise, if you recompile the examples, the resulting executable files will not have the Document/Medical or Internet capabilities.

Visual C++ 4.0

 EXAMPLES\OCX\MFC40\NETCAP contains a sample application that demonstrates most of the Internet capabilities in the Visual C++ 4.0 environment. You can open the project in Visual C++; then compile and run it.
Click here [image] to run the WIN32 version of this example.

Visual Basic

 EXAMPLES\OCX\VB\NETCAP32 contains a sample application that demonstrates most of the Internet capabilities in the Visual Basic 5.0 environment. You can open the project in Visual Basic; then compile and run it.
Click here [image] to run the WIN32 version of this example.

Delphi 2.0

 EXAMPLES\OCX\DELPHI\NETCAP contains a sample application that demonstrates most of the Capture capabilities in the Delphi 2.0 environment. To run the sample application, you can run the EXE file in LEAD's BIN directory.
Click here [image] to run the WIN32 version of this example.