MFC未定义标示符
下面代码出现未定义标示符“hWndC”错误,初学请高手帮忙!#include"cameraDlg.h"voidCTesterDlg::OnBnClickedButtonY...
下面代码出现 未定义标示符“hWndC”错误,初学请高手帮忙!
#include "cameraDlg.h"
void CTesterDlg::OnBnClickedButtonY2()
{
// TODO: 在此添加控件通知处理程序代码
//char name[100];
CRect rect;
GetDlgItem(IDC_STATIC)->GetWindowRect(&rect);
ScreenToClient(&rect);
hWndC = capCreateCaptureWindowA("Capture Window",WS_CHILD | WS_VISIBLE ,
rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,this->m_hWnd,0);
// capDriverGetName(hWndC,name);
if (hWndC != 0)
{
::SendMessage(hWndC, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0);
::SendMessage(hWndC, WM_CAP_SET_CALLBACK_ERROR, 0, 0);
::SendMessage(hWndC, WM_CAP_SET_CALLBACK_STATUSA, 0, 0);
::SendMessage(hWndC, WM_CAP_DRIVER_CONNECT, 0, 0);
::SendMessage(hWndC, WM_CAP_SET_SCALE, 1, 0);
::SendMessage(hWndC, WM_CAP_SET_PREVIEWRATE, 66, 0);
::SendMessage(hWndC, WM_CAP_SET_OVERLAY, 1, 0);
::SendMessage(hWndC, WM_CAP_SET_PREVIEW, 1, 0);
}
}
------------------------------------------------------------------------------------------------------------------------------
下面是头文件cameraDlg.h
// cameraDlg.h : header file
//
#if !defined(AFX_CAMERADLG_H__951661F5_65FF_450D_8549_1689780270E4__INCLUDED_)
#define AFX_CAMERADLG_H__951661F5_65FF_450D_8549_1689780270E4__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CCameraDlg dialog
class CCameraDlg : public CDialog
{
// Construction
public:
HWND hWndC;
CCameraDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CCameraDlg)
enum { IDD = IDD_TESTER_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCameraDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CCameraDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void Onstart();
afx_msg void Onsave();
afx_msg void Onstop();
afx_msg void Onexit();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // !defined(AFX_CAMERADLG_H__951661F5_65FF_450D_8549_1689780270E4__INCLUDED_) 展开
#include "cameraDlg.h"
void CTesterDlg::OnBnClickedButtonY2()
{
// TODO: 在此添加控件通知处理程序代码
//char name[100];
CRect rect;
GetDlgItem(IDC_STATIC)->GetWindowRect(&rect);
ScreenToClient(&rect);
hWndC = capCreateCaptureWindowA("Capture Window",WS_CHILD | WS_VISIBLE ,
rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,this->m_hWnd,0);
// capDriverGetName(hWndC,name);
if (hWndC != 0)
{
::SendMessage(hWndC, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0);
::SendMessage(hWndC, WM_CAP_SET_CALLBACK_ERROR, 0, 0);
::SendMessage(hWndC, WM_CAP_SET_CALLBACK_STATUSA, 0, 0);
::SendMessage(hWndC, WM_CAP_DRIVER_CONNECT, 0, 0);
::SendMessage(hWndC, WM_CAP_SET_SCALE, 1, 0);
::SendMessage(hWndC, WM_CAP_SET_PREVIEWRATE, 66, 0);
::SendMessage(hWndC, WM_CAP_SET_OVERLAY, 1, 0);
::SendMessage(hWndC, WM_CAP_SET_PREVIEW, 1, 0);
}
}
------------------------------------------------------------------------------------------------------------------------------
下面是头文件cameraDlg.h
// cameraDlg.h : header file
//
#if !defined(AFX_CAMERADLG_H__951661F5_65FF_450D_8549_1689780270E4__INCLUDED_)
#define AFX_CAMERADLG_H__951661F5_65FF_450D_8549_1689780270E4__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CCameraDlg dialog
class CCameraDlg : public CDialog
{
// Construction
public:
HWND hWndC;
CCameraDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CCameraDlg)
enum { IDD = IDD_TESTER_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCameraDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CCameraDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void Onstart();
afx_msg void Onsave();
afx_msg void Onstop();
afx_msg void Onexit();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // !defined(AFX_CAMERADLG_H__951661F5_65FF_450D_8549_1689780270E4__INCLUDED_) 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
2个回答
展开全部
你引用了CameraDlg.h并不代表该类的成员变量直接可以使用啊。。
要不你就在CTesterDlg中重新定义HWND hWndC;
要不就实例化CCameraDlg cameraDlg;然后对该实例的cameraDlg.hWndC进行操作
要不你就在CTesterDlg中重新定义HWND hWndC;
要不就实例化CCameraDlg cameraDlg;然后对该实例的cameraDlg.hWndC进行操作
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询