如何在类型库里定义一个有多各返回值的函数?谢谢!

解决方案 »

  1.   

    to  chenzhuo(睡到自然醒)  
    我只知道用*Variant结构体应该怎样设置?能讲一讲吗?
      

  2.   

    你先定义一个结构体
    type 
      TResult = record
        field1: integer;   //返回值1
        field2: string;    //返回值2
        ...                //返回值N
      end;function f(I: integer):TResult;
    begin
      Result.field1 := 1;
      Result.field2 := 'test';
    end;
      

  3.   

    我的函数是这样;
    function sss(const x:widestring):olevariant//在接口里定义的(Type Library Editor)
     type
      yy=record
      item_name:string;
      item_type:string;
      end;
     var
    z:yy;
     begin
     z.item_name:='ww';
     z.item_type:='22';
     result:=z;
     end;
    但编译时就是通过不了?
    好象是olevariant和record不兼容;请问我该怎样做?谢谢!
      

  4.   

    to  chenzhuo(睡到自然醒) ( )  
    不行啊!
      

  5.   

    返回类型只能是:olevariant不知道有什么好方法,但是这里你可以这样出来,把返回值传起来,
    然调用此函数的地方再去处理
    例如
    function sss(const x:widestring):olevariant//在接口里定义的(Type Library Editor)
     begin
        result:='ww:22';
     end;调用的时候将返回  ww:22这时候你再根据:号把他们分解出来~!