Code Comments
Programming Forum and web based access to our favorite programming groups.hi.. i got a dll wrapped in com which was written in delphi, although i can use in dotnet , trying to access a specific function in vb6 gets me: Function marked as restricted or uses a type not supported in Visual Basic
Post Follow-up to this message> i got a dll wrapped in com which was written in delphi, > > although i can use in dotnet , trying to access a specific function in > vb6 gets me: > > Function marked as restricted or uses a type not supported in Visual > Basic What's the function signature in your Delphi code? Also, make sure that you export your function as standard call since otherwise VB won't be able to call it. Hope this helps, Mike - Microsoft Visual Basic MVP - E-Mail: EDais@mvps.org WWW: Http://EDais.mvps.org/
Post Follow-up to this messagehere you go:
i should note that only the functions:
GetPlaintiffs
GetErrorMessage
GetDocumentTypes
don't work
//
****************************************
********************************
//
// Type Lib: E:\dcMgdSrk\DcSrkMgd.tlb (1)
// IID\LCID: {F31081A1-40F2-4DAA-93DC-01DE56B7FEEC}\0
// Helpfile:
// DepndLst:
// (1) v2.0 stdole, (C:\WINNT\system32\STDOLE2.TLB)
// (2) v4.0 StdVCL, (C:\WINNT\system32\STDVCL40.DLL)
//
****************************************
********************************
//
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked
pointers.
interface
uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL;
//
****************************************
*****************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:
// Type Libraries : LIBID_xxxx
// CoClasses : CLASS_xxxx
// DISPInterfaces : DIID_xxxx
// Non-DISP interfaces: IID_xxxx
//
****************************************
*****************************//
const
// TypeLibrary Major and minor versions
DcSrkMgdMajorVersion = 1;
DcSrkMgdMinorVersion = 0;
LIBID_DcSrkMgd: TGUID = '{F31081A1-40F2-4DAA-93DC-01DE56B7FEEC}';
IID_ITSrkMigdal: TGUID = '{73995D07-F76F-4C5E-B958-55654C85DDE8}';
CLASS_TSrkMigdal: TGUID = '{EE099BDA-6446-4460-8F22-70A94E9E09CF}';
type
//
****************************************
*****************************//
// Forward declaration of types defined in TypeLibrary
//
****************************************
*****************************//
ITSrkMigdal = interface;
//
****************************************
*****************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
//
****************************************
*****************************//
TSrkMigdal = ITSrkMigdal;
//
****************************************
*****************************//
// Interface: ITSrkMigdal
// Flags: (256) OleAutomation
// GUID: {73995D07-F76F-4C5E-B958-55654C85DDE8}
//
****************************************
*****************************//
ITSrkMigdal = interface(IUnknown)
['{73995D07-F76F-4C5E-B958-55654C85DDE8}']
function Init_Db(IniFileName: PChar): Integer; stdcall;
function Close_Db: Integer; stdcall;
function GetDocumentTypes: PChar; stdcall;
function ClaimExists(CompNum: Integer; TviaaNo: PChar): Integer;
stdcall;
function GetPlaintiffs(CompNum: Integer; TviaaNo: PChar): PChar;
stdcall;
function GetErrorMessage(ErrorCode: Integer): PChar; stdcall;
end;
//
****************************************
*****************************//
// The Class CoTSrkMigdal provides a Create and CreateRemote method to
// create instances of the default interface ITSrkMigdal exposed by
// the CoClass TSrkMigdal. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
//
****************************************
*****************************//
CoTSrkMigdal = class
class function Create: ITSrkMigdal;
class function CreateRemote(const MachineName: string):
ITSrkMigdal;
end;
implementation
uses ComObj;
class function CoTSrkMigdal.Create: ITSrkMigdal;
begin
Result := CreateComObject(CLASS_TSrkMigdal) as ITSrkMigdal;
end;
class function CoTSrkMigdal.CreateRemote(const MachineName: string):
ITSrkMigdal;
begin
Result := CreateRemoteComObject(MachineName, CLASS_TSrkMigdal) as
ITSrkMigdal;
end;
end.
Post Follow-up to this message> here you go: > > i should note that only the functions: > > GetPlaintiffs > GetErrorMessage > GetDocumentTypes > > don't work <code snipped> I would suggest then that it's because those functions return a PChar, try p utting ShareMem as the _first_ entry in both your library and project uses clauses and see if that clears things up (alth ough check for leaks with this technique..) Alternatively you may want to pass the string back as an OleVariant containi ng a string which should handle the cleanup for you. Failing that, have a look at this old post which demonstrates a different wa y of passing strings about used by the Win32 API: http://groups.google.co.uk/group/mi... /> d3c0e08e7f Hope this helps, Mike - Microsoft Visual Basic MVP - E-Mail: EDais@mvps.org WWW: Http://EDais.mvps.org/
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.