⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfrm.h

📁 WinCE下实现的罗技usb摄像头驱动程序 镜像启动後插入摄像头并输入驱动dll名称进行加载 附带测试程序
💻 H
字号:
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAINFRM_H__86B42A59_8435_4F4B_9238_13D701771A8D__INCLUDED_)
#define AFX_MAINFRM_H__86B42A59_8435_4F4B_9238_13D701771A8D__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "WebCamSDK.h"
#include "CameraCode.h"	
#include "mjpeg2bmp.h"

#include "TCPServer_CE.h"
#include "TCPCustom_CE.h"
#include "webcmd.h"

#define MAXSTILLFORMATS  15
// Returns number of elements
#define dim(x) (sizeof(x) / sizeof(x[0])) 

//
// Debug zone support
//
// Used as a prefix string for all debug zone messages.
#define DTAG        TEXT ("CamTest: ")

// Debug zone constants
#define ZONE_ERROR      DEBUGZONE(0)
#define ZONE_WARNING    DEBUGZONE(1)
#define ZONE_FUNC       DEBUGZONE(2)
#define ZONE_INIT       DEBUGZONE(3)
#define ZONE_TIMING     DEBUGZONE(4)

//----------------------------------------------------------------------
// Used for cross compile between Std. Win32 and CE
//
#ifdef _WIN32_WCE                     // If compiling for CE

#define LPCMDLINE LPWSTR
#define USECMDBAR  

#else                                 // compiling for NT

#define LPCMDLINE LPSTR
#define CommandBar_Height(a) 0
#ifdef UNICODE
#define _vstprintf vswprintf
#else
#define _vstprintf vsprintf
#endif //UNICODE

#endif //_WIN32_WCE_

//
// Debug zone support
//
#ifdef DEBUG
// Debug zone structure
DBGPARAM dpCurSettings = {
    TEXT("CamTest2"), {
    TEXT("Errors"),TEXT("Warnings"),TEXT("Functions"), TEXT("Init"),
	TEXT("Driver Calls"),TEXT("USBLoad"),TEXT("Thread"),TEXT("Frame Info"), 
	TEXT("Undefined"),TEXT("Undefined"),TEXT("Undefined"),TEXT("Undefined"),
    TEXT("Undefined"),TEXT("Undefined"),TEXT("Undefined"), TEXT("Undefined") },
    0x0003
};
#endif //DEBUG

#define PIC_LEFT   5
#define PIC_TOP    5

#define MAXFORMATS  15

//----------------------------------------------------------------------
// Generic defines and data types
//
struct decodeUINT {                            // structure associates
    UINT Code;                                 // messages 
                                               // with a function 
    LRESULT (*Fxn)(HWND, UINT, WPARAM, LPARAM);
}; 
struct decodeCMD {                             // structure associates
    UINT Code;                                 // menu IDs with a 
    LRESULT (*Fxn)(HWND, WORD, HWND, WORD);    // function
};

typedef struct
{
	WORD wFormat;
	WORD wFrame;
	TCHAR szFileName[MAX_PATH];
} STILLCAPDLGSTRUCT, *PSTILLCAPDLGSTRUCT;



class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
	CMainFrame();
	DECLARE_DYNCREATE(CMainFrame)

// Attributes
public:
	CFormView * pcurview;

	//网络通信相关变量	
	N_Packet P_RCV;					// 包缓冲区
	N_Packet P_SEND;				// 包缓冲区
// Operations
public:
	//网络相关函数
	// 底层网络信息交互
	void SendCMD(long cmd);											// 向PC发送命令信息	
	bool SendCMDData(long cmd, const char * pbuf , int len);			// 向PC发送命令数据	
	void ProcessWebCmd(void);	// 处理网络命令
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMainFrame)
	public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual BOOL DestroyWindow();
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CMainFrame();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:  // control bar embedded members

// Generated message map functions
public:
	//{{AFX_MSG(CMainFrame)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnMenuPreviewStart();
	afx_msg void OnMenuPreviewStop();
	afx_msg void OnMenuPreviewPause();
	afx_msg void OnMenuCapstillimage();
	afx_msg void OnMenuCamsetting();
	afx_msg void OnMenuStartnet();
	afx_msg void OnMenuClosenet();
	afx_msg void OnMenuTransSimage();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	// Format of 1, 1, 3 is 160x120 at 15 fps
	WORD wFmt;
	WORD wFrame;    
	WORD wInterval;

	int nFmtCount;
	FORMATPROPS Formats[MAXFORMATS];	
	
	int StreamToClientWindow (void);

private:
	//定义CTCPServer_CE对象
	CTCPServer_CE m_tcpServer;
	bool srvState;	

private:
	//客户端连接建立事件处理函数
	static void CALLBACK OnClientConnect(CWnd* pWnd,CTCPCustom_CE *pTcpCustom);
	//客户端SOCKET关闭事件处理函数
	static void CALLBACK OnClientClose(CWnd* pWnd,CTCPCustom_CE*pTcpCustom);
	//服务器端收到来自客户端的数据
	static void CALLBACK OnClientRead(CWnd* pWnd,CTCPCustom_CE* pTcpCustom,N_Packet *pNP);
	//客户端Socket错误事件处理函数
	static void CALLBACK OnClientError(CWnd* pWnd,CTCPCustom_CE* pTcpCustom,int nErrorCode);	
	//服务器端Socket错误事件处理函数
	static void CALLBACK OnServerError(CWnd* pWnd,CTCPServer_CE* pTcpServer_CE,int nErrorCode);
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MAINFRM_H__86B42A59_8435_4F4B_9238_13D701771A8D__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -