Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   .NET (https://www.clubdelphi.com/foros/forumdisplay.php?f=17)
-   -   .net a delphi 2007. Libreria (https://www.clubdelphi.com/foros/showthread.php?t=45626)

carlohg 09-07-2007 21:49:59

.net a delphi 2007. Libreria
 
.net a delphi 2007
Hola a todos.

Quiero usar una libreria que esta hecha para .net en mi delphi 2007.

la he importado con exito de la siguiente forma:

-Component
-Import Component
-Import .NET assembly.

La abro como assembly .dll.

El problema resulta es cuando quiero aceder a los tipos, no me los reconoce.

He usado este libreria en Visual Basic 2005 y funciona perfectamente.

Como puedo hacerlo?
Gracias.

dec 09-07-2007 21:51:27

Hola,

Dejaremos esta hilo abierto, pero, no hace falta que dupliques tus mensajes. Revisa la guía de estilo de los Foros, por favor.

PD. Voy a borrar tu mensaje en este hilo para no crear confusiones. Y voy a mover este Hilo a ".NET", pues creo que "Providers" no es su sitio.

JXJ 10-07-2007 02:10:50

Delphi 2007, solo esta disponible para windows 32 bits.
no se que exista para dot net.

yo probe, instalar el componente de mydac.
en delphi for dot net 2006
y la ayuda dice que agrege el directorio de asamblies
usando el menu
Tools-> .net installed components,
de la ventana que sale, estan 3 pestañas
una para componentes .net
la otra para componentes vcl.net
y la tercera, para asammbles y poner el path

carlohg 22-07-2007 23:43:18

Importanto DLL de .NET a DELPHI
 
he creado una clase en visual 2005 y le he activado COM class y COM Visible.

En delphi lo agrego de la siguiente forma:

component - import componenet - Import :NET assembly

Y asi logro importar mi DLL.

El problema es que cuando quiero accederla me aparece lo siguiente

unit ADQclass_TLB;
// ************************************************************************ //
// WARNING
// -------
// The types declared in this file were generated from data read from a
// Type Library. If this type library is explicitly or indirectly (via
// another type library referring to this type library) re-imported, or the
// 'Refresh' command of the Type Library Editor activated while editing the
// Type Library, the contents of this file will be regenerated and all
// manual modifications will be lost.
// ************************************************************************ //
// $Rev: 5081 $
// File generated on 22/07/2007 04:07:59 p.m. from Type Library described below.
// ************************************************************************ //
// Type Lib: C:\Documents and Settings\Carlos Horacio\Mis documentos\Visual Studio 2005\Projects\ADQclass\ADQclass\bin\Debug\ADQclass.dll (1)
// LIBID: {2B16395E-8105-4512-A8B0-47408899AE9B}
// LCID: 0
// Helpfile:
// HelpString:
// DepndLst:
// (1) v2.0 stdole, (C:\WINDOWS\system32\stdole2.tlb)
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface
uses Windows, ActiveX, Classes, Graphics, StdVCL, Variants;

// *********************************************************************//
// 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
ADQclassMajorVersion = 1;
ADQclassMinorVersion = 0;
LIBID_ADQclass: TGUID = '{2B16395E-8105-4512-A8B0-47408899AE9B}';
IID__ADQclass: TGUID = '{05C172B5-176E-3BFD-9259-7003E12020FC}';
type
// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
_ADQclass = interface;
_ADQclassDisp = dispinterface;
// *********************************************************************//
// Interface: _ADQclass
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {05C172B5-176E-3BFD-9259-7003E12020FC}
// *********************************************************************//
_ADQclass = interface(IDispatch)
['{05C172B5-176E-3BFD-9259-7003E12020FC}']
procedure ConfStart; safecall;
procedure Detener; safecall;
function Get_SizePaq: Integer; safecall;
procedure Set_SizePaq(pRetVal: Integer); safecall;
function Get_FrecAdq: Integer; safecall;
procedure Set_FrecAdq(pRetVal: Integer); safecall;
function Get_Limite: Integer; safecall;
procedure Set_Limite(pRetVal: Integer); safecall;
property SizePaq: Integer read Get_SizePaq write Set_SizePaq;
property FrecAdq: Integer read Get_FrecAdq write Set_FrecAdq;
property Limite: Integer read Get_Limite write Set_Limite;
end;
// *********************************************************************//
// DispIntf: _ADQclassDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {05C172B5-176E-3BFD-9259-7003E12020FC}
// *********************************************************************//
_ADQclassDisp = dispinterface
['{05C172B5-176E-3BFD-9259-7003E12020FC}']
procedure ConfStart; dispid 1;
procedure Detener; dispid 2;
property SizePaq: Integer dispid 3;
property FrecAdq: Integer dispid 4;
property Limite: Integer dispid 5;
end;
implementation
uses ComObj;
end.

no se como acceder a mis propiedads ni a mis funciones ni procedimientos,
no se si falta un create o algo asi???

Gracias a cualquier información.

carlohg 22-07-2007 23:44:10


Esta es mi clase en visual 2005

Imports
NationalInstruments.DAQmx
<Microsoft.VisualBasic.ComClass()>
PublicClass ADQclass
Private myTask As Task
Private runningTask As Task
Private data AsDouble(,)
Private analogInReader As AnalogMultiChannelReader
Private analogCallback As AsyncCallback
Private FSizePaq AsInteger = 4096
Private FFrecAdq AsInteger = 4096
Private FLimite AsInteger = 10
Public Senales(,) AsDouble
Public Senales16(,) AsSingle
PublicSub ConfStart()
If runningTask IsNothingThen
Try
'Crear la tarea
myTask = New Task()
'Crear y configuro canales
myTask.AIChannels.CreateVoltageChannel("Dev1/ai0:31", "", AITerminalConfiguration.Nrse, Convert.ToDouble(-FLimite), Convert.ToDouble(FLimite), AIVoltageUnits.Volts)
myTask.Timing.ConfigureSampleClock(
"", Convert.ToDouble(FFrecAdq), SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, FSizePaq)
'Verifico la tarea
myTask.Control(TaskAction.Verify)
runningTask = myTask
analogInReader =
New AnalogMultiChannelReader(myTask.Stream)
analogInReader.SynchronizeCallbacks =
True
analogCallback = New AsyncCallback(AddressOf AnalogInCallback)
analogInReader.BeginReadMultiSample(Convert.ToInt32(FSizePaq), analogCallback, myTask)
Catch exception As DaqException
'Escribir en archivo de reportes
runningTask = Nothing
myTask.Dispose()
EndTry
EndIf
EndSub
PrivateSub AnalogInCallback(ByVal ar As IAsyncResult)
Try
If runningTask Is ar.AsyncState Then
data = analogInReader.EndReadMultiSample(ar)
Senales = data
analogInReader.BeginReadMultiSample(Convert.ToInt32(FSizePaq), analogCallback, myTask)
EndIf
Catch ex As DaqException
'Escribir en archivo de reportes
runningTask = Nothing
myTask.Dispose()
EndTry
EndSub
PublicSub Detener()
IfNot (runningTask IsNothing) Then
runningTask = Nothing
myTask.Dispose()
EndIf
EndSub
PublicProperty SizePaq() AsInteger
Get
Return FSizePaq
EndGet
Set(ByVal value AsInteger)
FSizePaq = value
EndSet
EndProperty
PublicProperty FrecAdq() AsInteger
Get
Return FFrecAdq
EndGet
Set(ByVal value AsInteger)
FFrecAdq = value
EndSet
EndProperty
PublicProperty Limite() AsInteger
Get
Return FLimite
EndGet
Set(ByVal value AsInteger)
FLimite = value
EndSet
EndProperty
End
Class

Jair Garza 13-08-2007 18:57:49

Que tal a todos me acabo de registrar en el foro y me llamo mucho la atencion este post

Yo estoy haciendo exactamente lo mismo con los mismos resultados, no puedo acceder a ninguno de lo metodos de la clase, el ensamblado no es mio es de otro proveedor por lo tanto no puedo acceder a ese codigo.

Solo queria preguntarle a carlohg o a alguien mas si pudieron resolver esta situacion

Saludos
Jair Garza


La franja horaria es GMT +2. Ahora son las 10:30:12.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi