基本信息
源码名称:大华设备初始化(c++代码)
源码大小:0.91M
文件格式:.rar
开发语言:C/C++
更新时间:2020-05-26
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

【Demo功能】
1、demo演示的功能有:局域网设备搜索、跨网段设备搜索、设备初始化、修改设备IP、设备密码找回

【注意事项】
1、编译环境为VS2005。
2、跨网段搜索只支持256个IP
3、修改IP暂不支持IPv6的修改
4、对设备进行初始化和密码找回操作需要确保本机IP和设备IP是同一局域网内,如果不在同一局域网,则会报超时错误
5、如需运行demo的exe文件,请将开发包中【库文件】里的全部dll文件拷贝至该工程目录下的bin/x86release或者bin/x64release下。
6、如把库文件放入程序生成的目录中,运行有问题,请到大华官网下载最新的网络SDK版本:http://www.dahuatech.com/index.php/service/downloadlists/836.html 替换程序中的库文件。

// DevInit.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "DevInit.h"
#include "DevInitDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDevInitApp

BEGIN_MESSAGE_MAP(CDevInitApp, CWinApp)
//{{AFX_MSG_MAP(CDevInitApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
//    DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDevInitApp construction
TCHAR* g_GetIniPath(void)
{
static char pszIniPath[512] = {0};
if( strlen(pszIniPath) == 0 )
{
char szDirBuf[512] = {0};
GetCurrentDirectory(512, szDirBuf);
sprintf(pszIniPath, "%s\\langchn.ini", szDirBuf);
}
return pszIniPath;
}

CString ConvertString(CString strText)
{
char *val = new char[200];
CString strIniPath,strRet;

memset(val,0,200);
GetPrivateProfileString("String",strText,"",
val,200,g_GetIniPath());
strRet = val;
if(strRet.GetLength()==0)
{
//If there is no corresponding string in ini file ,then set it to be default value.
strRet=strText;
}
delete val;
return strRet;
}
//Set static text in dialogue box (English->current language)
void g_SetWndStaticText(CWnd * pWnd)
{
CString strCaption,strText;

//Set main window title
pWnd->GetWindowText(strCaption);
if(strCaption.GetLength()>0)
{
strText=ConvertString(strCaption);
pWnd->SetWindowText(strText);
}

//Set small window title 
CWnd * pChild=pWnd->GetWindow(GW_CHILD);
CString strClassName;
while(pChild)
{
//////////////////////////////////////////////////////////////////////////
//Added by Jackbin 2005-03-11
strClassName = ((CRuntimeClass*)pChild->GetRuntimeClass())->m_lpszClassName;
if(strClassName == "CEdit")
{
//Next small window 
pChild=pChild->GetWindow(GW_HWNDNEXT);
continue;
}

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

//Set small window current language text 
pChild->GetWindowText(strCaption);
strText=ConvertString(strCaption);
pChild->SetWindowText(strText);

//Next small window 
pChild=pChild->GetWindow(GW_HWNDNEXT);
}
}
CDevInitApp::CDevInitApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CDevInitApp object

CDevInitApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CDevInitApp initialization

BOOL CDevInitApp::InitInstance()
{
AfxEnableControlContainer();

// Standard initialization
// If you are not using these features and wish to reduce the size
//  of your final executable, you should remove from the following
//  the specific initialization routines you do not need.

#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

CDevInitDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
//  dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
//  dismissed with Cancel
}

// Since the dialog has been closed, return FALSE so that we exit the
//  application, rather than start the application's message pump.
return FALSE;
}