installshield 怎么调用C#,C++dll,有源码最好

解决方案 »

  1.   

    调用C++的DLL如:
    prototype cdecl Test.GetFileVersion(BYREF STRING);//先根据DLL声明函数function NUMBER GetVersion(FilePath)   
    STRING szDLLDir;
    NUMBER version;
    begin 
    version= 0;  
      szDLLDir ="C:\\Test.dll";
    if UseDLL(szDLLDir) < 0 then
    MessageBox("ERROR: Could not load [" + szDLLDir +"].", SEVERE);
    endif;
      version = GetFileVersion(FilePath);//调用
    if UnUseDLL(szDLLDir) < 0 then
    MessageBox("ERROR: Could not unload [" +szDLLDir+"].", SEVERE);
    endif;
    return version;
    end;调用C#的Dll的话,目前还没有方法实现。不过也有变通的方法,就是把C#的改成exe, 然后通过LaunchAppAndWait函数调用就可。
      

  2.   

    编译通不过,我写的DLL里面有单个参数,返回值是布尔型
    我先prototype cdecl(bool) a.RegExValidatePassword(BYREF STRING,BYREF STRING,BYREF STRING);(返回值类型要不要加,我看有的资料加,有的没加)
    三个参数对应输入注册码的三个textbox,调用dll里面的函数RegExValidatePassword,返回bool值,具体步骤是什么?老出错
      

  3.   

    返回值类型要不要加,我看有的资料加,有的没加
    这里没有那么严格,可以不加。
    prototype cdecl a.RegExValidatePassword(BYREF STRING,BYREF STRING,BYREF STRING);
    a这里应该是你DLL的名字。
      

  4.   

    installshield给的例子里面的一个函数
    function SdCustomRegExValidatePassword( svSerial_1, svSerial_2, svSerial_3 )
        STRING svSub_svSerial_3;
        NUMBER nCalculation;
        begin
           ///////////////////////////////////////////////////////////
           // Place your Serial Number Validation Code here
           // This sample looks for:
           //             szSerial_1 = "PRCODE"
           //             szSerial_2 = "0011"
           //             szSeiral_3: Must be 10 digits long, and the
           //                         last 6 digits must be a multiple
           //                         of 15. For example:
           //                           9900000015
           //                           1000000030
           ///////////////////////////////////////////////////////////
           if (svSerial_1 = "PRCODE") then
                   if (svSerial_2 = "0011") then
                        if ( StrLength(svSerial_3) != 10 ) then
                            return FALSE;
                        endif;
                        StrSub (svSub_svSerial_3, svSerial_3, 4, 6);
                        StrToNum (nCalculation, svSub_svSerial_3);
                        if (nCalculation = 0) then return FALSE;
                            endif;
                        // calculate remainder
                        nCalculation = (nCalculation % 15);
                        if (nCalculation = 0) then return TRUE;
                            endif;
                        endif;
                    endif;
           return FALSE;
        end;
    想把它做成C++dll该怎么搞?
      

  5.   

    都是字符串操作,参考C++中的类string。
      

  6.   

    你DLL放到那去了? dll的路径不正确。
    先把dll放在Support Files的Language Independent下,然后在安装脚本中找到临时目录,在该目录下搜索dll文件。 
    如: 
    GetEnvVar("TEMP", tempdir);//得到临时目录 
    FindAllFiles ( tempdir, "xxx.dll" , tempdir, CONTINUE );//在临时目录下搜索xxx.dll文件 
    tempdir//这个是DLL的路径。
      

  7.   

    新建项目的时候。选择--Windouws控件库。就行了。
      

  8.   

    installshield给的例子里面的一个函数 
    function SdCustomRegExValidatePassword( svSerial_1, svSerial_2, svSerial_3 ) 
        STRING svSub_svSerial_3; 
        NUMBER nCalculation; 
        begin 
          /////////////////////////////////////////////////////////// 
          // Place your Serial Number Validation Code here 
          // This sample looks for: 
          //            szSerial_1 = "PRCODE" 
          //            szSerial_2 = "0011" 
          //            szSeiral_3: Must be 10 digits long, and the 
          //                        last 6 digits must be a multiple 
          //                        of 15. For example: 
          //                          9900000015 
          //                          1000000030 
          /////////////////////////////////////////////////////////// 
          if (svSerial_1 = "PRCODE") then 
                  if (svSerial_2 = "0011") then 
                        if ( StrLength(svSerial_3) != 10 ) then 
                            return FALSE; 
                        endif; 
                        StrSub (svSub_svSerial_3, svSerial_3, 4, 6); 
                        StrToNum (nCalculation, svSub_svSerial_3); 
                        if (nCalculation = 0) then return FALSE; 
                            endif; 
                        // calculate remainder 
                        nCalculation = (nCalculation % 15); 
                        if (nCalculation = 0) then return TRUE; 
                            endif; 
                        endif; 
                    endif; 
          return FALSE; 
        end; 
    想把它做成C++dll该怎么搞? 
    新建项目的时候。选择--Windouws控件库。就行了。
      

  9.   

    #define DLL_FILE "Zhucema.dll"prototype  BOOL Zhucema.MyDllFunc(BYREF STRING,BYREF STRING,BYREF STRING);Zhucema.MyDllFunc()
    按照上面步骤调用有问题吗?
    dll程序
    zhucema.cpp
    bool MyDllFunc(string a,string b,string c)
    {
     if(a=="PRCODE"&&b=="0011"&&c=="9900000015")
     {
     return true;
     }
     else
     {
     return false;
     }
    }
    zhucema.h
    extern "C" __declspec(dllexport) bool _cdecl MyDllFunc(string a,string b,string c);
      

  10.   

    不用installshield,这玩意贼大而且收费。平时都是用NSIS,so我没发言权
      

  11.   

    extern "C" __declspec(dllexport) bool _cdecl MyDllFunc(string a,string b,string c);这种形式只有相同的编译器才会认到你的函数MyDllFunc的,换个编译器就不可以了。在编译的时候会改名的,你是无法调用到函数名为MyDllFunc的函数的,你如果只是函数的到处的话用def文件来定义吧。或者你通过函数序号来查找(这种方式我很少用到,所以不知道行不行。)
      

  12.   

    http://www.tianyablog.com/blogger/post_show.asp?blogid=228796&postid=10297862
    这个例子说是我那种方法可以的
      

  13.   

    extern "C" __declspec(dllexport) bool _cdecl MyDllFunc(string a,string b,string c);
    这样参数注定了你无法调用成功。
      

  14.   

    这个函数连C++自己都无法调用。
    你还是使用导出C接口的DLL吧
      

  15.   

    首先,确保你的DLL依赖的其他DLL也一起放到了相同的目录,然后把DLL的定义改成
    extern "C" __declspec(dllexport) bool _cdecl MyDllFunc(const char* a,const char* b,const char* c);