泥 泥头车 Unregistered / Unconfirmed GUEST, unregistred user! 2006-11-10 #1 我在DLL里要返回字符串,供VC程序调用,可不管用了ShareMem、PChar、ShortString等,总是提示无效的指针出错,有没有哪位富翁有行之有效的解答?
D danng Unregistered / Unconfirmed GUEST, unregistred user! 2006-11-10 #2 这样写会有问题吗? function funName(paramaramtype)Char;stdcall;
D dey-999 Unregistered / Unconfirmed GUEST, unregistred user! 2006-11-10 #3 提供一个我刚刚搞出来的方法: delphi写法:function GetBarCodeNo(ANo : PChar):integer;stdcall; VC调用方式: 1.声明:typedef int (__stdcall * ReadCardInfo)(char * ANo);//ReadCardInfo,DLL名称,可放在当前应用程序所在目录下 2.调用: { HINSTANCE h0; ReadCardInfo lpDllMyFunc; char * ANo1=NULL;//分配地址 int B; CString cstr; ANo1 = new char[100]; //分配空间 h0=LoadLibrary("ReadCardInfo.dll" if (h0!=NULL) { lpDllMyFunc = ( ReadCardInfo)GetProcAddress(h0,"GetBarCodeNo" if (h0!=NULL) B = (*lpDllMyFunc)(ANo1); if (B>0) { ANo1='/0'; cstr=ANo1; AfxMessageBox(cstr); } } FreeLibrary(HMODULE(h0)); }
提供一个我刚刚搞出来的方法: delphi写法:function GetBarCodeNo(ANo : PChar):integer;stdcall; VC调用方式: 1.声明:typedef int (__stdcall * ReadCardInfo)(char * ANo);//ReadCardInfo,DLL名称,可放在当前应用程序所在目录下 2.调用: { HINSTANCE h0; ReadCardInfo lpDllMyFunc; char * ANo1=NULL;//分配地址 int B; CString cstr; ANo1 = new char[100]; //分配空间 h0=LoadLibrary("ReadCardInfo.dll" if (h0!=NULL) { lpDllMyFunc = ( ReadCardInfo)GetProcAddress(h0,"GetBarCodeNo" if (h0!=NULL) B = (*lpDllMyFunc)(ANo1); if (B>0) { ANo1='/0'; cstr=ANo1; AfxMessageBox(cstr); } } FreeLibrary(HMODULE(h0)); }