PDA

View Full Version : Image and AVI-Capture Example in VB6



nick_s
January 25, 2011, 11:23:28
Hi
I need to take a .jpg image while recording to .avi
There is a .net example for this using a framefilter:
http://www.imagingcontrol.com/en_US/library/dotnet/image-and-avi-capture/
I am using VB6 though. I think it should be possible in VB6 too?

I have something like this:


Dim frafilter As FrameFilter

Private Sub Form_Load()
Set frafilter = icimagingcontrol1.FrameFilterCreateString("Save Image", "")
icimagingcontrol1.DeviceFrameFilters.Add frafilter
frafilter.Parameter("Enable") = True
End Sub

Private Sub snapimg_Click()
frafilter.BeginParameterTransfer
frafilter.Parameter("ImageName") = "i:\image.jpg"
frafilter.EndParameterTransfer
End Sub


(LiveVideo is started)

I get an error:
"Unzulässiger Prozeduraufruf oder ungültiges Argument."
in line:
frafilter.Parameter("ImageName") = "i:\image.jpg"
What im I doing wrong? How do i have to pass the imagename parameter in vb6? Please help.

Stefan Geissler
January 27, 2011, 09:50:50
Hello

I am very sorry, but you must wait a little bit for the answer. I must find a computer, that has the outdated VB6 installed first.

nick_s
February 14, 2011, 14:20:44
Some things should never end. Support for VB6 for example... There are lots of people who are too stupid (and too old) to learn any other programming language :curl-lip:

I use a (very) dirty workaround for now: Taking screenshots of the LiveWindow... :silly:
It works, but of course i'm not really happy with it...

For anyone desperate enough to try this "solution": I use a freeware tool called "Minicap" to automate the screenshots. It has a powerful command line, and lets you save defined areas of the screen directly to jpg.

Stefan Geissler
February 14, 2011, 14:51:23
Some things should never end. Support for VB6 for example... There are lots of people who are too stupid (and too old) to learn any other programming language :curl-lip:


This sounds like leaded fuel.



I use a (very) dirty workaround for now: Taking screenshots of the LiveWindow... :silly:
It works, but of course i'm not really happy with it...


No good idea. The filter must work. Did you check, whether the filter was loaded at all? I.e. it is not nothing?

nick_s
February 14, 2011, 15:21:44
This sounds like leaded fuel.
:-)

Did you check, whether the filter was loaded at all? I.e. it is not nothing?
Yes, i checked: The filter is loaded, not nothing.
And it does accept the parameter "Enable". It still does not accept the parameter "ImageName"...

Stefan Geissler
February 14, 2011, 16:56:51
Hello,

The original C++ code for the parameter is:
m_pSaveImageFilter->setParameter("ImageName",std::string(szImageFileName));


And it seems, an "Enable" does not exist. I will try to find a computer running VB6 in the next days and check,what is going on.

Stefan Geissler
February 17, 2011, 12:44:14
Hello,

I created a similar sample like yours:

Option Explicit

Dim SaveImageFilter As FrameFilter

Private Sub cmdSaveImage_Click()
SaveImageFilter.Parameter("ImageName") = "b:\image.jpg"
End Sub

Private Sub Form_Load()
With ICImagingControl1
.ShowDeviceSettingsDialog
If .DeviceValid = True Then
Set SaveImageFilter = .FrameFilterCreateString("Save Image", "")

If SaveImageFilter Is Nothing Then
MsgBox "Failed to load Save Image filter"
Else
.DeviceFrameFilters.Add SaveImageFilter
End If
.LiveStart
End If
End With
End Sub

It works fine. Maybe we have different versions of the "SaveImageFrameFilter.FTF" file. Thus I zipped the VB6 project including the frame filter and attached it to this post. Please move the "SaveImageFrameFilter.FTF" into the directory where "icimagingcontrol.ocx" resides. This is "C:\Programme\Gemeinsame Dateien\IC Imaging Control 3\" resp, "C:\Program Files\Common Files\IC Imaging Control 3\"

Also I would like to know, whether the path "i:\" exists on your computer and whether it is writeable.

nick_s
February 18, 2011, 16:27:18
Thank you Stefan.
No luck on my PC :confused: I get the same error with your example and your file version.
The path is valid and writeable (for some reason, Windows XP is installed on i:\ on this machine, but this should not be a problem).

Stefan Geissler
February 18, 2011, 16:42:09
I suggest to remove the "i:\". However the very same software works fine on my machine. Thus I am puzzled. Did you copy the ftf file to the correct location?