Click here to Skip to main content
15,890,579 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: problems with cap and vfw Pin
cmos17-Feb-08 10:59
cmos17-Feb-08 10:59 
GeneralRe: problems with cap and vfw Pin
Mark Salsbery17-Feb-08 13:06
Mark Salsbery17-Feb-08 13:06 
GeneralChanging the height of a CstatusBar Pin
Stan the man17-Feb-08 4:05
Stan the man17-Feb-08 4:05 
GeneralRe: Changing the height of a CstatusBar Pin
Iain Clarke, Warrior Programmer18-Feb-08 3:07
Iain Clarke, Warrior Programmer18-Feb-08 3:07 
GeneralRe: Changing the height of a CstatusBar Pin
Stan the man18-Feb-08 3:19
Stan the man18-Feb-08 3:19 
QuestionHow can i use CFtpConnection object in asynchronous way ? Pin
Yanshof17-Feb-08 3:22
Yanshof17-Feb-08 3:22 
AnswerRe: How can i use CFtpConnection object in asynchronous way ? Pin
Mark Salsbery17-Feb-08 8:40
Mark Salsbery17-Feb-08 8:40 
QuestionHow to change font size of menu bar? Pin
hanlei000000000917-Feb-08 3:03
hanlei000000000917-Feb-08 3:03 
AnswerRe: How to change font size of menu bar? Pin
Rajkumar R17-Feb-08 5:53
Rajkumar R17-Feb-08 5:53 
AnswerRe: How to change font size of menu bar? Pin
Hamid_RT18-Feb-08 7:26
Hamid_RT18-Feb-08 7:26 
Generaldllimport Pin
George_George17-Feb-08 0:39
George_George17-Feb-08 0:39 
GeneralRe: dllimport Pin
Rajkumar R17-Feb-08 1:01
Rajkumar R17-Feb-08 1:01 
GeneralRe: dllimport Pin
George_George17-Feb-08 2:01
George_George17-Feb-08 2:01 

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.