9
I am in need of using methods from a DLL that was developed by third party. I only have the file ". DLL".
DLL documentation is scarce... there is an example of the method execution I need in VB
Private Const TamMsgErro As Long = 1000
Dim oTED As New clsGeraMidiaTed
Dim lResult As Long
Dim sMsgErroTED As String * TamMsgErro
'Chamada no Projeto
Set oTED = CreateObject("PRGerarMidiaTED.clsGeraMidiaTED")
lResult = oTED.Gerar_MidiaTEDDat(sListaArqEntrada, _
sArqSaida, _
sTipoDoc, _
sMsgErroTED, _
TamMsgErro)
If lResult <> 0 Then
MsgBox sMsgErroTED
Else
MsgBox "Arquivo [" & sArqSaida & "] gerado com sucesso !"
End If
I need to develop in Delphi, and the problem I’m having is that the "Gerar_midiateddat" method is not exported by the DLL. This method is in a class in the DLL.
Using PE Explorer I was able to obtain the following data from DLL:
//PRGerarMidiaTED
//Version: 1.0
PRGerarMidiaTED;
GUID = {DA0AA6B5-73AC-41B7-BBA5-DF03D6367C63};
Dispatch _clsGeraMidiaTed;
GUID = {EEF15A9A-5C3E-45A0-B876-4E10381C7D2E};
function QueryInterface(riid: ^GUID; out ppvObj: ^^VOID); stdcall;
function AddRef: UI4; stdcall;
function Release: UI4; stdcall;
function GetTypeInfoCount(out pctinfo: ^UINT); stdcall;
function GetTypeInfo(itinfo: UINT; lcid: UI4; out pptinfo: ^^VOID); stdcall;
function GetIDsOfNames(riid: ^GUID; rgszNames: ^^I1; cNames: UINT; lcid: UI4; out rgdispid: ^I4); stdcall;
function Invoke(dispidMember: I4; riid: ^GUID; lcid: UI4; wFlags: UI2; pdispparams: ^DISPPARAMS; out pvarResult: ^Variant; out pexcepinfo: ^EXCEPINFO; out puArgErr: ^UINT); stdcall;
function Gerar_MidiaTEDDat(sListaArqEntrada: BSTR; sArqSaida: BSTR; sTipoDoc: BSTR; out sMsgErro: ^BSTR; lTamMsgErro: I4): I4; stdcall;
function Verificar_VersaoGerarMidiaTED(out sVersaoGerarMidia: ^BSTR; out sMsgErro: ^BSTR; lTamMsgErro: I4): Bool; stdcall;
CoClass clsGeraMidiaTed;
GUID = {664BF784-A2D6-477B-8022-1F32FDD90FD6};
In the exported functions PE Explorer indicated me that there is the function DllGetClassObject
which should be used to obtain the class instance, but I have not found examples of how to do this.
Any suggestions ?
I recommend always using the first option, because it generates a stub. It’s much easier to work with stub than with the Olevariant that Createobject creates.
– Edgar Muniz Berlinck