Sto ancora Litigando con Gli UDT
In una Classe del Programma VB6 ho il seguente Codice
Private Sub Class_Initialize()
Set dllXgvMesInterface = Nothing
Set dllXgvMesInterface = CreateObject("XgvMesInterface.clsXgvMesInterface")
End Sub
Private Sub Class_Terminate()
If (Not (dllXgvMesInterface Is Nothing)) Then
Set dllXgvMesInterface = Nothing
End If
End sub
Private Function ImpostaStatoParcheggio(EnableExport As Boolean) As Boolean
Dim iIndex As Integer
Dim strReturned As String
Dim stProductInfo As STRUCT_PRODUCT_INFO
For iIndex = 1 To Parcheggio(0).NumeroPiazza
stProductInfo.ProductID = 1
stProductInfo.ProductCode = "0001"
stProductInfo.ProductDescription = "Prova Codice 0001"
stParkInfoForMes = Parcheggio(iIndex)
stProductInfoForMes = stProductInfo
strReturned = dllXgvMesInterface.ImpostaStatoParcheggio_InsertQuery(VarPtr(stParkInfoForMes), _
stProductInfo.ProductID, _
stProductInfo.ProductCode, _
stProductInfo.ProductDescription, _
XGV_ParkStatesTable)
Next iIndex
End Function
In un Modulo (.Bas) del programma VB6 Ho il Seguente Codice
Public Type STRUCT_PRODUCT_INFO
ProductID As Integer
ProductCode As String
ProductDescription As String
End Type
Public stProductInfoForMes As STRUCT_PRODUCT_INFO '//# UDT Dettagli Prodotto per Passaggio a DLLMesInterface - '//#Mirco 2022_09_10
Public Type STRUCT_PARCHEGGIO
IdZona As Integer
NomeZona As String
NumeroPiazza As Integer
Abilitazione As Boolean
TipoPiazza As String
PrelevaDa As Integer
TrasferisciA As Integer
PrelevaDopo As Integer
DepositaPrima As Integer
PuntoPrelievo As Integer
Piano As Integer
PuntoDeposito As Integer
QuotaPrelievo As Integer
QuotaDeposito As Integer
UltimoMovimentoPz As Date
IdSupporto As Integer
NomeSupporto As String
ColoreSupporto As Long
NumBox As Integer
IdProdotto As Integer
CodiceProdotto As String
DescProdotto As String
ColoreProdotto As Long
IdFase As Integer
DescrFase As String
ColoreFase As Long
CodiceTrasporto As String
UnitaMisura As String
Quantita As Long
Altezza As Integer
UltimoMovimentoBox As Date
Creazione As Date
Prenotata As Boolean
SupportiAmmessi() As Integer
PiazzaNonAccessibile As Boolean
IdMacchina As Integer
ContatoreTabella As Integer
IdFaseDefault As Integer
Ch_Prelievo As Integer
Mask_Prelievo As Integer
Value_Prelievo As Integer
Ch_Deposito As Integer
Mask_Deposito As Integer
Value_Deposito As Integer
Ch_ResetOp As Integer
Mask_ResetOp As Integer
Value_ResetOp As Integer
Ch_CambioProduzione As Integer
Mask_CambioProduzione As Integer
Value_CambioProduzione As Integer
Ch_ResetProduzione As Integer
Mask_ResetProduzione As Integer
Value_ResetProduzione As Integer
Id_Programma As Integer
Precedenza_Op As Integer
Tipo_Cambio_Prod As Integer
ChiamataForzata As Boolean
OperDiStartCiclo As Long
Giracontenitore As Boolean
Value_PermessoAccesso As Integer
Ch_Nr_PezziBox As Integer
Value_Nr_PezziBox As Long
MqPerBox As Single
PiazzaADx As Integer
PiazzaASx As Integer
PiazzeAdiacenti() As Integer
Ch_Fine_Ciclo_Deposito As Integer
Mask_Fine_Ciclo_Deposito As Long
Value_Fine_Ciclo_Deposito As Integer
Ch_Fine_Ciclo_Prelievo As Integer
Mask_Fine_Ciclo_Prelievo As Long
Value_Fine_Ciclo_Prelievo As Integer
Ch_Tipo_Supporto As Integer
Mask_Tipo_Supporto As Long
Value_Tipo_Supporto As Integer
Tag As String
TempoEssiccazione As Integer
Ch_CaricoScarico982 As Integer
Mask_CaricoScarico982 As Integer
Value_CaricoScarico982 As Integer
Ch_LetturaPianiTecnoF As Integer
Mask_LetturaPianiTecnoF As Integer
Value_LetturaPianiTecnoF As Integer
Ch_ScritturaPianiTecnoF As Integer
Mask_ScritturaPianiTecnoF As Integer
Value_ScritturaPianiTecnoF As Integer
Incompleto As Boolean
CodiceScelta As Integer
TipoChiamata As Integer
End Type
Public Parcheggio() As STRUCT_PARCHEGGIO
Public stParkInfoForMes As STRUCT_PARCHEGGIO '//# UDT Piazza per Passaggio a DLLMesInterface
Nella Classe della Dll Activex ho il seguente Codice
Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
'//###########################################################################################
'//# Aggiornamento Stato Parcheggio
'//###########################################################################################
Public Function ImpostaStatoParcheggio_InsertQuery(ByRef stParkPlacePtr As Long, _
ByVal ProductID As Integer, _
ByVal ProductCode As String, _
ByVal ProductDescription As String, _
ByVal XGV_ParkStatesTable As String) As String
On Error GoTo gestErrore
Dim stLocalParkInfo As STRUCT_PARCHEGGIO
Call CopyMemory(stLocalParkInfo, ByVal stParkPlacePtr, LenB(stLocalParkInfo))
'*********************Log temporaneo per debug
Dim n As Integer
n = FreeFile
Open "C:\Temp\TestImpostaStatoParcheggio_InsertQuery.txt" For Append As #n
Print #n, "***********************"
Print #n, "Piazza: "; Str(stLocalParkInfo.NumeroPiazza)
Print #n, " -->"; "Zona di appartenenza ID:"; Str(stLocalParkInfo.IdZona)
'Print #n, " -->"; "Zona di appartenenza Nome:"; stLocalParkInfo.NomeZona
'Print #n, " -->"; "Abilitazione utilizzo della piazza:"; Str(CInt(stLocalParkInfo.Abilitazione))
'Print #n, " -->"; "Tipo di piazza:"; stLocalParkInfo.TipoPiazza
Print #n, " -->"; "PrelevaDa:"; Str(stLocalParkInfo.PrelevaDa)
Print #n, " -->"; "TrasferisciA:"; Str(stLocalParkInfo.TrasferisciA)
Print #n, " -->"; "PrelevaDopo:"; Str(stLocalParkInfo.PrelevaDopo)
Print #n, " -->"; "DepositaPrima:"; Str(stLocalParkInfo.DepositaPrima)
Print #n, " -->"; "PuntoPrelievo:"; Str(stLocalParkInfo.PuntoPrelievo)
Print #n, " -->"; "Piano:"; Str(stLocalParkInfo.Piano)
Print #n, " -->"; "PuntoDeposito:"; Str(stLocalParkInfo.PuntoDeposito)
Print #n, " -->"; "QuotaPrelievo:"; Str(stLocalParkInfo.QuotaPrelievo)
Print #n, " -->"; "QuotaDeposito:"; Str(stLocalParkInfo.QuotaDeposito)
Close #n
'***************************************
ImpostaStatoParcheggio_InsertQuery = "Prova"
Exit Function
gestErrore:
ImpostaStatoParcheggio_InsertQuery = ""
MsgBox ("Errore: " & Str(Err.Number) & "-" & Err.Description)
'//#ToDo: Make Log
End Function
In un Modulo (.Bas) della Dll Activex VB6 Ho il Seguente Codice
Public Type STRUCT_PARCHEGGIO
IdZona As Integer
NomeZona As String
NumeroPiazza As Integer
Abilitazione As Boolean
TipoPiazza As String
PrelevaDa As Integer
TrasferisciA As Integer
PrelevaDopo As Integer
DepositaPrima As Integer
PuntoPrelievo As Integer
Piano As Integer
PuntoDeposito As Integer
QuotaPrelievo As Integer
QuotaDeposito As Integer
UltimoMovimentoPz As Date
IdSupporto As Integer
NomeSupporto As String
ColoreSupporto As Long
NumBox As Integer
IdProdotto As Integer
CodiceProdotto As String
DescProdotto As String
ColoreProdotto As Long
IdFase As Integer
DescrFase As String
ColoreFase As Long
CodiceTrasporto As String
UnitaMisura As String
Quantita As Long
Altezza As Integer
UltimoMovimentoBox As Date
Creazione As Date
Prenotata As Boolean
SupportiAmmessi() As Integer
PiazzaNonAccessibile As Boolean
IdMacchina As Integer
ContatoreTabella As Integer
IdFaseDefault As Integer
Ch_Prelievo As Integer
Mask_Prelievo As Integer
Value_Prelievo As Integer
Ch_Deposito As Integer
Mask_Deposito As Integer
Value_Deposito As Integer
Ch_ResetOp As Integer
Mask_ResetOp As Integer
Value_ResetOp As Integer
Ch_CambioProduzione As Integer
Mask_CambioProduzione As Integer
Value_CambioProduzione As Integer
Ch_ResetProduzione As Integer
Mask_ResetProduzione As Integer
Value_ResetProduzione As Integer
Id_Programma As Integer
Precedenza_Op As Integer
Tipo_Cambio_Prod As Integer
ChiamataForzata As Boolean
OperDiStartCiclo As Long
Giracontenitore As Boolean
Value_PermessoAccesso As Integer
Ch_Nr_PezziBox As Integer
Value_Nr_PezziBox As Long
MqPerBox As Single
PiazzaADx As Integer
PiazzaASx As Integer
PiazzeAdiacenti() As Integer
Ch_Fine_Ciclo_Deposito As Integer
Mask_Fine_Ciclo_Deposito As Long
Value_Fine_Ciclo_Deposito As Integer
Ch_Fine_Ciclo_Prelievo As Integer
Mask_Fine_Ciclo_Prelievo As Long
Value_Fine_Ciclo_Prelievo As Integer
Ch_Tipo_Supporto As Integer
Mask_Tipo_Supporto As Long
Value_Tipo_Supporto As Integer
Tag As String
TempoEssiccazione As Integer
Ch_CaricoScarico982 As Integer
Mask_CaricoScarico982 As Integer
Value_CaricoScarico982 As Integer
Ch_LetturaPianiTecnoF As Integer
Mask_LetturaPianiTecnoF As Integer
Value_LetturaPianiTecnoF As Integer
Ch_ScritturaPianiTecnoF As Integer
Mask_ScritturaPianiTecnoF As Integer
Value_ScritturaPianiTecnoF As Integer
Incompleto As Boolean
CodiceScelta As Integer
TipoChiamata As Integer
End Type
Se Eseguo il programma e Richiamo la funzione ImpostaStatoParcheggio della classe
Funziona per i primi 2 cicli e al terzo passaggio mi si chiude l'ambiente VB6 senza dare errori
Dimentico qualche passaggio tra una chiamata e l'altra?