Page 4 of 4

Posted: Wed Jul 28, 2004 12:09 am
by Sparkie
@Wolf - You're missing the SetWindowCallback. Add it just before you take the Snapshot()

Code: Select all

SetWindowCallback(@myWindowCallback())  
snapshot()
:)

Posted: Wed Jul 28, 2004 12:29 am
by Wolf
Oh yes :D

I now add it and work perfect.

Sparkie i always thank you for your nice helps :wink:


Best regards.

Posted: Wed Jul 28, 2004 12:34 am
by Sparkie
Always glad to help Wolf :)

I'll let you know if and when I find a better method of handling the Video Source window. :wink:

Re: Help with webcam or video stream

Posted: Tue Oct 20, 2009 11:47 pm
by real
Sorry for re-opening this topic... :oops:

Could anybody give me an example, how to change the resolution to 640 x 480 pixels without any dialogs... please? I'd like to make a snapshot in 640 x 480 and this is supported by the webcam, but standard webcam is a resolution of 352 x 288 pixels.

Thanks,
René

Re: Help with webcam or video stream

Posted: Wed Oct 21, 2009 2:52 am
by Sparkie
I believe WM_CAP_SET_VIDEOFORMAT will do what you want. I won't have time to try it out until this weekend.

Re: Help with webcam or video stream

Posted: Wed Oct 21, 2009 10:36 am
by real
Okay, I know that i have to pass it via SendMessage_() to the capture window, but I'm note sure about the parameters to use.

Re: Help with webcam or video stream

Posted: Thu Oct 22, 2009 12:38 am
by Sparkie
See if this helps you until I have time to finish the code.

Code: Select all

  bmi.BITMAPINFO
  bmi\bmiHeader\biSize = SizeOf(BITMAPINFOHEADER)
  ;Use zero parameters to get current struct size
  structSize = SendMessage_(hWndC, #WM_CAP_GET_VIDEOFORMAT, 0, 0)
  ;Now use corrected parameters to get info
  SendMessage_(hWndC, #WM_CAP_GET_VIDEOFORMAT, structSize, @bmi)
  ;Change to a valid size only or crash will occur
  bmi\bmiHeader\biWidth = 640
  bmi\bmiHeader\biHeight = 480
  bmi\bmiHeader\biSizeImage = bmi\bmiHeader\biHeight * bmi\bmiHeader\biWidth * 3
  bmi\bmiHeader\biBitCount = 24
  ;Set new size
  SendMessage_(hWndC, #WM_CAP_SET_VIDEOFORMAT, structSize, bmi)
  capW = bmi\bmiHeader\biWidth
  capH = bmi\bmiHeader\biHeight
  SetWindowPos_(hWndC, 0, 0, 0, capW, capH, #SWP_NOMOVE | #SWP_NOZORDER | #SWP_FRAMECHANGED)
  UpdateWindow_(hWndC)

Re: Help with webcam or video stream

Posted: Tue Dec 28, 2010 9:51 pm
by max_aigneraigner@web.de
doesn't function on windows 7
neither with PB nor c++..

alternative?