This wont take much explaining, as it's quite straight forward.
However:
To use this code, you must make a file called 'c:\out.txt" - containing one line: "c:\img.dib"
This is due to a problem with parsing the line 'c:\img.dib' into the memory, and having the handle to where we threw it. This is a stupid way to go about it, but I couldn't think of anything else, as I'm all burned out right now.
Anyway, with that file, it should work.
BTW: The lagging is due to the image beeing saved to the disk 'per frame' - a thing which can be improved as well (using the clipboard)
Please
share whatever you come up with based on this code.
rem Project: WebCam
Rem Created: 10-08-2004 12:05:07
Rem ***** Main Source File *****
load dll "c:\windows\system32\avicap32.dll",1
load dll "c:\windows\system32\user32.dll",2
rem hwnd = call dll (2,"GetActiveWindow")
rem call dll 2,"MessageBoxA",hwnd,"message","title",0
rem print hwnd
Name$="a"
Ver$=""
while Name$<>""
iReturn = call dll (1,"capGetDriverDescriptionA",x,Name$,100,Ver$,100)
if iReturn=1
print "Driver Number ",x," )"
print "Name: ",Name$
print Ver$
print " "
inc x
endif
endwhile
WS_CHILD=1073741824
WS_VISIBLE=268435456
WM_CAP_SET_SCALE = 1024+53
wm_cap_driver_connect=1024+10
wm_cap_set_preview=1024+50
WM_CAP_SET_PREVIEWRATE=1024+52
WM_CAP_EDIT_COPY=1024+30
WM_CAP_SEQUENCE=1024+62
WM_CAP_FILE_SAVEDIB=1024+25
WM_CAP_DLG_VIDEODISPLAY=1024+43
WM_CAP_SET_OVERLAY=1024+51
driver=0
input "Please select which driver you want to use - 0 usualy works the best: ",driver
visible=1
picid = call dll (2,"GetActiveWindow")
hHwnd = call dll (1,"capCreateCaptureWindowA","driver",WS_VISIBLE Or WS_CHILD,0,0,1,1,picid,0)
overlay=1
call dll 2,"SendMessageA",hHwnd,wm_cap_driver_connect,0,0
call dll 2,"SendMessageA",hHwnd,wm_cap_set_preview,overlay,0
call dll 2,"SendMessageA",hHwnd,WM_CAP_SET_PREVIEWRATE,30,0
rem Copy the current image to the Clipboard - as BMP
rem call dll 2,"SendMessageA",hHwnd,WM_CAP_EDIT_COPY,1,0
rem record an AVI to c:\capture.avi
rem call dll 2,"SendMessageA",hHwnd,WM_CAP_SEQUENCE,1,0
rem THIS NEEDS TO BE REPLACED!!!!
rem THIS IS NEEDED, as the DLL must have a handle ('plane') to where the name of the output file is located.
open to read 1,"C:\out.txt"
make memblock from file 1,1
plane=get memblock ptr(1)
print "Memblock ptr: ",plane
make object cube 1,50
sync on
do
if file exist("c:\img.dib") then delete file "c:\img.dib"
call dll 2,"SendMessageA",hHwnd,WM_CAP_FILE_SAVEDIB,0,plane
rem load bitmap "c:\navn.dib",0
load image "c:\img.dib",1
texture object 1,1
rotate object 1,x,y,0
inc x,5
inc y,7
sync
loop