floydus
asked on
Create Dll that use another dll...
Hi !
I'm not really comfortable with VC++, but I've to use it...
I received an API from a company, it's a VC++ dll. But I want to use it from VB.
Because of name mangling, I cannot use it from VB
The API they supplied with a sample application (VC++ exe) with many dialogs. I don't need such a think, I need to call function from VB, the same kind of app without dialogs...
Also, please explain to me what is callback function, I might have to take care of this too...
OUF !!!
Here is code sample of main app.
Please contact floydus27@hotmail.com
if you have questions...
I NEED TO USE THE SAME FUNCTIONS FROM VB, I THOUGHT ABOUT CREATING A DLL THAT CALLS THESES FUNCTIONS... BUT HAVE NO CLUE HOW DO IT...
I tried but got memory cannot be read all the time.
Could you supply me a sample of a created dll that loads an existing dll.
// BasicSDKTestAppDlg.cpp : implementation file
//
#include "stdafx.h"
#include "BasicSDKTestApp.h"
#include "BasicSDKTestAppDlg.h"
#include "VideoExportDialog.h"
#include "PantilCtrlDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
// CAboutDlg dialog used for App About
CBasicSDKTestAppDlg * g_pAppDlg = NULL;
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchan ge* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDl g)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange( CDataExcha nge* pDX)
{
CDialog::DoDataExchange(pD X);
//{{AFX_DATA_MAP(CAboutDlg )
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDl g, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
// CBasicSDKTestAppDlg dialog
CBasicSDKTestAppDlg::CBasi cSDKTestAp pDlg(CWnd* pParent /*=NULL*/)
: CDialog(CBasicSDKTestAppDl g::IDD, pParent)
{
//{{AFX_DATA_INIT(CBasicSD KTestAppDl g)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_ MAINFRAME) ;
}
void CBasicSDKTestAppDlg::DoDat aExchange( CDataExcha nge* pDX)
{
CDialog::DoDataExchange(pD X);
//{{AFX_DATA_MAP(CBasicSDK TestAppDlg )
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBasicSD KTestAppDl g, CDialog)
//{{AFX_MSG_MAP(CBasicSDKT estAppDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BTN_CONN ECT, OnBtnConnect)
ON_BN_CLICKED(IDC_BTN_DISC ONNECT, OnBtnDisconnect)
ON_BN_CLICKED(IDC_BTN_LIVE _STRM, OnBtnLiveStrm)
ON_BN_CLICKED(IDC_BTN_PTZ_ CTRL, OnBtnPtzCtrl)
ON_BN_CLICKED(IDC_BTN_SEAR CH, OnBtnSearch)
ON_BN_CLICKED(IDC_BTN_CAME R_INFO, OnBtnCamerInfo)
ON_BN_CLICKED(IDC_BTN_LIVE _STRM2, OnBtnLiveStrm2)
ON_BN_CLICKED(IDC_BTN_SEAR CH_STOP, OnBtnSearchStop)
ON_BN_CLICKED(IDC_BTN_INST _REC_BEGIN , OnBtnInstRecBegin)
ON_BN_CLICKED(IDC_BTN_INST _REC_END, OnBtnInstRecEnd)
ON_BN_CLICKED(IDC_BTN_EXPO RT, OnBtnExport)
ON_BN_CLICKED(IDC_BTN_EVEN T_LIST, OnBtnEventList)
ON_BN_CLICKED(IDC_LOGINB, OnLoginb)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
// CBasicSDKTestAppDlg message handlers
BOOL CBasicSDKTestAppDlg::OnIni tDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(ID S_ABOUTBOX );
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SE PARATOR);
pSysMenu->AppendMenu(MF_ST RING, IDM_ABOUTBOX, strAboutMenu);
}
}
g_pAppDlg = this;
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
SetDlgItemText( IDC_STATIC_V_TIMESTAMP,"no ne" );
SetDlgItemText( IDC_STATIC_A_SAMPLEBIT,"no ne" );
//Initialization to Dialog Value
return TRUE; // return TRUE unless you set the focus to a control
}
void CBasicSDKTestAppDlg::OnSys Command(UI NT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CBasicSDKTestAppDlg::OnPai nt()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBK GND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON );
int cyIcon = GetSystemMetrics(SM_CYICON );
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CBasicSDKTestAppDlg::OnQue ryDragIcon ()
{
return (HCURSOR) m_hIcon;
}
//Callback functions.
VOID CBasicSDKTestAppDlg::OnCon nectCallba ck(HSERVER hServer,LPST_CONNECT_INFO lpstConnectInfo)
{
//lpstConnectInfo
//AfxMessageBox("OnConnect Callback!" );
if( lpstConnectInfo->nConnectR esult == _DXSDK_NET_CONNECTED ) //Connected
{
g_pAppDlg->SetDlgItemText( IDC_STATIC _CON_V,"Co nnected");
g_pAppDlg->SetDlgItemText( IDC_STATIC _IP_V,lpst ConnectInf o->szServe rAddr);
g_pAppDlg->SetDlgItemInt(I DC_STATIC_ PORT_V,lps tConnectIn fo->usServ erPort);
if( lpstConnectInfo->nLoginRes ult == _DXSDK_NET_LOGIN_SUCCESS ) //Connect Success
{
g_pAppDlg->SetDlgItemText( IDC_STATIC _USER_V, lpstConnectInfo->szUserID) ;
}
else if( lpstConnectInfo->nLoginRes ult == _DXSDK_NET_LOGIN_FAILED ) //Connect fail
{
g_pAppDlg->SetDlgItemText( IDC_STATIC _USER_V,"L ogin fail");
}
}
else if( lpstConnectInfo->nConnectR esult == _DXSDK_NET_CONNECT_FAIL ) //Connect Fail.
{
g_pAppDlg->SetDlgItemText( IDC_STATIC _CON_V,"Co nnect fail");
g_pAppDlg->SetDlgItemText( IDC_STATIC _IP_V,lpst ConnectInf o->szServe rAddr);
g_pAppDlg->SetDlgItemInt(I DC_STATIC_ PORT_V,lps tConnectIn fo->usServ erPort);
}
else if( lpstConnectInfo->nConnectR esult == _DXSDK_NET_OVER_CONNECTION ) //Over user
{
g_pAppDlg->SetDlgItemText( IDC_STATIC _CON_V,"Ov er user");
g_pAppDlg->SetDlgItemText( IDC_STATIC _IP_V,"");
g_pAppDlg->SetDlgItemInt(I DC_STATIC_ PORT_V,0);
}
}
VOID CBasicSDKTestAppDlg::OnCon nectResetC allback(HS ERVER hServer)
{
g_pAppDlg->SetDlgItemText( IDC_STATIC _CON_V,"Re set by peer");
}
VOID CBasicSDKTestAppDlg::OnLiv eVideoStre amIn( HSERVER hServer, LPST_LIVE_VID_ITEM lpstVidStream )
{
CString strRec;
//Video
if( lpstVidStream->stFrameItem .sRecMode & (_SCRECTYPE_SENSOR) ) //Sensor.
strRec = "Alarm";
else if( lpstVidStream->stFrameItem .sRecMode & (_SCRECTYPE_MOTION) )
strRec = "Motion";
else if( lpstVidStream->stFrameItem .sRecMode & (_SCRECTYPE_CONTINUS) )
strRec = "Continus";
else if( lpstVidStream->stFrameItem .sRecMode & (_SCRECTYPE_PREALARM) )
strRec = "Prealarm";
g_pAppDlg->SetDlgItemText( IDC_STATIC _V_FORMAT, strRec );
CTime TimeStamp(lpstVidStream->s tFrameItem .stVidTime Stamp);// Video Time Stamp
CString strTmp;
strTmp.Format("%s-%d",Time Stamp.Form at("%Y/%m/ %d-%H:%M:% S"),lpstVi dStream->s tFrameItem .stVidTime Stamp.wMil liseconds) ;
g_pAppDlg->SetDlgItemText( IDC_STATIC _V_TIMESTA MP,strTmp) ;
strTmp.Format("%d",lpstVid Stream->nC h+1);
g_pAppDlg->SetDlgItemText( IDC_STATIC_V_CH,strTmp );
strTmp.Format("%d x %d",lpstVidStream->stFrame Item.uiWid th,lpstVid Stream->st FrameItem. uiHeight);
g_pAppDlg->SetDlgItemText( IDC_STATIC_V_RESOLUTION,st rTmp );
g_pAppDlg->SetDlgItemInt( IDC_STATIC_V_SIZE,lpstVidS tream->stF rameItem.u iVidBufSiz e );
//Audio
//IDC_STATIC_A_TIMESTAMP,I DC_STATIC_ A_CH,IDC_S TATIC_A_FO RMAT,IDC_S TATIC_A_SA MPLEBIT,ID C_STATIC_A _SIZE
/*
lpstVidStream->stFrameItem .stAudTime Stamp;
lpstVidStream->stFrameItem .lpAudBuff er;
lpstVidStream->stFrameItem .uiAudBufS ize;
lpstVidStream->stFrameItem .nformatio n.
lpstVidStream->stFrameItem .lLength;
lpstVidStream->stFrameItem .lFormat;
lpstVidStream->stFrameItem .lSamplePe rSecond;
lpstVidStream->stFrameItem .lSamplePe rBit;
lpstVidStream->stFrameItem .lChannels ;
*/
}
VOID CBasicSDKTestAppDlg::OnLiv eVideoStre amAborted( HSERVER hServer,INT nErrCode)
{
AfxMessageBox("Video Stream Aborted.\n");
}
// Search Result Callback.
VOID CBasicSDKTestAppDlg::OnSea rchCallbac k(HSERVER hServer, LPSEARCH_ITEM lpSearchItem)
{
if( !lpSearchItem ) //End of search
{
TRACE("End of Search.\n");
AfxMessageBox("End of search!");
return;
}
else
{
LPSEARCH_ITEM lpstVidStream = lpSearchItem;
CTime TimeStamp(lpstVidStream->s tFrameItem .stVidTime Stamp);// Video Time Stamp
CString strTmp;
strTmp.Format("%s-%d",Time Stamp.Form at("%Y/%m/ %d-%H:%M:% S"),lpstVi dStream->s tFrameItem .stVidTime Stamp.wMil liseconds) ;
g_pAppDlg->SetDlgItemText( IDC_STATIC _V_TIMESTA MP,strTmp) ;
strTmp.Format("%d",lpstVid Stream->nC hannel+1);
g_pAppDlg->SetDlgItemText( IDC_STATIC_V_CH,strTmp );
strTmp.Format("%d x %d",lpstVidStream->stFrame Item.uiWid th,lpstVid Stream->st FrameItem. uiHeight);
g_pAppDlg->SetDlgItemText( IDC_STATIC_V_RESOLUTION,st rTmp );
g_pAppDlg->SetDlgItemInt( IDC_STATIC_V_SIZE,lpstVidS tream->stF rameItem.u iVidBufSiz e );
Sleep( 30 );
}
}
////////////////////////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// //
void CBasicSDKTestAppDlg::OnBtn Connect()
{
// TODO: Add your control notification handler code here
ST_SERVER_BASE_INFO stServerInfo;
strcpy( stServerInfo.szServerAddr, "192.168.0.1");
stServerInfo.usServerPort = 9002;
strcpy( stServerInfo.szUserID,"usa ger");
strcpy(stServerInfo.szUser Passwd,"pe lco2");
stServerInfo.lpfnConectCal lback = CBasicSDKTestAppDlg::OnCon nectCallba ck;
stServerInfo.lpfnDisconnec tCallback = CBasicSDKTestAppDlg::OnCon nectResetC allback;
SetDlgItemText(IDC_STATIC_ CON_V,"Try connect");
m_hServer = ::DxConnect(&stServerInfo) ;
if( !m_hServer )
SetDlgItemText(IDC_STATIC_ CON_V,"Net work error.");
}
void CBasicSDKTestAppDlg::OnBtn Disconnect ()
{
// TODO: Add your control notification handler code here
::DxClose(m_hServer);
SetDlgItemText(IDC_STATIC_ CON_V,"Dis connect");
}
void CBasicSDKTestAppDlg::OnBtn LiveStrm()
{
// TODO: Add your control notification handler code here
LIVE_VID_CONF LiveConf;
memset(LiveConf.btChEnable ,0x00,size of(BYTE)*M AX_SUPPORT _CH);
for( int nCnt=0;nCnt<16;nCnt++)
{
CButton *pBtn = (CButton *)GetDlgItem(IDC_CHECK1+nC nt);
LiveConf.btChEnable[nCnt] = pBtn->GetCheck() ? 1:0;
}
LiveConf.lpfnAbortedCallba ck = CBasicSDKTestAppDlg::OnLiv eVideoStre amAborted;
LiveConf.lpfnVidStreamCall back = CBasicSDKTestAppDlg::OnLiv eVideoStre amIn;
LiveConf.uiMinimumStreamIn tervalMS = 0;
LiveConf.VidForat = FORMAT_RGB24; //or FORMAT_YUV16
::DxBeginLiveStream( m_hServer, &LiveConf );
}
void CBasicSDKTestAppDlg::OnBtn LiveStrm2( )
{
// TODO: Add your control notification handler code here
::DxStopLiveStream( m_hServer );
}
void CBasicSDKTestAppDlg::OnBtn PtzCtrl()
{
// TODO: Add your control notification handler code here
CPantilCtrlDlg * pPanTiltDlg;
pPanTiltDlg = new CPantilCtrlDlg(this,m_hSer ver);
pPanTiltDlg->DoModal();
delete pPanTiltDlg;
}
void CBasicSDKTestAppDlg::OnBtn Search()
{
// TODO: Add your control notification handler code here
DXSEARCH_INFO SearchInfo;
memset(SearchInfo.btChanne l,0x00,siz eof(BYTE)* 32);
for( int nCnt=0;nCnt<16;nCnt++)
{
CButton *pBtn = (CButton *)GetDlgItem(IDC_CHECK1+nC nt);
SearchInfo.btChannel[nCnt] = pBtn->GetCheck() ? 1:0;
}
//SearchInfo.lEventType; ignored. - current not use.
SearchInfo.lpfnSearchResul tCallback = CBasicSDKTestAppDlg::OnSea rchCallbac k;
SearchInfo.stStartTime.wYe ar = 2004;
SearchInfo.stStartTime.wMo nth = 6;
SearchInfo.stStartTime.wDa y = 15;
SearchInfo.stStartTime.wHo ur = 10; //AM
SearchInfo.stStartTime.wMi nute = 0;
SearchInfo.stStartTime.wSe cond = 0;
SearchInfo.stStartTime.wMi lliseconds = 0;
SearchInfo.stStartTime.wDa yOfWeek = 3; //Monday. start is sunday = 0;
//set of video Output format.
SearchInfo.VidForat = FORMAT_RGB24;
::DxSearchStart( m_hServer, &SearchInfo );
}
void CBasicSDKTestAppDlg::OnBtn SearchStop ()
{
// TODO: Add your control notification handler code here
::DxSearchStop( m_hServer );
}
void CBasicSDKTestAppDlg::OnBtn CamerInfo( )
{
// TODO: Add your control notification handler code here
}
void CBasicSDKTestAppDlg::OnBtn InstRecBeg in()
{
// TODO: Add your control notification handler code here
for( int nCnt=0;nCnt<16;nCnt++)
{
CButton *pBtn = (CButton *)GetDlgItem(IDC_CHECK1+nC nt);
if( pBtn->GetCheck() ) ::DxInstantRecordBegin( m_hServer, nCnt );
}
}
void CBasicSDKTestAppDlg::OnBtn InstRecEnd ()
{
// TODO: Add your control notification handler code here
for( int nCnt=0;nCnt<16;nCnt++)
{
CButton *pBtn = (CButton *)GetDlgItem(IDC_CHECK1+nC nt);
if( !pBtn->GetCheck() ) ::DxInstantRecordEnd( m_hServer, nCnt );
}
}
void CBasicSDKTestAppDlg::OnBtn Export()
{
// TODO: Add your control notification handler code here
m_ExportDlg.SetHServer(m_h Server);
m_ExportDlg.DoModal();
}
void CBasicSDKTestAppDlg::OnBtn EventList( )
{
// TODO: Add your control notification handler code here
m_EventListDlg.SetHServer( m_hServer) ;
m_EventListDlg.DoModal();
}
void CBasicSDKTestAppDlg::OnLog inb()
{
// TODO: Add your control notification handler code here
}
I'm not really comfortable with VC++, but I've to use it...
I received an API from a company, it's a VC++ dll. But I want to use it from VB.
Because of name mangling, I cannot use it from VB
The API they supplied with a sample application (VC++ exe) with many dialogs. I don't need such a think, I need to call function from VB, the same kind of app without dialogs...
Also, please explain to me what is callback function, I might have to take care of this too...
OUF !!!
Here is code sample of main app.
Please contact floydus27@hotmail.com
if you have questions...
I NEED TO USE THE SAME FUNCTIONS FROM VB, I THOUGHT ABOUT CREATING A DLL THAT CALLS THESES FUNCTIONS... BUT HAVE NO CLUE HOW DO IT...
I tried but got memory cannot be read all the time.
Could you supply me a sample of a created dll that loads an existing dll.
// BasicSDKTestAppDlg.cpp : implementation file
//
#include "stdafx.h"
#include "BasicSDKTestApp.h"
#include "BasicSDKTestAppDlg.h"
#include "VideoExportDialog.h"
#include "PantilCtrlDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////////////
// CAboutDlg dialog used for App About
CBasicSDKTestAppDlg * g_pAppDlg = NULL;
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchan
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDl
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(
{
CDialog::DoDataExchange(pD
//{{AFX_DATA_MAP(CAboutDlg
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDl
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////
// CBasicSDKTestAppDlg dialog
CBasicSDKTestAppDlg::CBasi
: CDialog(CBasicSDKTestAppDl
{
//{{AFX_DATA_INIT(CBasicSD
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_
}
void CBasicSDKTestAppDlg::DoDat
{
CDialog::DoDataExchange(pD
//{{AFX_DATA_MAP(CBasicSDK
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBasicSD
//{{AFX_MSG_MAP(CBasicSDKT
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BTN_CONN
ON_BN_CLICKED(IDC_BTN_DISC
ON_BN_CLICKED(IDC_BTN_LIVE
ON_BN_CLICKED(IDC_BTN_PTZ_
ON_BN_CLICKED(IDC_BTN_SEAR
ON_BN_CLICKED(IDC_BTN_CAME
ON_BN_CLICKED(IDC_BTN_LIVE
ON_BN_CLICKED(IDC_BTN_SEAR
ON_BN_CLICKED(IDC_BTN_INST
ON_BN_CLICKED(IDC_BTN_INST
ON_BN_CLICKED(IDC_BTN_EXPO
ON_BN_CLICKED(IDC_BTN_EVEN
ON_BN_CLICKED(IDC_LOGINB, OnLoginb)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////
// CBasicSDKTestAppDlg message handlers
BOOL CBasicSDKTestAppDlg::OnIni
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(ID
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SE
pSysMenu->AppendMenu(MF_ST
}
}
g_pAppDlg = this;
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
SetDlgItemText( IDC_STATIC_V_TIMESTAMP,"no
SetDlgItemText( IDC_STATIC_A_SAMPLEBIT,"no
//Initialization to Dialog Value
return TRUE; // return TRUE unless you set the focus to a control
}
void CBasicSDKTestAppDlg::OnSys
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID,
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CBasicSDKTestAppDlg::OnPai
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBK
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON
int cyIcon = GetSystemMetrics(SM_CYICON
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CBasicSDKTestAppDlg::OnQue
{
return (HCURSOR) m_hIcon;
}
//Callback functions.
VOID CBasicSDKTestAppDlg::OnCon
{
//lpstConnectInfo
//AfxMessageBox("OnConnect
if( lpstConnectInfo->nConnectR
{
g_pAppDlg->SetDlgItemText(
g_pAppDlg->SetDlgItemText(
g_pAppDlg->SetDlgItemInt(I
if( lpstConnectInfo->nLoginRes
{
g_pAppDlg->SetDlgItemText(
}
else if( lpstConnectInfo->nLoginRes
{
g_pAppDlg->SetDlgItemText(
}
}
else if( lpstConnectInfo->nConnectR
{
g_pAppDlg->SetDlgItemText(
g_pAppDlg->SetDlgItemText(
g_pAppDlg->SetDlgItemInt(I
}
else if( lpstConnectInfo->nConnectR
{
g_pAppDlg->SetDlgItemText(
g_pAppDlg->SetDlgItemText(
g_pAppDlg->SetDlgItemInt(I
}
}
VOID CBasicSDKTestAppDlg::OnCon
{
g_pAppDlg->SetDlgItemText(
}
VOID CBasicSDKTestAppDlg::OnLiv
{
CString strRec;
//Video
if( lpstVidStream->stFrameItem
strRec = "Alarm";
else if( lpstVidStream->stFrameItem
strRec = "Motion";
else if( lpstVidStream->stFrameItem
strRec = "Continus";
else if( lpstVidStream->stFrameItem
strRec = "Prealarm";
g_pAppDlg->SetDlgItemText(
CTime TimeStamp(lpstVidStream->s
CString strTmp;
strTmp.Format("%s-%d",Time
g_pAppDlg->SetDlgItemText(
strTmp.Format("%d",lpstVid
g_pAppDlg->SetDlgItemText(
strTmp.Format("%d x %d",lpstVidStream->stFrame
g_pAppDlg->SetDlgItemText(
g_pAppDlg->SetDlgItemInt( IDC_STATIC_V_SIZE,lpstVidS
//Audio
//IDC_STATIC_A_TIMESTAMP,I
/*
lpstVidStream->stFrameItem
lpstVidStream->stFrameItem
lpstVidStream->stFrameItem
lpstVidStream->stFrameItem
lpstVidStream->stFrameItem
lpstVidStream->stFrameItem
lpstVidStream->stFrameItem
lpstVidStream->stFrameItem
lpstVidStream->stFrameItem
*/
}
VOID CBasicSDKTestAppDlg::OnLiv
{
AfxMessageBox("Video Stream Aborted.\n");
}
// Search Result Callback.
VOID CBasicSDKTestAppDlg::OnSea
{
if( !lpSearchItem ) //End of search
{
TRACE("End of Search.\n");
AfxMessageBox("End of search!");
return;
}
else
{
LPSEARCH_ITEM lpstVidStream = lpSearchItem;
CTime TimeStamp(lpstVidStream->s
CString strTmp;
strTmp.Format("%s-%d",Time
g_pAppDlg->SetDlgItemText(
strTmp.Format("%d",lpstVid
g_pAppDlg->SetDlgItemText(
strTmp.Format("%d x %d",lpstVidStream->stFrame
g_pAppDlg->SetDlgItemText(
g_pAppDlg->SetDlgItemInt( IDC_STATIC_V_SIZE,lpstVidS
Sleep( 30 );
}
}
//////////////////////////
void CBasicSDKTestAppDlg::OnBtn
{
// TODO: Add your control notification handler code here
ST_SERVER_BASE_INFO stServerInfo;
strcpy( stServerInfo.szServerAddr,
stServerInfo.usServerPort = 9002;
strcpy( stServerInfo.szUserID,"usa
strcpy(stServerInfo.szUser
stServerInfo.lpfnConectCal
stServerInfo.lpfnDisconnec
SetDlgItemText(IDC_STATIC_
m_hServer = ::DxConnect(&stServerInfo)
if( !m_hServer )
SetDlgItemText(IDC_STATIC_
}
void CBasicSDKTestAppDlg::OnBtn
{
// TODO: Add your control notification handler code here
::DxClose(m_hServer);
SetDlgItemText(IDC_STATIC_
}
void CBasicSDKTestAppDlg::OnBtn
{
// TODO: Add your control notification handler code here
LIVE_VID_CONF LiveConf;
memset(LiveConf.btChEnable
for( int nCnt=0;nCnt<16;nCnt++)
{
CButton *pBtn = (CButton *)GetDlgItem(IDC_CHECK1+nC
LiveConf.btChEnable[nCnt] = pBtn->GetCheck() ? 1:0;
}
LiveConf.lpfnAbortedCallba
LiveConf.lpfnVidStreamCall
LiveConf.uiMinimumStreamIn
LiveConf.VidForat = FORMAT_RGB24; //or FORMAT_YUV16
::DxBeginLiveStream( m_hServer, &LiveConf );
}
void CBasicSDKTestAppDlg::OnBtn
{
// TODO: Add your control notification handler code here
::DxStopLiveStream( m_hServer );
}
void CBasicSDKTestAppDlg::OnBtn
{
// TODO: Add your control notification handler code here
CPantilCtrlDlg * pPanTiltDlg;
pPanTiltDlg = new CPantilCtrlDlg(this,m_hSer
pPanTiltDlg->DoModal();
delete pPanTiltDlg;
}
void CBasicSDKTestAppDlg::OnBtn
{
// TODO: Add your control notification handler code here
DXSEARCH_INFO SearchInfo;
memset(SearchInfo.btChanne
for( int nCnt=0;nCnt<16;nCnt++)
{
CButton *pBtn = (CButton *)GetDlgItem(IDC_CHECK1+nC
SearchInfo.btChannel[nCnt]
}
//SearchInfo.lEventType; ignored. - current not use.
SearchInfo.lpfnSearchResul
SearchInfo.stStartTime.wYe
SearchInfo.stStartTime.wMo
SearchInfo.stStartTime.wDa
SearchInfo.stStartTime.wHo
SearchInfo.stStartTime.wMi
SearchInfo.stStartTime.wSe
SearchInfo.stStartTime.wMi
SearchInfo.stStartTime.wDa
//set of video Output format.
SearchInfo.VidForat = FORMAT_RGB24;
::DxSearchStart( m_hServer, &SearchInfo );
}
void CBasicSDKTestAppDlg::OnBtn
{
// TODO: Add your control notification handler code here
::DxSearchStop( m_hServer );
}
void CBasicSDKTestAppDlg::OnBtn
{
// TODO: Add your control notification handler code here
}
void CBasicSDKTestAppDlg::OnBtn
{
// TODO: Add your control notification handler code here
for( int nCnt=0;nCnt<16;nCnt++)
{
CButton *pBtn = (CButton *)GetDlgItem(IDC_CHECK1+nC
if( pBtn->GetCheck() ) ::DxInstantRecordBegin( m_hServer, nCnt );
}
}
void CBasicSDKTestAppDlg::OnBtn
{
// TODO: Add your control notification handler code here
for( int nCnt=0;nCnt<16;nCnt++)
{
CButton *pBtn = (CButton *)GetDlgItem(IDC_CHECK1+nC
if( !pBtn->GetCheck() ) ::DxInstantRecordEnd( m_hServer, nCnt );
}
}
void CBasicSDKTestAppDlg::OnBtn
{
// TODO: Add your control notification handler code here
m_ExportDlg.SetHServer(m_h
m_ExportDlg.DoModal();
}
void CBasicSDKTestAppDlg::OnBtn
{
// TODO: Add your control notification handler code here
m_EventListDlg.SetHServer(
m_EventListDlg.DoModal();
}
void CBasicSDKTestAppDlg::OnLog
{
// TODO: Add your control notification handler code here
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
All the functions name are name decorated (Or name mangling) from VC++ when the Dll was compiled. The code I putted up there was using these function with success, from VC++.
I need to make the same application from VB...
I found that a work around would be to create a new DLL that I will be able to use from VB.
I'm actually working on it.
Thanks folks.
Dave