62,046
社区成员
发帖
与我相关
我的任务
分享
LibExport LONG __stdcall ITS_Login(wchar_t *pIp, UINT uPort, wchar_t *pUser, wchar_t *pPassword);
[DllImport("ITSDll.dll", EntryPoint = "ITS_Login", CharSet = CharSet.Unicode)]
public static extern Int64 ITS_Login( string ip, UInt32 port, string user, string pwd);
CString strIp, strPort;
CString strUser = L"admin";
CString strPwd = L"123";
GetDlgItemText(IDC_EDIP, strIp);
GetDlgItemText(IDC_EDPORT, strPort);
if (strIp.IsEmpty() || strPort.IsEmpty())
{
AfxMessageBox(L"请输入Ip地址和端口号");
return;
}
if(CheckDevIsExsit(strIp, _wtoi(strPort)))
{
AfxMessageBox(L"设备已登录");
return;
}
LONG lLonginID = ITS_Login(strIp.GetBuffer(), _wtoi(strPort), strUser.GetBuffer(), strPwd.GetBuffer());
实在找不到问题了 困扰两天了
string ip = tbxIP.Text.Trim();
string name = "admin";
string pwd = "123";
LoginID = Video_SDK.ITS_Login(ip, UInt16.Parse(tbxPort.Text.Trim()), name, pwd);
if (LoginID == 0)
{
lblMessage.Text = "登陆成功";
}
else
{
lblMessage.Text = "登陆失败!";
}
这是我的demo