Java/VB6 to VB.NET for IP WEBCAM capture

M

Marky Mapo

I have an IP webcam that uses an internal class "xplug" to function. A web
page with the following code will produce a picture:

<html>
<body>
<form action="/TVJVIEW.htm" method="POST">
<APPLET name="cvcs" CODEBASE="http://myip/" CODE="xplug.class" WIDTH=640
HEIGHT=480>
<param name="RemotePort" value=myport>
<param name="Timeout" value=5000>
<param name="RotateAngle" value=0>
<param name="PreviewFrameRate" value=2>
<param name="DeviceSerialNo" value="myserialno">
</APPLET>
</form>
</body>
</html

I want to work with this camera’s images from a VB.NET Windows application.

The manufacturer –Trendnet - gives guidance for writing VB6 programs using
an SDK entitled xplug.ocx. I have installed this on my system and it is
referenced in my project. When referenced it shows up as GIFLib. I have
included Imports GIFLib in my Form1. I have also declared the following
instance Dim CamTool As New GIF89Lib.Gif89a. I get all of the methods and
properties the SDK’s Help promises except two properties: Width and Height.

The VB6 sample documents from the manufacturer indicate that this code will
save a captured frame from the device:

Note: You should call Capture() method only after you successfully calling
Play() method.

xplug.RemoteHost = "myip"
xplug.RemotePort = myport
xplug.PreviewWidth = 640
xplug.Width = 640
xplug.PreviewHeight = 480
xplugHeight = 480
xplug.Play
xplug.Capture("c:\test.jpg")
xplug.Stop

I have translated this to VB.NET as follows:

Imports GIF89Lib
Imports System
Imports System.IO

Public Class Form1
Dim CamTool As New GIF89Lib.Gif89a

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
CamTool.RemoteHost = "myip/"
CamTool.RemotePort = myport
CamTool.PreviewWidth = 640
CamTool.PreviewHeight = 480
CamTool.Timeout = 5000
CamTool.RotateAngle = 0
CamTool.PreviewFrameRate = 2
CamTool.DeviceSerialNo = " myserialno"
TextBox1.Text = CamTool.GetConfig().ToString
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim file_name As String = "c:\test.jpg"
CamTool.Play()
TextBox2.Text = CamTool.Capture(file_name).ToString
CamTool.Stop()
End Sub

End Class

The getconfig() and capture() return return -1 upon success. When I debug I
get -1 for both the form load and the button click. But, I am not saving
anything.

Anyway I apologize for the tome. Does anyone see where I am missing anything
in this translation? Is there another approach that I could use to capture
the instantaneous image that is being presented in the original html/java
form?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top