Private Declare Function fileproc Lib "MyFunc.dll" (ByVal FileNameIn As String, ByVal FileNameOut As String) As Long

解决方案 »

  1.   

    你的库有没有.def文件,,我以前作的时候发现没有.def导出的话会出错不能光用__declspec(dllexport)
      

  2.   

    #ifdef __cplusplus 
    extern "C"{ 
    #endif 
    ... 
    //你的dll程序主体#ifdef __cplusplus 

    #endif记着给分哦,不然我不理你了
      

  3.   

    regsvr32这好像是用来注册组件的,,你用来干什么?
      

  4.   

    VB里面调用DLL好像要先注册过的吧
      

  5.   

    to  happyangelclc(快乐), 我在MSDN上看到有这么一段话“A module-definition (.DEF) file is a text file containing one or more module statements that describe various attributes of a DLL. If you are not using the __declspec(dllexport) keyword to export the DLL’s functions, then the DLL requires a .DEF file. ”好像说如果没有用__declspec(dllexport) 关键字来导出DLL的话,才需要.DEF文件,而我已经用了__declspec(dllexport) 了,所以就应该不用.DEF文件了吧
      

  6.   

    to  vcs(游魂)
    还是老样子,提示“DLL调用约定错误”各位大哥,都没有碰到过这个问题吗,我在VC下调用这个DLL都是好的!!!
      

  7.   

    你在定义dll时,不要用LPTSTR,试用VARIANT类型,看看行不行
      

  8.   

    是不是String的问题?
    VB的String构造不一样的,你试试将String拷贝到Byte数组(注意要符合C语言格式的chr(0)结尾)
    然后再传进去..
      

  9.   

    我比较了一下标准的WINAPI调用,例如调用kernel32.dll 里面的"GetFileAttributes"函数,vb是这么写的:
    Public Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long在MSDN中找到了GetFileAttributes函数的定义
    DWORD GetFileAttributes(
      LPCTSTR lpFileName   // pointer to the name of a file or directory
    );
     明明是我的函数参数和它是差不多的嘛,为什么WINAPI的可以,而我的却不行呢??????
      

  10.   

    在vc中,将"LPTSTR"改为"LPCTSTR" 或者
    在VB中将ByVal去掉
      

  11.   

    标准答案:
    int _stdcall fileproc(LPTSTR FileNameIn,LPTSTR FileNameOut) {}
    //as intger 最好为as long
      

  12.   

    to  ls9d999999(小菜) 是:
    extern "C" __declspec(dllexport) int _stdcall fileproc(LPTSTR FileNameIn,LPTSTR FileNameOut) 
    吗?我也试过了,好像还是不行
      

  13.   

    调用约定几种,其中一C约定  另一种为pascal约定方法:将C约定,变为Pascal约定
    步骤:
        打开VC下project->Setting->c++面板->Category->code Generation项
       ->设置calling convention ->选择_stdll
    DLL是老方法了,为什么不用ATL做了
      

  14.   

    这问题问过很多边了,你的VC动态库里函数extern "C" __declspec(dllexport)写了吗?或者写了还不行,那你在动态库的工程里加一个.def文件来EXPORT所有你想让外部调用的接口。vc 的dllint WINAPI     DialConnect(){   MessageBox(NULL,"99","00",MB_OK);    return 0;}vc的.def; vctest.def : Declares the module parameters for the DLL.LIBRARY      "vctest"DESCRIPTION  'vctest Windows Dynamic Link Library'EXPORTS    ; Explicit exports can go here     DialConnectvb的模块Attribute VB_Name = "Module1"Public Declare Function DialConnect Lib "VCtest.dll" () As Longvb的调用 DialConnect
      

  15.   

    to lhrtm(天涯人),谢谢,问题解决,高手!!我是初学者,ATL好像太复杂了,不是很明白,有空向你请教,我的QQ是:699321,E-MAIL:[email protected]
      

  16.   

    问题结束,lhrtm(天涯人)得分50