ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing and using .NET assemblies
  • Overview
  • Integrating a .NET assembly in a WINDEV or WEBDEV project
  • Using elements of the .NET assembly
  • Limitations
  • Incompatibility between the IE ActiveX (and oAuth2) and the use of .NET assembly
  • Using standard .NET Framework 4 assemblies (and below)
  • Using standard .NET Framework 4 assemblies (and below)
  • Using standard assemblies of .NET 5 SDK
  • Using a .NET assembly created with WINDEV
  • List of .Net assemblies used in the project
  • Reloading the .NET assemblies
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
.NET technology is Microsoft's software development platform. This .NET platform simplifies the development of distributed object applications whose modules communicate via the Internet.
This help globally explains how to use the .NET technology in WINDEV, WINDEV Mobile and WEBDEV. For more details, see a specific documentation.
Integrating a .NET assembly in a WINDEV or WEBDEV project
To integrate .NET assemblies into the current project:
  1. On the "Project" tab, in the "Project" group, expand "Import" and select "A .NET assembly".
  2. In the window that appears, select the .NET assemblies to be integrated into the current project.
    • A "Search" area allows you to easily find the desired assembly.
    • The "Select from disk" button allows you to select an assembly that does not appear in the list. The assembly selected via the "Select from disk" button is automatically selected and appears at the top of the list.
    • The "Fill list automatically" button searches for all assemblies available on the computer.
    • If necessary, specify the targeted .NET framework. The list shows the different Microsoft versions. The "Automatic" option is selected by default.
      Remark: The list of assemblies may vary depending on the targeted .Net framework.
  3. Validate. The selected assemblies are imported.
Using a .NET assembly is equivalent to using a class in WLanguage.
Reminder: The classes are visible in the "Project explorer" pane. The .NET classes are grouped by "Namespace".

Using elements of the .NET assembly

The following elements imported into the .NET assembly can be handled in WLanguage:
  • Delegates: the delegates can be handled by DotNetDelegate.
    You also have the ability to add a delegate with the += operator:
    clDotNet is ClassEventManagement
    // Branch the event
    clDotNet:m_LogHandler += Proc_Test
    // ...
    // Triggers the event
    clDotNet:SendAMessage("String sent")
    //-------------------------------------------------
    // Manage the event
    PROCEDURE Proc_Test(src, args)
    Info("The string passed as parameter via the delegate is " + args:get_Message())
  • NestedType with more than 1 level
  • Reference
  • Properties
  • Array with more than 1 dimension
  • Structures.
  • Enums.
    You have the ability to combine the Enum coming from .Net assemblies via &, | , ||, ~ . You have the ability to convert the enums into integers or to build them from integers.
  • Internal classes: the following syntax must be used:
    <Object name> is "<Class name>"

    The syntax without quotes is also available:
    <Object name> is <Class name>

    Example:
    O is "ExternalClass.InternalClass"

    O is ExternalClass.InternalClass
  • Generic:
    The following syntax is used to instantiate a generic:
    <Object name> is "<Generic name><<Concrete type>>"
    Example for instantiating a generic:
    MyList is "List<CMyObject>"
  • Generic methods:
    The following syntax is used to call a generic method:
    <Object name>."<Name of generic method><<Concrete type>>"(<parameters>)
    Example for calling a generic method:
    // Prototype of the generic CloneList method of CClone class
    // CloneList(List<T>)
    // ...
    MyList is "List<int>"
    // ...
    clClone is CClone
    MyListCopy is "List<int>" <- clClone."CloneList<int>"(MyList)
  • Extension methods:
    The extension methods can be called like the methods of the object.
When possible, the WLanguage types are implicitly converted into .Net types.
Example:
clDotNetString is "String" dynamic
sWLString is string = "string"
clDotNetString = sWLString

Limitations

  • A WLanguage class cannot be derived from a .NET class.
  • The following types are supported:
    • Date/Time
    • WINDEV currencies. In output, the WINDEV currencies are converted into decimal numbers.
    • Decimal numbers
      A decimal parameter passed from a .NET assembly to a WLanguage function is converted into currency if possible. If this conversion is not possible, the parameter is converted into double.
    • Structures
  • The objects derived in .NET from an exported WLanguage class are not supported. If an object of this type is passed to a WLanguage function as parameter, it is "casted" into the base WLanguage type.
  • Passing pointer parameters between WLanguage and .NET is not supported.
  • The "structure" members found in classes and/or in sets are not visible in .NET because the WLanguage structures are not visible in .NET. To fix this problem, create a class containing the code of the structure.
  • The "class" members found in classes and/or in sets are visible in .NET only if the class is exported as well.
  • Caution: Components created with version 11 (or earlier) that use .NET will no longer work with version 2024. It is necessary to generate the components again with version 2024.
WINDEV

Incompatibility between the IE ActiveX (and oAuth2) and the use of .NET assembly

When an HTML control is used in WINDEV, this control uses the system "Microsoft Web browser" ActiveX. This ActiveX is also used by WINDEV for all OAuth2 authentications (Facebook, Twitter, Google, etc.) that require a validation for the connection via HTML code.
If an HTML control (or an OAuth2 authentication) and a ".Net"assembly are used in the same project, an incompatibility may occur between the .NET layers of Microsoft and the ActiveX.
An API can be used to manage this cohabitation. To do so, the following line of code must be used in the initialization code of the project or in the initialization code of classes or global procedure if the ".Net" object is initialized in the class or in the set of procedures:
// Used to manage the cohabitation between IE ActiveX and .NET
API("OLE32", "CoInitializeEx", Null, 2)
Using standard .NET Framework 4 assemblies (and below)

Using standard .NET Framework 4 assemblies (and below)

To use standard .NET Framework 4 assemblies (and below):
  1. Select the ".NET assemblies" folder in the "Project Explorer" pane.
  2. Open the context menu and select "Use a .NET assembly".
  3. In the window that appears, click "Automatically complete a list with the .NET assemblies on your disk. Caution: This process may take quite a long time.".
  4. Select the standard assemblies to use (mscorlib.dll or another assembly).
  5. Validate.

Using standard assemblies of .NET 5 SDK

To use standard assemblies of .NET 5 SDK:
  1. Select the ".NET assemblies" folder in the "Project Explorer" pane.
  2. Open the context menu and select "Use a .NET assembly".
  3. In the window that appears, click "Select the .NET assemblies on disk....".
  4. Select the installation directory of the .NET 5 SDK. For example:
    "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0".
  5. Select the standard assemblies to use (System.Runtime.dll or another assembly).
    Caution, this directory contains the mscorlib.dll file. This file must not be selected if the .NET 5 SDK is used.
  6. Validate.
Using a .NET assembly created with WINDEV
The assemblies generated by WINDEV can be used like any other .NET assembly. However, the WINDEV framework and the assembly must be found in the same directory.
List of .Net assemblies used in the project
To display the list of .Net assemblies used in the project, you can:
  • On the "Project" tab, in the "Project" group, expand "List of elements" and select "List of .NET assemblies used".
  • In the "Project explorer" pane, select "List of .NET assemblies used in the project" in the context menu of ".NET assemblies".
Reloading the .NET assemblies
You can reload the .NET assemblies used in the project to take into account a change made to an assembly since the project was opened.
  1. In the "Project explorer" pane, select ".NET assemblies".
  2. In the context menu of this element, select "Reload .NET assemblies".
Related Examples:
WD Text-To-Speech Training (WINDEV): WD Text-To-Speech
[ + ] This example explains how to perform a speech synthesis in a WINDEV application by using the SpeechSynthesizer class found in the .NET framework.
Note:
- This example requires .Net version 3.0 (or later),
- The speech synthesizer is available in English version by default.
WD Using DotNET classes Training (WINDEV): WD Using DotNET classes
[ + ] This example enables you to use the .NET classes in WLanguage
In this example, we will be using:
- the String class that is used to handle the character strings (switch to lowercase/uppercase characters, count the number of characters, ...).
- the MessageBox class that is used to create custom dialog boxes (ability to choose the text, the icon and the buttons).
These two classes come from the mscorlib.dll and System.Windows.Form.dll assemblies.
- a .NET control used to view the Web pages.

Summary of the example supplied with WINDEV:
This example is used to:
- analyze a character string (number of characters, number of words, replacement of characters, ...)
- configure the dialog boxes (buttons, icon, text). The name of the button selected by the user is automatically displayed.
- use a .NET control in order to view the Web pages.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/12/2023

Send a report | Local help