fbpx
Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC: OleAutoObject

OleAutoObject 8 months 1 week ago #6532

  gianluca.pinoli's Avatar Topic Author gianluca.pinoli Offline Posts: 28
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

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

Please Log in or Create an account to join the conversation.

OleAutoObject 8 months 1 week ago #6533

  wriedmann's Avatar wriedmann Away Posts: 1573
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
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

OleAutoObject 8 months 1 week ago #6534

  gianluca.pinoli's Avatar Topic Author gianluca.pinoli Offline Posts: 28
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

Please Log in or Create an account to join the conversation.

OleAutoObject 8 months 1 week ago #6535

  wriedmann's Avatar wriedmann Away Posts: 1573
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
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

  • Page:
  • 1