有一DLL接口函数说明// SmartV.dll
// 本DLL目的就是从SmartV监控系统中获取设备信息// DLL启用函数
SMARTV_API void __stdcall SLT_ClientStart();// DLL停止函数
SMARTV_API void __stdcall SLT_ClientStop();// 获取设备信息函数
// 参数:
//    char *serverip :SmartV目录服务器IP地址,譬如:"192.168.0.1"
//    char *user     : 登陆SmartV目录服务器的用户名,请与SmartV监控系统管理员联系获取;
//    char *password : 登陆SmartV目录服务器的密码,请与SmartV监控系统管理员联系获取;
//    int second     :搜索设备等待时间,>=10 (秒);
//    void(WINAPI *notify)(unsigned long devid,char *devname,char *svrip) :
//                设备信息处理回调函数,在里面做相应的处理,譬如把该设备的信息保存下来
//                参数:
//                      unsigned long devid : 设备ID
//                      char *devname       : 设备名称(监控地点名称)
//                      char *svrip         : 该设备所在服务器IP
SMARTV_API long __stdcall SLT_ClientGetDevInfo(char *serverip,char *user, char *password,int second,
   void(WINAPI *notify)(unsigned long devid,char *devname,char *svrip));我在delphi dll 的声明是这样么 ??unit func;interfaceimplementation
  function SLT_ClientStart():integer; stdcall; far external 'smartv.dll';
  function SLT_ClientStop():integer; stdcall; far external 'smartv.dll';
  function SLT_ClientGetDevInfo(serverip:char;user:char;password:char;second:integer):integer; stdcall; far external 'smartv.dll';
end.这个SLT_ClientGetDevInfo ,不知道该如何写!!!

解决方案 »

  1.   

    function SLT_ClientGetDevInfo(serverip:pchar;user:pchar;password:pchar;second:integer):integer; stdcall; far external 'smartv.dll';
    ----------------------------------
    char * 在delphi中为pchar
      

  2.   

    没看全,这样试试:
    type
       Tnotify=procedure(devid:dword;devicename:pchar;svrip:pchar);
    ...
    function SLT_ClientGetDevInfo(serverip:pchar;user:pchar;password:pchar;second:integer;notify:Tnotify):integer;stdcall; far external 'smartv.dll';//其中notify为回调函数
      

  3.   

    type    TForm1 = class(TForm)
        SltClient1:TSltClient;
        Tnotify=procedure(devid:dword;devicename:pchar;svrip:pchar);
        procedure FormCreate(Sender: TObject);
        procedure FormClose(Sender: TObject; var Action: TCloseAction);  private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation
       function SLT_ClientStart():integer; stdcall; far external 'smartv.dll';
       function SLT_ClientStop():integer; stdcall; far external 'smartv.dll';
       function SLT_ClientGetDevInfo(serverip:pchar;user:pchar;password:pchar;second:integer;notify:Tnotify):integer;stdcall; far external 'smartv.dll';
    {$R *.dfm}报错的 ??
      

  4.   

    type
       Tnotify=procedure(devid:dword;devicename:pchar;svrip:pchar);
    要写在form定义的外面:
    var
      Form1: TForm1;
    //写在这里
    type
       Tnotify=procedure(devid:dword;devicename:pchar;svrip:pchar);
      

  5.   

    再请问 SLT_ClientGetDevInfo 这个函数怎么调用 ??
    如果我想知道  serverip,user,password,second  和那个回调函数里面的devid : 设备ID,char *devname       : 设备名称(监控地点名称),   char *svrip         : 该设备所在服务器IP
      

  6.   

    首先,要定义一个回调函数,如
    procedure test(devid:dword;devicename:pchar;svrip:pchar);
    begin
     ShowMessage(devicename);
      //...
    end;
    然后procedure TForm1.Button1Click(Sender: TObject);
    begin
      SLT_ClientGetDevInfo('192.168.0.111','admin','passwd',100,test);
    end;
      

  7.   

    var
      Form1: TForm1;
    type
       Tnotify=procedure(devid:dword;devicename:pchar;svrip:pchar);   implementation
       function SLT_ClientStart():integer; stdcall; far external 'smartv.dll';
       function SLT_ClientStop():integer; stdcall; far external 'smartv.dll';
       function SLT_ClientGetDevInfo(serverip:pchar;user:pchar;password:pchar;second:integer;notify:Tnotify):integer;stdcall; far external 'smartv.dll';
     //function SLT_ClientGetDevInfo(serverip:pchar;user:pchar;password:pchar;second:integer):integer;stdcall; far external 'smartv.dll';   {$R *.dfm}
    procedure test(devid:dword;devicename:pchar;svrip:pchar);
    begin
      devid:=devid;
    end;
    procedure TForm1.FormCreate(Sender: TObject);
    var serverip,user,password:pchar;
        second:integer;
        WSAData: TWSAData;begin  WSAStartup($101, WSAData);
      SLT_ClientStart();
      SltClient1.IPAddress:='192.168.17.1';
      SLT_ClientGetDevInfo('192.168.17.1','admin','123456',5,test);
      //showmessage(serverip); SltClient1.Active('Video',1,0);
    SltClient1.SetParameter('bitstream',devid,0,'realtime');//其中的xxxxxx表示一个摄像头的编号,可由DLL中接口函数取得
    SltClient1.Active('Audio',1,0);
      SltClient1.SetParameter('CourseWare', 1, 0,'PTZLock');
    // SltClient1.SetParameter('CourseWare', AVDataFunc, 0, 'CallBackFunc');
    // SltClient1.SetParameter('CourseWare', NULL, 0, 'CallBackFunc');
    SltClient1.SetParameter('CourseWare', 0, 0, 'PTZLock');
    SltClient1.Active('Audio', 0, 0);
    SltClient1.Active('Video',0, 0);
    //{SLT_ClientStop();
    end;
    SltClient1.SetParameter('bitstream',devid,0,'realtime');   这样可以得到devid 么 ???
      

  8.   

    感谢 keiy()大侠相助!! 我已经成功调通程序!! 谢谢!!