Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 9 Jahren, 2 Monaten
Letzter Beitrag:
vor 9 Jahren, 2 Monaten
Beteiligte Autoren:
BLS, Gus

Using a WinDev assembly from a .NET app

Startbeitrag von Gus am 17.04.2009 18:07

Hi:
Did someone create a .NET assembly in WinDev and called it from a .NET app? I tried this, but the .NET app throws an exception because it says that DW120NET2.DLL (which is provided by WinDev for .NET interop) contains unmanaged code.
Does someone have experience with this? Any example to see?

Thanks;
Gus

Antworten:

Hi Gus,
I have done it using Visual C# 2005 and WD 11. I wrote an introduction a few month ago. (Here on MySnip) ...

Regarding your error : which :NET framework(s) are installed on your machine ?
Björn

von BLS - am 17.04.2009 18:21
okeedokee, quite trivial but nevertheless here it is :

http://forum.mysnip.de/read.php?27131,13960,15066#msg-15066

HTH Björn

von BLS - am 17.04.2009 18:25
Hi Bjorn:
I 'm using VS2008 and I have installed Framework 1, 2, 3 and 3.5 (all flavors!)

Gus

von Gus - am 17.04.2009 21:10
Hi Gus,
I''ll re-create my WD assembly using WD12 and recompile the C# stuff in VC # 2008 this weekend. I'll keep you informed. Sorry that's all I can do atm.
Björn


von BLS - am 18.04.2009 06:49
Hi Bjorn:
Thanks for that.
In my case, I created a class which has a method. This method opens a simple window.
When the code initialize the class:

WL.CClass1 w = new WL.CClass1();

I get the folowing error:
TypeInitializationException was unhandled.
The type initializer for 'WL.CClass1' threw an exception.

Right now, I'm testing this on a Windows application. But my idea is to generate an assembly which can be called from SQL Server as a STORE PROCEDURE (and then it can be used in triggers) so I can use HFile syntax rather than C# .

Thanks;
Gus

von Gus - am 18.04.2009 18:27
Hi Gus,
Quote
Gus
Hi Bjorn:

Right now, I'm testing this on a Windows application. But my idea is to generate an assembly which can be called from SQL Server as a STORE PROCEDURE (and then it can be used in triggers) so I can use HFile syntax rather than C# .

Gus


Means you want to call :
1) A WINDEV assembly from a MS SQL server stored procedure ?
Doable.

2) (and then it can be used in triggers )
What is IT .... and what part of code you are talking about ?
You can not define/start a trigger from within a stored procedure (afaik)

2 a)... so I can use HFile syntax rather than C#

IF you want to use the HFxxx Syntax from, for instance, C# or any other DOT NET language , you can simply create a wrapper class in WINDEV which encapsulates these calls. ( There are other options, though)

Note : In case that want to use a WD class from C# et. al :
A method like this one is not acceptable. RUNTIME Error

FUNCTION Mutation( nMutation )

So :WINDEV Duck Typing is not usable from any other DOT NET language
Instead :

FUNCTION Mutation(nMuitation is int ) // or better : Mutation(LOCAL nMuitation is int )

is what you need.
Following this guidelines using a WD class from any other DOT NET language is straight forward and works pretty fine.

If you like ? I am willing to help you as much as can...just let me know.
Björn


von BLS - am 18.04.2009 19:43
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.