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 RasterView Control to your project.

 

For VB5: On the Project pull-down menu, use the Components option, and select the LEAD RasterView Control (14.0).

3.

Select the LEAD RasterView 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 Bitmap

5.

Add the LEAD RasterIO Object and LEAD RasterProcess Object to your project.

 

For VB5: On the Project pull-down menu, use the References option, and select the LEAD RasterIO Object Library (14.0) and LEAD RasterProcess Object Library (14.0).

6.

Define the following at the form level:

Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long

7.

Code the Send_Click procedure as follows:

Private Sub Send_Click()
   Dim RasterIO As New LEADRasterIO
   Dim RasterProc As New LEADRasterProcess
   Dim hDIB As Long

   If (LEADRasterView1.Raster.Bitmap = 0) Then
      RasterIO.Load LEADRasterView1.Raster, "o:\images\new\001.jpg", 0, 1, 1
   End If
   RasterProc.Flip LEADRasterView1.Raster
   'send the images to the remote computer
   hDIB = LEADRasterView1.Raster.GetDIB
   LEADNet1.InetSendDIB hDIB, FILE_CMP, 24, 75
   GlobalFree hDIB
End Sub

8.

Run your program to test it.

9.

Make an EXE from this tutorial to use as a server for other tutorials.