Web Camera in Windows 8.1
Web Camera in Windows 8.1
How do you enable your web cam in Windows 8.1? The usual way produces a black screen and disallows us to connect to the avicap32.dll driver? Some places say you need a manifest. Thanks.
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Web Camera in Windows 8.1
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Web Camera in Windows 8.1
http://www.purebasic.fr/english/viewtop ... 13&t=43670akee wrote:How do you enable your web cam in Windows 8.1? .
Re: Web Camera in Windows 8.1
Ok, I checked OpenCV. Thanks for the response guys...
OpenCV is a bit of an overkill for my project. All I need is to invoke the dialog (like in Camera) to allow access to avicap32.dll capDriverConnect() and the WebCam... and I'm done. How do you do that?
Currently, I need to open an existing program like Camera, then only run my program.
OpenCV is a bit of an overkill for my project. All I need is to invoke the dialog (like in Camera) to allow access to avicap32.dll capDriverConnect() and the WebCam... and I'm done. How do you do that?
Currently, I need to open an existing program like Camera, then only run my program.
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Web Camera in Windows 8.1
Need more info from you
1) What exactly is "Camera"? Is it a Windows8.1 utility app? Or is it an app that is delivered with your specific web cam?
2) What is your exact OS?
3) What is your exact Web Cam device?
4) Your program - what does it do? Connect to the Web Cam?
1) What exactly is "Camera"? Is it a Windows8.1 utility app? Or is it an app that is delivered with your specific web cam?
2) What is your exact OS?
3) What is your exact Web Cam device?
4) Your program - what does it do? Connect to the Web Cam?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Web Camera in Windows 8.1
Hi IdeasVacuum,
a. Camera is the camera on your laptop.
b. Win 8.1 pro 64-bit.
c. The source dialog says Integrated Webcam.
d. 1. OpenLibrary(0, "avicap32.dll")
2. webcam_preview = capCreateCaptureWindow("webcam", #WS_CHILD | #WS_VISIBLE, 10, 50, 320, 240, WindowID(win_camera_handle), 0)
3. capDriverConnect(webcam_preview) <--- It fails here @ SendMessage_(lwnd, #WM_CAP_DRIVER_CONNECT, 0, 0)
... for it to pass #3, you must open up an app like Camera then only run my .exe. You then close the Camera app to pass camera control to my program...
Thanks...
a. Camera is the camera on your laptop.
b. Win 8.1 pro 64-bit.
c. The source dialog says Integrated Webcam.
d. 1. OpenLibrary(0, "avicap32.dll")
2. webcam_preview = capCreateCaptureWindow("webcam", #WS_CHILD | #WS_VISIBLE, 10, 50, 320, 240, WindowID(win_camera_handle), 0)
3. capDriverConnect(webcam_preview) <--- It fails here @ SendMessage_(lwnd, #WM_CAP_DRIVER_CONNECT, 0, 0)
... for it to pass #3, you must open up an app like Camera then only run my .exe. You then close the Camera app to pass camera control to my program...
Thanks...
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Web Camera in Windows 8.1
Aha, with you now. I think the Camera software is registered as the 'first choice'. In Win8.1, go to Control Panel/Default Programs/Set Default Programs.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Web Camera in Windows 8.1
Hmmm.... on my PC, Camera or my program is not even listed...IdeasVacuum wrote:Aha, with you now. I think the Camera software is registered as the 'first choice'. In Win8.1, go to Control Panel/Default Programs/Set Default Programs.
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Web Camera in Windows 8.1
Hmm, tricky! For your program to be listed, it probably needs to be installed, with a registry entry, but in theory you should be able to browse to your exe file and select it.
It seems there are known issues with the MS Camera App which occur when Win8 is upgraded to Win8.1.
Web Cam only shows black screen
Basically, first job is to ensure that you have the latest web cam driver installed from the manufacturer of your laptop/PC/Web Cam.
I can see one snag is that MS Camera is a Metro (Modern) App, whilst yours is a Desktop App.
This article might be the answer: Win 8.1 How to Set Which Apps May Use the Webcam
It seems there are known issues with the MS Camera App which occur when Win8 is upgraded to Win8.1.
Web Cam only shows black screen
Basically, first job is to ensure that you have the latest web cam driver installed from the manufacturer of your laptop/PC/Web Cam.
I can see one snag is that MS Camera is a Metro (Modern) App, whilst yours is a Desktop App.
This article might be the answer: Win 8.1 How to Set Which Apps May Use the Webcam
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Web Camera in Windows 8.1
> How do you enable your web cam in Windows 8.1?
I've been using this forever (mod of someone else's code).
Test it with 8.1 and see if it works, and please report back.
I've been using this forever (mod of someone else's code).
Test it with 8.1 and see if it works, and please report back.
Code: Select all
UseJPEGImageEncoder()
Procedure SaveWebcamSnapshot(file$,w=640,h=480)
lib=OpenLibrary(#PB_Any,"avicap32.dll")
If lib
camwin=OpenWindow(#PB_Any,0,0,0,0,"",#PB_Window_Invisible)
If camwin
hwnd=CallFunctionFast(GetFunction(lib,"capCreateCaptureWindowA"),@"",#WS_CHILD|#WS_VISIBLE,0,0,w,h,WindowID(camwin),0)
If hwnd
c$=GetClipboardText() ; Because contents get destroyed by #WM_CAP_EDIT_COPY.
connect=SendMessage_(hwnd,#WM_CAP_DRIVER_CONNECT,0,0) : Sleep_(125)
copy=SendMessage_(hwnd,#WM_CAP_EDIT_COPY,0,0) : Sleep_(125)
If connect And copy
img=GetClipboardImage(#PB_Any)
If img
ResizeImage(img,w,h) : ok=SaveImage(img,file$,#PB_ImagePlugin_JPEG) : FreeImage(img)
EndIf
SendMessage_(hwnd,#WM_CAP_DRIVER_DISCONNECT,0,0) : DestroyWindow_(hwnd)
EndIf
SetClipboardText(c$) ; Restore previous clipboard text.
EndIf
CloseWindow(camwin)
EndIf
CloseLibrary(lib)
EndIf
ProcedureReturn ok
EndProcedure
Debug SaveWebcamSnapshot("c:\webcam.jpg")
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Re: Web Camera in Windows 8.1
IdeasVacuum & PB... Both methods did not work...
Let me try if there is another driver I can use instead of the default Microsoft one.
Re: Web Camera in Windows 8.1
> Both methods did not work
So, which part of my code failed?
Did the webcam turn on it?
Was an image created?
Did it not save?
Give us a clue.
So, which part of my code failed?
Did the webcam turn on it?
Was an image created?
Did it not save?
Give us a clue.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Re: Web Camera in Windows 8.1
PB,
It always fails here...
connect=SendMessage_(hwnd,#WM_CAP_DRIVER_CONNECT,0,0)
It always fails here...
connect=SendMessage_(hwnd,#WM_CAP_DRIVER_CONNECT,0,0)
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Web Camera in Windows 8.1
Actually PB, it fails on my WinXP PC - the image captured is just black, and fails on my Win8.1 laptop - no image file saved. Both cases run from PB IDE, no errors reported.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Web Camera in Windows 8.1
I wonder how OpenCV does it? The camera is ok if I run their examples but we cannot read the .lib file... 

