Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 6 Jahren, 6 Monaten
Letzter Beitrag:
vor 6 Jahren, 6 Monaten
Beteiligte Autoren:
Jeff Graham, Alexandre Leclerc, Gautam.pcs.crosspost

Using a .NET Assembly in Windev (and porting code)

Startbeitrag von Gautam.pcs.crosspost am 16.12.2011 12:39

Hello All

I am trying to use a third party .NET assembly (DLL) in a Windev 16 project. The documentation that came with the assembly has sample VB.net code (see below). I am not sure how/where I must declare this code in my project - I am especially confused by the "namespace" and "interface" portion of the code.

Can someone guide me on how I can declare the equivalent code in Windev?

I have included the referenced .NET assembly by going to Workshop->.NET->Use a .NET assembly in this project option.
The name of the assembly is Quickfix:

The first portion of the code is as follows:

Namespace QuickFix
Public Interface Application
Public Sub onCreate(ByVal sessionID As SessionID)
Public Sub onLogon(ByVal sessionID As SessionID)
Public Sub onLogout(ByVal sessionID As SessionID)
Public Sub toAdmin(ByVal message As Message, ByVal sessionID As SessionID)
Public Sub toApp(ByVal message As Message, ByVal sessionID As SessionID)
Public Sub fromAdmin(ByVal message As Message, ByVal sessionID As SessionID)
Public Sub fromApp(ByVal message As Message, ByVal sessionID As SessionID)
End Interface
End Namespace

and the second part is

Imports QuickFix

Module MyModule
Sub Main(ByVal CmdArgs() As String)
If(CmdArgs 1) Then
End If

Dim fileName As String = CmdArgs(1)

Dim settings As New SessionSettings(fileName)
Dim application As New MyApplication()
Dim storeFactory As New FileStoreFactory(settings)
Dim logFactory As New FileLogFactory(settings)
Dim messageFactory As New DefaultMessageFactory()
Dim acceptor As New SocketAcceptor(application, storeFactory, settings, logFactory, messageFactory)
'While( condition = True )
' do something
'End While
Catch e As ConfigError
End Try
End Sub
End Module



Message forwarded from pcsoft.us.windev


Hi Gautam,

It's not much of practical help, but the documentation and related examples can most probably help you. http://doc.pcsoft.fr/en-US/?6010005. (Once I tried and implemented in a project the WD DirectoryObserver example and was surprised how easy it was and knowing nothing of .Net)

Kind regards,
Alexandre Leclerc

von Alexandre Leclerc - am 16.12.2011 15:37
Hi Gautam,

I recently have tried using .NET assemblies and C# code with limited success when the .NET assemblies are complex. I was able to use some .NET assemblies easily but others just got a GFI in the WD test. See my post in WinDev Solutions:

I am not sure when the Namespace QuickFix subs come in to play but that may show up as you declare the objects.

My suggestion is to go step by step. In your sample VB code, where it uses "New", try the following:

yourWDName is NetObject dynamic
yourWDName is new NetObject() // with parameters if required

where NetObject is SessionSettings, etc

I would just add one .Net object at a time and test to make sure all the required dlls are in your EXE directory and that it will create the object. If you use the default exception processing and there is a framework error you will get detail information that will help.

Once you get the acceptor object created, try the method call and see what happens.


von Jeff Graham - am 16.12.2011 22:01
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.