您的位置:程序门 -> vb -> 基础类



vb中调用vc中的生成dll动态库的问题。总是提示我内存错误


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


vb中调用vc中的生成dll动态库的问题。总是提示我内存错误
发表于:2007-01-12 11:54:16 楼主
总是提示错误。  
dll中是:  
*   函数名称:kmgetpubcell_information  
*   说明:取公有信息单元格的内容。  
*   入口参数:  
*   char   *roleidentity   --   角色名称  
*   char   *parametername   --   单元格名称  
*   char   *parametervalue   --   返回单元格内填写的内容  
*   int   &valuelen   --   字符串的长度  
传入值表示字符串缓冲区的大小;  
返回值表示返回信息的实际字节长度。  
*   返回值:  
*   int   --   处理结果  
cappdll_err_no_role:   无指定角色  
cappdll_err_no_parametername:   参数无效  
cappdll_err_ok:   取数据成功  
******************************************************************  
extern   "c "   int   winapi   kmgetpubcell_information(char   *roleidentity,   char   *parametername,   char   *parametervalue,   int   &valuelen);  
/*****************************************************************  

我vb中申明是:  
public   declare   function   kmgetpubcell_information   lib   "kmcappdll.dll "   (byval   roleidentity   as   string,   _  
byval   parametername   as   string,   _  
byval   parametervalue   as   string,   _  
byval   valuelen   as   integer)  

使用该方法代码是:  
kmgetpubcell_information   "设计 ",   "产品型号 ",   sgetproducttype,   a  
请高手指点那里错误了,  
调试时候vb总是掉出来,提示内存错误
发表于:2007-01-12 12:03:561楼 得分:0
public   declare   function   kmgetpubcell_information   lib   "kmcappdll.dll "   (byref   roleidentity   as   string,   _  
byref   parametername   as   string,   _  
byref   parametervalue   as   string,   _  
byval   valuelen   as   long)     as   long

或者
public   declare   function   kmgetpubcell_information   lib   "kmcappdll.dll "   (byval   roleidentity   as   string,   _  
byval   parametername   as   string,   _  
byval   parametervalue   as   string,   _  
byval   valuelen   as   long)     as   long


dim   a   as   string   *   16     '这个长度,适合自己使用就行
dim   b   as   string   *   16
dim   c   as   string   *   16
dim   iret   as   long

a= "设计 "
b= "产品型号 "
c=sgetproducttype

kmgetpubcell_information   a,   b,   c,   iret  

   

发表于:2007-01-13 10:16:352楼 得分:0
把dll放在system32目錄下,關閉時記得釋放資源


快速检索

最新资讯
热门点击