最近接到一个项目是在Honeywell的视频监控系统基础上做一个单路的视频监控窗口,原系统是VC做的一个DLL,SDK开发包内还有一个C++的例程,我是做C#的 对C++不是很了解,对于原有例程也是似懂非懂,对于C#调用VC函数没有太大问题,现在只是不太了解那个C++例程是用得何种视频控件显示监控视频的,和在C#中该如何解决这个问题,希望有C++高手能帮忙读下C++例程 给出解决方法,(注:不是C++.NET 可能是C++6.0或者MFC写的C++程序,不太懂)。希望您对C#也有一定的了解。有意者请加QQ85751330或MSN:[email protected]详谈。下边是一部分例程窗体头文件的定义代码:
// DVCSDemoDlg.h : header file
// #if !defined(AFX_DVCSDEMODLG_H__C9785C03_E5E6_48E8_8F05_D1AF04722A06__INCLUDED_)
#define AFX_DVCSDEMODLG_H__C9785C03_E5E6_48E8_8F05_D1AF04722A06__INCLUDED_ #if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000 /////////////////////////////////////////////////////////////////////////////
// CDVCSDemoDlg dialog
class CDVCSDemoDlg : public CDialog
{
// Construction
public:
CDVCSDemoDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data
//{{AFX_DATA(CDVCSDemoDlg)
enum { IDD = IDD_DVCSDEMO_DIALOG };
CListCtrl m_ctrlAlarmList;
CStatic m_ctrlPlayWnd;
CIPAddressCtrl m_ctrlIPAddress;
DWORD m_dwPort;
CString m_strUser;
CString m_strPassword;
int m_nCurChannel;
CString m_strOSDInfo;
int m_nOSDX;
int m_nOSDY;
CString m_strFileName;
CString m_strSendData;
int m_nDataLen;
CString m_strGetData;
//}}AFX_DATA // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDVCSDemoDlg)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL // Implementation
protected:
HICON m_hIcon; // Generated message map functions
//{{AFX_MSG(CDVCSDemoDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnButtonLogin();
afx_msg void OnButtonLogout();
afx_msg void OnButtonPlayChannel();
afx_msg void OnButtonPlayStop();
afx_msg void OnButtonPtzUp();
afx_msg void OnButtonPtzDown();
afx_msg void OnButtonPtzLeft();
afx_msg void OnButtonPtzRight();
afx_msg void OnButtonOsdSetInfo();
afx_msg void OnButtonOsdSetFont();
afx_msg void OnButtonBrightnessIncr();
afx_msg void OnButtonBrightnessDecr();
afx_msg void OnButtonContrastIncr();
afx_msg void OnButtonContrastDecr();
afx_msg void OnButtonSaturationIncr();
afx_msg void OnButtonSaturationDecr();
afx_msg void OnButtonHueIncr();
afx_msg void OnButtonHueDecr();
afx_msg void OnButtonSnapshot();
afx_msg void OnButtonStartTalk();
afx_msg void OnButtonStopTalk();
afx_msg void OnButtonSystemCfg();
afx_msg void OnButtonChannelName();
afx_msg void OnButtonRecordControl();
afx_msg void OnButtonTranscommSetParam();
afx_msg void OnButtonTranscommSendData();
afx_msg void OnButtonTranscommGetDataLen();
afx_msg void OnButtonTranscommGetData();
afx_msg void OnButtonRecordUserInfo();
afx_msg void OnButtonPlayback();
//}}AFX_MSG
DECLARE_MESSAGE_MAP() public:
void AddAlarmtoList(int nDVRID, char* strIP, LPBYTE lpByte, DWORD dwLength); private:
void InitItem();
void InitAlarmList();
void EnableItemForLogin();
void EnableItemForPlayChannel(); private:
char m_strIP[256];
int m_nDVRID;
}; //{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_DVCSDEMODLG_H__C9785C03_E5E6_48E8_8F05_D1AF04722A06__INCLUDED_)
// DVCSDemoDlg.h : header file
// #if !defined(AFX_DVCSDEMODLG_H__C9785C03_E5E6_48E8_8F05_D1AF04722A06__INCLUDED_)
#define AFX_DVCSDEMODLG_H__C9785C03_E5E6_48E8_8F05_D1AF04722A06__INCLUDED_ #if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000 /////////////////////////////////////////////////////////////////////////////
// CDVCSDemoDlg dialog
class CDVCSDemoDlg : public CDialog
{
// Construction
public:
CDVCSDemoDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data
//{{AFX_DATA(CDVCSDemoDlg)
enum { IDD = IDD_DVCSDEMO_DIALOG };
CListCtrl m_ctrlAlarmList;
CStatic m_ctrlPlayWnd;
CIPAddressCtrl m_ctrlIPAddress;
DWORD m_dwPort;
CString m_strUser;
CString m_strPassword;
int m_nCurChannel;
CString m_strOSDInfo;
int m_nOSDX;
int m_nOSDY;
CString m_strFileName;
CString m_strSendData;
int m_nDataLen;
CString m_strGetData;
//}}AFX_DATA // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDVCSDemoDlg)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL // Implementation
protected:
HICON m_hIcon; // Generated message map functions
//{{AFX_MSG(CDVCSDemoDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnButtonLogin();
afx_msg void OnButtonLogout();
afx_msg void OnButtonPlayChannel();
afx_msg void OnButtonPlayStop();
afx_msg void OnButtonPtzUp();
afx_msg void OnButtonPtzDown();
afx_msg void OnButtonPtzLeft();
afx_msg void OnButtonPtzRight();
afx_msg void OnButtonOsdSetInfo();
afx_msg void OnButtonOsdSetFont();
afx_msg void OnButtonBrightnessIncr();
afx_msg void OnButtonBrightnessDecr();
afx_msg void OnButtonContrastIncr();
afx_msg void OnButtonContrastDecr();
afx_msg void OnButtonSaturationIncr();
afx_msg void OnButtonSaturationDecr();
afx_msg void OnButtonHueIncr();
afx_msg void OnButtonHueDecr();
afx_msg void OnButtonSnapshot();
afx_msg void OnButtonStartTalk();
afx_msg void OnButtonStopTalk();
afx_msg void OnButtonSystemCfg();
afx_msg void OnButtonChannelName();
afx_msg void OnButtonRecordControl();
afx_msg void OnButtonTranscommSetParam();
afx_msg void OnButtonTranscommSendData();
afx_msg void OnButtonTranscommGetDataLen();
afx_msg void OnButtonTranscommGetData();
afx_msg void OnButtonRecordUserInfo();
afx_msg void OnButtonPlayback();
//}}AFX_MSG
DECLARE_MESSAGE_MAP() public:
void AddAlarmtoList(int nDVRID, char* strIP, LPBYTE lpByte, DWORD dwLength); private:
void InitItem();
void InitAlarmList();
void EnableItemForLogin();
void EnableItemForPlayChannel(); private:
char m_strIP[256];
int m_nDVRID;
}; //{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_DVCSDEMODLG_H__C9785C03_E5E6_48E8_8F05_D1AF04722A06__INCLUDED_)
不过这些好像视屏处理不多啊,人家应该都封装好了
没看到,就
afx_msg void OnButtonPlayChannel();
afx_msg void OnButtonPlayStop();
2个地方处理播放
应该很简单的,慢慢看,没什么
然后就可以使用这个DLL里所提供的方法了.
方法的话去看这个C++的头文件代码片断如下:
[DllImport("xxx.dll", CharSet = CharSet.Ansi)] public static unsafe extern void Check_Method(ushort Cascade, uint Password, uint* lpRet);
[DllImport("xxx.dll", CharSet = CharSet.Ansi)]
public static unsafe extern void Read_Method(ushort Cascade, uint Password, ushort addr, ushort bytes, void* pdata, uint* lpRet);2)C++的话就更简单了,人家都封装好了,包上头文件或LIB文件.直接在你的MFC项目中调用相应的方法即可.
不用“看上去”,是“他就是”。
对 C# 没啥好感,MFC 多好