用Delphi 调用容联云通信的动态库CCPAppClient.DLL,其中有一个函数
Function CCPinit( CallbackInterface: CCPCALLBACKINTERFACE ):Integer;stdcall;
参数CCPCALLBACKINTERFACE 是一个结构体指针,包含 onConnected , onConnectError 等回调函数。
在调用函数CCPinit调用成功后(返回值0),会触发CCPCALLBACKINTERFACE
结构体中的回调函数onConnected
这部分代码用Delphi如何写?麻烦高手给看一下
下面是C#的demo
CCPCall.instance.loginInterface = this;
string ret = CCPCall.instance.LoginCCP();
if (ret != null)
{ MessageBox.Show(ret, "登录失败", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
}
else
{
login_btn.Enabled = false;
login_btn.BackgroundImage = Resources.bluebutton_disable;
login_btn.ForeColor = Color.White;
login_btn.Text = "登录中...请稍后";
}
public delegate void LoginDelegate();
#region ILoginInterface 成员
public void onConnected()
{
LoginDelegate connected = delegate()
{
IMDBAccess.CreateIMMessageTable();
IMDBAccess.CreateGroupNoticeTabel();
this.Hide();
new MainForm().Show();
};
this.BeginInvoke(connected);
}
public void onConnectError(CloopenReason reason)
{
LoginDelegate error = delegate()
{
login_btn.Enabled = true;
login_btn.BackgroundImage = Resources.bluebutton_normal;
login_btn.Text = "登录";
};
login_btn.BeginInvoke(error);
}
#endregion