webcam

Hi,

I had a requirement that requires webcam to be use in XOJO (web and windows).
Anybody had tried it before?

Kindly please provide me resource on how it can be done.

Thanks so much for the help.

Hi,
Here a project i have made…(webcam capture on windows).
webcam_app.xojo_binary_project
I saw on this forum a code for webcam capture(for a ‘html site’) … but can’t find it easy(html5 ?)
The code below is a copy and paste from the old forum.
Here another link (flash webcam)… flash
Good luck !


Put a Canvas object called plaat on your app and put the code below
in your window1 open event and see if it works(for windows)…


Declare Function capCreateCaptureWindowA lib "avicap32.dll" (lpszWindowName as integer,dwStyle as Integer,x as integer,y as integer,nWidth as integer,nHeight as integer,hWndParent as integer,nID as integer)as integer

Declare Function SendMessage lib "user32" alias "SendMessageA"(hwnd as integer,wMsg as integer,wParam as integer,lParam as integer)AS integer

dim cap as integer

cap=capCreateCaptureWindowA(0,BITOR(&h10000000,&H40000000),0,0,400,500,plaat.handle,0)
dim z as integer

z=SendMessage (cap,1034,0,0)
z=SendMessage (cap,1077,1,0)
z=SendMessage (cap,1076,20,0)
z=SendMessage (cap,1074,1,0)

This next code is to save a picture from the webcam(windows).Put the code below under a button (when the code above is already implemented)and and replace the integers cap and z to :“add property”.Here is the code …


Declare Function SendMessage lib "user32" alias "SendMessageA"(hwnd as integer,wMsg as integer,wParam as integer,lParam as CSTRING)AS integer



DIM START AS INTEGER
DIM SAVE AS INTEGER
DIM G AS INTEGER

START =&H400
G=START+61
SAVE =START+25

z=SendMessage(cap,G,0,"0")
z=SendMessage(cap,SAVE,0,"C:\\APICTURE.exttest")


Thank you very much!

Now I know.

its not working only black screen showing
plz help

Hi,

For windows I use CommandCam project that you can download from Github:
https://github.com/tedburke/CommandCam

How to use …? Following is an example of code

`

Sub GetPicture()

dim sPath,sCam as String
dim f,g as FolderItem

//Vars
f=GetFolderItem("")
sPath=f.Parent.AbsolutePath
frmMain.imgPhoto.Image=Nil

g=GetFolderItem(sPath + “YourPic.jpg”)

//Check if folder exists
if g<>Nil and f.Exists then
g.Delete
end if

//Your CommandCam.exe allocated in your folder application
sCam=“CommandCam /quiet /filename Face.jpg”

//Calling commandcam
frmMain.WinShell.Execute("cd " + sPath)
frmMain.WinShell.Execute(sCam)

End Sub

`

Too bad it’s GPL 3

MBS Plugin for DirectShow can do webcam recording.

see
http://www.monkeybreadsoftware.de/xojo/plugins.shtml

Why did you start a new thread at https://forum.xojo.com/32315-camera-not-working-in-win-10 instead of answsering the simple questions that were asked here ? How do you expect people to help if you give absolutely no detail about the type of camera, and post the code you are using ?

You need to help people help you.

Hello,

I downloaded http://109.235.76.86/webcam_app.xojo_binary_project as Frederik recommended.

It works fine except that once I click “Try to connect webcam(Click this button some more times if not connected by the first click.)” button the webcam is automatically selected and the video stream starts, I have only one video device attached.

If I close the app and launch it again, when I click that button the “Video Source” window is displayed requesting a selection be made for a video device.
I have no other video device attached so the only option available is the one I have.
When I select that one and click on “OK”, “Cancel” or “Apply” and then try to connect again it brings up that same window.

I have to reboot the computer again before it works.

How than I fix that?

This is the code in the pushbutton…
Declare Function SendMessage lib “user32” alias “SendMessageA”(hwnd as integer,wMsg as integer,wParam as integer,lParam as integer)AS integer

DIM START AS INTEGER
DIM G AS INTEGER

START = &H400
G = START+11

CALL SendMessage(CANVAS1.Handle,G,0,0)

Declare Function capCreateCaptureWindowA lib “avicap32.dll” (lpszWindowName as integer,dwStyle as Integer,x as integer,y as integer,nWidth as integer,nHeight as integer,hWndParent as integer,nID as integer)as integer

cap = capCreateCaptureWindowA(0,BITOR(&h10000000,&H40000000),0,0,300,200,canvas1.handle,0)

CALL SendMessage (cap,1034,0,0)
CALL SendMessage (cap,1077,1,0)
CALL SendMessage (cap,1076,20,0)
CALL SendMessage (cap,1074,1,0)

Thanks.

Lennox

Hi,

The code i have made in the webcam_app (free to use/modify/spread) is probally not correct…
I looked at my own code with doubt… the code for disconnect … is not working well.
I think you have to search for code with a search engine and port it to xojo
And if you are into it…and find also recording for the webcam (for example 10 seconds)… post the code here …thx
Goodluck

Hi Frederik,

Thanks for your project, it works fine for me except for the disconnect part. All I need it for is snapshots, I do not need video clips.

Apparently, this is how it’s done in VB, but I don’t know how to convert it, maybe someone here might be able to do that.
http://www.vbforums.com/showthread.php?344471-Vb-Net-WebCam-Class-(ICam)&p=2048466#post2048466

closeCam() - Allways call when closing the application, just clears things up.
VB Code:
myCam.CloseCam()

Thanks again.

Lennox