PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Including a .NET assembly in a WINDEV/WINDEV Mobile/WEBDEV project
  • Using elements of .NET assembly
  • Limits
  • Incompatibility between the IE ActiveX (and oAuth2) and the use of .NET assembly
  • 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/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
The .NET technology corresponds to the new development platform of Microsoft. This .NET platform simplifies the development of distributed-object applications whose modules communicate via Internet.
This help globally explains how to use the .NET technology in WINDEV, WINDEV Mobile and WEBDEV. See a specific documentation for more details.
Caution: The components created with a version 11 (or earlier) that are using .NET will no longer operate with version 23. The components must be re-generated with version 23.
Including a .NET assembly in a WINDEV/WINDEV Mobile/WEBDEV project
To include .NET assemblies in the current application:
  1. Select "Workshop .. .NET .. Use a .NET assembly in this project".On the "Project" pane, in the "Project" group, expand "Import" and select "A .NET assembly".
  2. Select the .NET assemblies that will be included in the current application. A "Search" area allows you to easily find the requested assembly. The "Browse" button allows you to select an assembly that is not displayed in the list. The assembly selected via the "Browse" button is automatically displayed at the beginning of the list and selected.
  3. Validate. The selected assemblies are imported.
The method for using a .NET assembly is identical to the method for using a WINDEV class.
Reminder: The classes are visible in the "Project explorer" pane. The .NET classes are grouped by "Namespace".

Using elements of .NET assembly

The following elements imported into the .NET assembly can be handled in WLanguage:
  • Delegates: the delegates can be handled by DotNetDelegate.
    Versions 19 and later
    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 in parameter via the delegate is " + args:get_Message())
    New in version 19
    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 in parameter via the delegate is " + args:get_Message())
    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 in parameter via the delegate is " + args:get_Message())
  • NestedType with more than 1 level
  • Reference
  • Properties
  • Array with more than 1 dimension
  • Versions 16 and later
    Structures.
    New in version 16
    Structures.
    Structures.
  • Enums.
    Versions 16 and later
    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.
    New in version 16
    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.
    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>"

    Versions 16 and later
    The syntax without quotes is also available:
    <Object Name> is <Class Name>
    New in version 16
    The syntax without quotes is also available:
    <Object Name> is <Class Name>
    The syntax without quotes is also available:
    <Object Name> is <Class Name>

    Example:
    O is "ExternalClass.InternalClass"

    Versions 16 and later
    O is ExternalClass.InternalClass
    New in version 16
    O is ExternalClass.InternalClass
    O is ExternalClass.InternalClass
The arrays of objects are not supported in this version.
  • Versions 21 and later
    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>"
    New in version 21
    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:
    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>"
  • Versions 21 and later
    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)
    New in version 21
    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)
    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)
  • Versions 21 and later
    Extension methods:
    The extension methods can be called like the methods of the object.
    New in version 21
    Extension methods:
    The extension methods can be called like the methods of the object.
    Extension methods:
    The extension methods can be called like the methods of the object.
  • Versions 17 and later
    When possible, the WLanguage types are implicitly converted into .Net types.
    Example:
    clDotNetString is "String" dynamic
    sWLString is string = "string"
    clDotNetString = sWLString
    New in version 17
    When possible, the WLanguage types are implicitly converted into .Net types.
    Example:
    clDotNetString is "String" dynamic
    sWLString is string = "string"
    clDotNetString = sWLString
    When possible, the WLanguage types are implicitly converted into .Net types.
    Example:
    clDotNetString is "String" dynamic
    sWLString is string = "string"
    clDotNetString = sWLString

Limits

  • 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 in parameter to a WLanguage function, 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.
  • Windows Mobile No renamed framework can be used if the application uses a .NET assembly. This is a limit of .NET Compact Framework.
  • Windows Mobile If a Mobile executable that is using .NET assemblies is run on a Pocket where the .NET 2.0 Framework is not installed, the executable does not operate. No error message is displayed.
WINDEV

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

When an HTML control is used in WINDEV, this control is using the system "Microsoft Web browser" ActiveX. This ActiveX is also used by WINDEV for all the 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 code line 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 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:
  • Select "Workshop .. .NET .. List of .NET assemblies used by the project".On the "Project" pane, 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" from the popup menu of the ".NET assemblies" element.
Versions 20 and later
Reloading the .NET assemblies
You have the ability to reload the .NET assemblies used in the project to take into account a modification made to an assembly since the project opening.
  1. In the "Project explorer" pane, select the ".NET assemblies" element.
  2. Select "Reload the .NET assemblies" from the popup menu of this element.
New in version 20
Reloading the .NET assemblies
You have the ability to reload the .NET assemblies used in the project to take into account a modification made to an assembly since the project opening.
  1. In the "Project explorer" pane, select the ".NET assemblies" element.
  2. Select "Reload the .NET assemblies" from the popup menu of this element.
Reloading the .NET assemblies
You have the ability to reload the .NET assemblies used in the project to take into account a modification made to an assembly since the project opening.
  1. In the "Project explorer" pane, select the ".NET assemblies" element.
  2. Select "Reload the .NET assemblies" from the popup menu of this element.
Related Examples:
Pocket _NET Mobile (WINDEV Mobile): Pocket _NET
[ + ] This example uses a Mobile .NET assembly (OpenNETCF.Net) to retrieve the list of WIFI compatible network cards on a PDA and to retrieve information about these network cards.
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 required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment