OleAutoObject

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
User avatar
gianluca.pinoli
Posts: 36
Joined: Mon Nov 02, 2015 1:13 pm

OleAutoObject

Post by gianluca.pinoli »

Hi all,
I've a problem trying to call a X# DLL from a VO program.
Using A) example it works, but using B) it return an error similar to "Impossible to find the member" (Impossibile trovare membro)

Thanks for you help.
Gianluca


*********************************************************************
*********************************************************************
CASE A)
*********************************************************************
*********************************************************************

LOCAL o as OleAutoObject
local sString as string

o := OLEAutoObject{"GDOfatCOM.GDOcomXML"}
IF o:fInit
if o:ExportFatturaXML("C:TEST","00000003.XML","","FA","2018","3","")
sString := "OK"
endif
InfoBox{,"Fine",sString}:Show()
o:Destroy()
CollectForced()
else
InfoBox{,"Fine","KO"}:Show()
ENDIF

*********************************************************************
*********************************************************************
CASE B)
*********************************************************************
*********************************************************************

local oFAT as GDOfatCOM
local sString as string

oFAT := GDOfatCOM{}
if oFAT:ExportFatturaXML("C:TEST","00000003.XML","","FA","2018","3","")
sString := "OK"
endif

InfoBox{,"Fine",sString}:Show()
return nil



CLASS GDOfatCOM INHERIT OLEAutoObjectEx
METHOD Init(ObjID, fROTCHECK) CLASS GDOfatCOM

self:cProgID := "GDOfatCOM.GDOcomXML"
self:cClsID := "{1B79D018-8F36-4BA4-84DB-CA6C8C9A73E8}"
self:cIID := "{288091BD-E7B5-4436-8660-6BAB31F9ED81}"
SUPER:Init(ObjID, 0, .T., fRotCheck)
self:_dwFuncs := 2
self:_dwVars := 0
RETURN self
METHOD ExportFatturaXML(;
sPath,; // AS STRING
sNomeFile,; // AS STRING
sNrFil,; // AS STRING
sTR,; // AS STRING
sAnno,; // AS STRING
sNumdoc,; // AS STRING
sSeriedoc; // AS STRING
) CLASS GDOfatCOM

LOCAL oMethod as cOleMethod
LOCAL uRetValue as USUAL

oMethod := cOleMethod{}
oMethod:symName := String2Symbol("ExportFatturaXML")
oMethod:iMemberid := 1
oMethod:wInvokeKind := INVOKE_METHOD
oMethod:nParams := 7
oMethod:lNamedArgs := true
oMethod:cParamTypes := VTS_BSTRW + VTS_BSTRW + VTS_BSTRW + VTS_BSTRW + VTS_BSTRW + VTS_BSTRW + VTS_BSTRW
oMethod:bRetType := VT_BOOL

uRetValue := self:__Invoke(oMethod, DWORD(_bp+16),PCount())

RETURN (uRetValue)
METHOD test() CLASS GDOfatCOM

LOCAL oMethod as cOleMethod
LOCAL uRetValue as USUAL

oMethod := cOleMethod{}
oMethod:symName := String2Symbol("Test")
oMethod:iMemberid := 2
oMethod:wInvokeKind := INVOKE_METHOD
oMethod:bRetType := VT_BOOL

uRetValue := self:__Invoke(oMethod, DWORD(_bp+16),PCount())

RETURN (uRetValue)



*********************************************************************
*********************************************************************
X#
*********************************************************************
*********************************************************************
USING System
USING System.Collections.Generic
USING System.Linq
USING System.Text
using GDOfatXML
USING System.Windows.Forms
Using IniLib
USING MySql
USING MySql.Data
USING MySql.Data.Types
USING MySql.Data.MySqlClient
USING system.Threading
Using GDOStaticLibrary
using System.Runtime.InteropServices

BEGIN NAMESPACE GDOfatCOM

[ComVisible(true)];
[Guid("1B79D018-8F36-4BA4-84DB-CA6C8C9A73E8")];
[ClassInterface(ClassInterfaceType.None)];
[ProgId("GDOfatCOM.GDOcomXML")];
CLASS GDOcomXML
public CONSTRUCTOR() STRICT
RETURN
public virtual method ExportFatturaXML(sPath as string, sNomeFile as string, sNrFil as string, sTR as string, sAnno as string, sNumdoc as string, sSeriedoc as string ) as logic STRICT
local sNomeFileINI as string
local lRetVal := false as logic
local oFatt as FatturaXML

*messagebox.Show(sPath+"#"+sNomeFile+"#"+sNrFil+"#"+sTR+"#"+sAnno+"#"+sNumdoc+"#"+sSeriedoc)

Thread.CurrentThread.CurrentCulture := System.Globalization.CultureInfo.InvariantCulture

*sNomeFileINI := System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly():Location) + "GDOfatXML.INI"
sNomeFileINI := "GDOfatXML.INI"

*messagebox.Show( sNomeFileINI )

Globals.oIniFile := IniFile{sNomeFileINI}
Globals.sServer := Globals.oIniFile:Read("Host","XMYSQL")
Globals.sPort := Globals.oIniFile:Read("Port","XMYSQL")
Globals.sUser := Globals.oIniFile:Read("User","XMYSQL")
Globals.sPwd := Globals.oIniFile:Read("Pswd","XMYSQL")
Globals.sDataBase := Globals.oIniFile:Read("DB","XMYSQL")

IF !Globals.Connetti()
MessageBox.Show("Impossibile connettersi al server")
else
lRetVal := true
oFatt := FatturaXML{}
oFatt:GetFatturaGDOfat("","FA","2018",convert.ToInt16(sNumdoc),"")
oFatt:WriteFatturaPA(sPath, sNomeFile)
endif

return lRetVal

public virtual method Test() as logic
return true

END CLASS
END NAMESPACE

********************************************************************************
********************************************************************************


USING System
USING System.Collections.Generic
USING System.Text
using System.Runtime.InteropServices

BEGIN NAMESPACE GDOfatCOM

[ComVisible(true)];
[Guid("288091BD-E7B5-4436-8660-6BAB31F9ED81")];
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)];
interface iGDOcomXML

[DispId(1)];
method ExportFatturaXML(sPath as string, sNomeFile as string, sNrFil as string, sTR as string, sAnno as string, sNumdoc as string, sSeriedoc as string ) as logic

[DispId(2)];
method Test() as logic

end interface

END NAMESPACE // GDOfatCOM

**************************************************************************************
**************************************************************************************
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

OleAutoObject

Post by wriedmann »

Hi Gianluca,

do you have tried to debug with sxstrace.exe?

Wolfgang

P.S. I will be offline for about 2 hours now
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
gianluca.pinoli
Posts: 36
Joined: Mon Nov 02, 2015 1:13 pm

OleAutoObject

Post by gianluca.pinoli »

Thanks Wolfgang,
the problem seem to be in the X# assembly's manifest.
I'll try to create a new one, and (i hope) it will probably fix the problem.

Regards
Gianluca
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

OleAutoObject

Post by wriedmann »

Ciao Gianluca,

COM and SideBySide makes me damn every time I build a new library, but when it finally works, it works like a charm.
Some of my VO applications are using already more than 4 different X# COM libraries, and with the electronic invoice (I'm using SoftwareHubSystem) they will have another one.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply