|
|
|
|
|
- Overview
- Implementation
- Including the files of the C# interface of WINDEV
- Loading the WINDEV library (WDL)
- Running WINDEV codes from the external language
- 1. Calling a WLanguage code
- 2. Retrieving the events triggered in the WINDEV windows
- Ending the application
External language: Programming in C#
We are going to call the elements developed in WINDEV (project, windows, analysis, ...) from the C# language. Reminder: C# is a language on the .NET platform. The WLanguage code used from the external language will be dynamically compiled and run during its call. This mode is illustrated in the "City.cs" project (C# format), available in the "External Languages\EN\C#" subdirectory of the WINDEV installation directory. Remarks: - C# does not allow you to use the HFSQL engine. To use the HFSQL engine, perform the necessary processes in WINDEV.
- Compatible with Visual C++ versions 4.2 and 6.0 and later.
Including the files of the C# interface of WINDEV The following file must be found in the runtime directory of your C# program in order to call the C# interface of WINDEV: - WINDEV.CS
- wdxxxle.dll
- wdXXXICS.DLL
The methods of the WINDEV class must be called and prefixed by "WinDev.": WinDev.APPELWD("BIBLI,Disque,ville.wdl"); Loading the WINDEV library (WDL) The WINDEV library (.WDL) contains all project elements (windows, reports, classes, queries, analysis, ...). Therefore, it must be loaded in memory in order for its components to be called. Attention: If you need to load windows from outside the library, the code for each of these windows must be integrated into the corresponding ".WDW" file ("Integrate compiled code" option checked, in the "Details" tab of each window description). // Ouverture de la bibliothèque // si WDEntier n'est pas nul, la bibliothèque n'a pas été trouvée! WinDev.APPELWD("BIBLI,Disque,ville.wdl"); if (WinDev.WDEntier() == 0) { ... } else { // Bibliothèque non trouvée WinDev.APPELWD("Erreur, Bibliothèque non trouvée"); } // Terminer... WinDev.WDTermine(); Running WINDEV codes from the external language 1. Calling a WLanguage code All the WLanguage functions can be called from the external language. The behavior of these WLanguage functions as well as the returned values are identical whether they are called: - from WINDEV or
- from the interface of external language
To find out the parameters and the return values of a WLanguage function, see the online help or the documentation about WLanguage. You can use CALLWD to call a WLanguage procedure from the external interface. For example: // Ouverture de la première fenêtre du programme contenant le menu WinDev.APPELWD("OUVRE,menufc.wdw"); 2. Retrieving the events triggered in the WINDEV windows The input in the WINDEV windows requires to retrieve the events triggered in these windows. To retrieve the user events (click on a menu, on a button, and so on), you must implement a system based on a loop in your C# program. This loop will remain active as long as the WINDEV window is opened and it will be used to intercept each user action. To find out the type of action performed by the user, you have the ability to use a character string variable (in WLanguage) named 'WDKey'. This variable will be used in your WLanguage code to signal to the C# program the button that was pressed for example. Example: Code in C# // Ouverture de la première fenêtre du programme contenant le menu WinDev.APPELWD("OUVRE,menufc.wdw"); // le programme boucle jusqu'à ce que le choix Fichier Quitte // soit sélectionné while (bSaisie) { // on effectue la saisie du menu WinDev.APPELWD("Ecran,Saisie"); // le compte-rendu WDTouche vaut *M* lorsque un choix de menu //a été sélectionné string szOption = WinDev.WDTouche(); if (szOption == "*M*") { ... } } WinDev.APPELWD("FERME"); Code for intercepting the selection of "File..Exit" of the WINDEV "Menu" window: // abandon if (WinDev.WDTouche() == "FQ") { bSaisie = false; } When the user selects "File..Exit": - WDKey will return "*M*".
- WDString will return the shortcut letters in the order in which the menus are selected. In our example, WDString returns "FE".
To end the use of external interface, type the following lines of code: // Terminer... WinDev.WDTermine();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|