Click here to Skip to main content
15,913,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: bad and fail of steam Pin
Hamid_RT17-Feb-08 19:35
Hamid_RT17-Feb-08 19:35 
GeneralRe: bad and fail of steam Pin
George_George18-Feb-08 1:11
George_George18-Feb-08 1:11 
GeneralRe: bad and fail of steam Pin
CPallini17-Feb-08 22:13
mveCPallini17-Feb-08 22:13 
GeneralRe: bad and fail of steam Pin
George_George18-Feb-08 1:06
George_George18-Feb-08 1:06 
GeneralVista SDK Build Problem Pin
Akin Ocal17-Feb-08 12:40
Akin Ocal17-Feb-08 12:40 
QuestionEasiest way to change owner on all object's child objects ? Pin
vilius_m17-Feb-08 9:20
vilius_m17-Feb-08 9:20 
Questiongame keyboard simulation Pin
Spleshmen17-Feb-08 8:19
Spleshmen17-Feb-08 8:19 
GeneralRe: game keyboard simulation Pin
Randor 18-Feb-08 8:13
professional Randor 18-Feb-08 8:13 
GeneralRe: game keyboard simulation Pin
Spleshmen19-Feb-08 1:49
Spleshmen19-Feb-08 1:49 
QuestionSimple socks TCP connecting Pin
Johpoke17-Feb-08 4:18
Johpoke17-Feb-08 4:18 
GeneralRe: Simple socks TCP connecting Pin
Moak21-Feb-08 12:11
Moak21-Feb-08 12:11 
GeneralRe: Simple socks TCP connecting Pin
Johpoke22-Feb-08 4:30
Johpoke22-Feb-08 4:30 
GeneralRe: Simple socks TCP connecting Pin
Moak22-Feb-08 4:42
Moak22-Feb-08 4:42 
GeneralRe: Simple socks TCP connecting Pin
Johpoke23-Feb-08 2:37
Johpoke23-Feb-08 2:37 
GeneralRe: Simple socks TCP connecting Pin
Moak26-Feb-08 0:08
Moak26-Feb-08 0:08 
GeneralRe: Simple socks TCP connecting Pin
Johpoke29-Feb-08 21:55
Johpoke29-Feb-08 21:55 
GeneralRe: Simple socks TCP connecting Pin
Moak29-Feb-08 22:52
Moak29-Feb-08 22:52 
QuestionRe: Simple socks TCP connecting Pin
Moak23-Feb-08 3:01
Moak23-Feb-08 3:01 
GeneralRe: Simple socks TCP connecting Pin
Johpoke23-Feb-08 3:06
Johpoke23-Feb-08 3:06 
GeneralRe: Simple socks TCP connecting Pin
Moak26-Feb-08 0:34
Moak26-Feb-08 0:34 
Questionproblems with cap and vfw Pin
cmos17-Feb-08 4:09
cmos17-Feb-08 4:09 
Hello,
i have problems connection my webcam. I usw the video for windows (vfw.h).
Sometimesit works, i can see the live view and sometimes it doesnt work.

I have a main dialog and a setup dialog. when i push "setup" my setup dialog appears.
There, the use can choose the driver. I get the drivers by
<br />
for(int i = 0; i < 9; i++)<br />
{<br />
    if(capGetDriverDescription(i,sName.GetBuffer(),sName.GetAllocLength(),<br />
                               sVersion.GetBuffe(),sVersion.GetAllocLength()))<br />
    {			<br />
        m_Drivers.Add(sName);				 <br />
    }<br />
}<br />


in my main dialog there is a picture control element.
with GetClientRect i get the rect of this control and
fix it with ScreenToClient(&rect);
After that the InitCamera function is called.
<br />
void CUSBCamera::InitCamera(HWND HParent, int iDriverID, DWORD dwWidth, DWORD dwHeight, CRect rect)<br />
{<br />
   m_hwndCap = capCreateCaptureWindow("USB-Camera",WS_CHILD | WS_VISIBLE,rect.TopLeft   <br />
   ().x,rect.TopLeft().y,rect.Width(),rect.Height(),m_ParentWindowHandle,999);<br />
<br />
   m_ParentWindowHandle  = HParent;	<br />
   m_iDriverID		= iDriverID;<br />
   m_dwWidth		= dwWidth;<br />
   m_dwHeight		= dwHeight;<br />
   m_Rect			= rect;<br />
  <br />
   capSetCallbackOnError(m_hwndCap, NULL);<br />
   capSetCallbackOnCapControl(m_hwndCap,NULL);<br />
   capSetCallbackOnStatus(m_hwndCap, NULL);   <br />
   capSetCallbackOnFrame(m_hwndCap, NULL); <br />
   capSetCallbackOnVideoStream(m_hwndCap, NULL);<br />
   capSetCallbackOnCapControl(m_hwndCap, NULL);		<br />
   capSetCallbackOnWaveStream(m_hwndCap, NULL);<br />
   capSetCallbackOnYield(m_hwndCap, NULL);<br />
}<br />


Finished that, the connect function is called
<br />
BOOL CUSBCamera::Connect(LPFRAME_CALLBACK_PROC lpFrameCallback, LPVOID userData)<br />
{		<br />
	// connect to driver<br />
	if(capDriverConnect(m_hwndCap,m_iDriverID) && m_iDriverID >= 0)<br />
	{<br />
		// set callbakc function<br />
		capSetCallbackOnFrame(m_hwndCap,lpFrameCallback);		<br />
		// set userdate to corresponding hwnd<br />
		capSetUserData(m_hwndCap,userData);<br />
	 <br />
		//// set video format<br />
		DWORD dwSize;					<br />
		dwSize = capGetVideoFormatSize(m_hwndCap);<br />
		// allocate memory for bitmapinfo structure<br />
		m_lpbi = (LPBITMAPINFO)malloc(sizeof(BITMAPINFO));		<br />
		<br />
	<br />
		capGetVideoFormat(m_hwndCap, m_lpbi, dwSize); <br />
		m_lpbi->bmiHeader.biWidth  = m_dwWidth;<br />
		m_lpbi->bmiHeader.biHeight = m_dwHeight;<br />
		<br />
		capSetVideoFormat(m_hwndCap,m_lpbi,dwSize);					<br />
<br />
		capDriverDisconnect(m_hwndCap);                   //?<br />
		capDriverConnect(m_hwndCap,m_iDriverID);          //?<br />
		<br />
		capPreviewRate(m_hwndCap,100);<br />
		capPreview(m_hwndCap,TRUE);<br />
<br />
<br />
	// free memory<br />
	free(m_lpbi);<br />
	}<br />
	else <br />
	{<br />
		::MessageBox(NULL,_T("Es ist ein Fehler aufgetreten"),_T("Fehler"),MB_OK);<br />
		::DestroyWindow(m_hwndCap);<br />
		return FALSE;<br />
	}<br />
	return TRUE;<br />
}<br />


My problem is, when i press update in my setup dialog i can choose just one driver.
Its the Windows WDM Capture (Win32).
Then i choose this driver press the apply button and i return back to the main dialog.
Well sometimes i see a picture from my webcam and sometimes its just black. i dont see anything.

Is there a certain order to initialize the camera ? And why do I have only just one driver in my list ? My graphicscard has a video in/out interface.

This makro capDlgVideoSource doestn work. With other applications i can connect to my webcam.
But with my try it's just a matter of luck getting access to it or not.
Well, one or two times it worked and i got this dialog. But choosing my webcam from the list
didnt change anything. Still had this black window i've created with capCreateCaptureWindow

If possible i want to avoid using the capDlgVideoSource dialog.

Please help me.
QuestionRe: problems with cap and vfw Pin
cmos17-Feb-08 5:02
cmos17-Feb-08 5:02 
GeneralRe: problems with cap and vfw Pin
Mark Salsbery17-Feb-08 9:46
Mark Salsbery17-Feb-08 9:46 
AnswerRe: problems with cap and vfw Pin
cmos17-Feb-08 10:07
cmos17-Feb-08 10:07 
GeneralRe: problems with cap and vfw Pin
Mark Salsbery17-Feb-08 10:21
Mark Salsbery17-Feb-08 10:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.