ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Miscellaneous Windows functions
  • Loading in memory an external component integrated into the project
  • Loading an external component independent of the project
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Loads an external component. This component can be:
  • an external component present in the current project. In this case the external component is loaded in memory until the application is closed.
  • an external component independent of the current project. The component is loaded in a variable of type Component. This makes it possible to get a global interface that can be used in the component.
Remarks:
  • External component integrated into project: The loading mode of the external component (at project launch, or when a component element is used for the first time) is defined when the component is integrated into the project.
  • When the component is loaded, the following WLanguage events are executed:
    • Declaration of the classes of the external component.
    • Declaration of the sets of procedures of the external component.
    • Initialization of the external component.
Example
// Charger le composant externe intégré au projet
ResChargement is int
ResChargement = ComponentLoad(MonComposant, "C:\MonApplication")
SWITCH ResChargement
	CASE cisAbsent:
		Error("Le chemin spécifié ne correspond pas au composant externe indiqué")
	CASE cisVersionTooOld, cisVersionTooRecent:
		Error("La version du composant externe est incompatible avec l'exécutable")
	CASE cisLoaded:
		Info("Composant externe chargé")
END
// Charment d'un composant
compo is Component
IF ComponentLoad(compo, fExeDir() + fSep() + "CompoExemple.wdk") THEN
	Trace("OK")
	// Exécution des procédures du composant
	Trace(ComponentExecute("ProcéduresGlobales.Test"))
	Trace(ComponentExecute("ProcéduresGlobales.TestAvecParam", (1)))
END
Syntax

Loading an external component integrated into the project Hide the details

<Result> = ComponentLoad(<Component name> [, <Component directory> [, <Load mode>]])
<Result>: Integer constant
Status report of the load operation:
cisAbsentThe external component is not found in the specified path.
cisLoadedThe external component was successfully loaded.
cisVersionTooOldThe version of the external component is too old. It is not compatible with the current executable.
cisVersionTooRecentThe version of the external component is too recent. It is not compatible with the current executable.
<Component name>: Character string
Name of the external component (as it appears in the editor) to load. A WLanguage error occurs if the name of the external component is unknown.
<Component directory>: Optional character string
Directory of the external component (WDK file) to load. This directory may (or may not) end with a "\". A full path, a relative path or a UNC path can be used.
If this parameter is not specified, the external component will be searched:
<Load mode>: Optional Integer constant
Load mode of the external component. Corresponds to one of the following constants:
ccGlobalThe external component is loaded globally. For example, the same context will be used if the component is loaded by the project and by a project component.
ccIsolated
(Default value)
The external component is isolated. For example, if the component is loaded by the project and by a project component, each component will use a specific context.

Loading an external component independent of the current project Hide the details

<Result> = ComponentLoad(<Component> , <Component name>)
<Result>: Boolean
  • True if the component has been loaded,
  • False otherwise.
<Component>: Component variable
Name of the Component variable in which the component is to be loaded.
<Component name>: Character string
Full path and physical name of the external component to be loaded (WDK file).
Remarks

Loading in memory an external component integrated into the project

The loading mode of the external component is defined when the component is integrated into the project. It can be loaded when the project is started or when an element of the component is used for the first time.
To change the loading mode:
  1. Display the list of external components imported into the project:
    • In the "Project explorer" pane, select the "External components" folder.
    • Open the context menu of the folder and select "List of external components imported into the project".
  2. Select the desired component and click "Description".
  3. Change the load mode ("Component load mode" option).
Reminder: When a component is loaded, the following WLanguage events are executed:
  • Declaration of the classes of the external component.
  • Declaration of the sets of procedures of the external component.
  • Initialization of the external component.

Loading an external component independent of the project

ComponentLoad does not cause fatal errors. The function returns False in the following cases:
  • the component is not found.
  • the loaded component is being replaced with another component.
Business / UI classification: Neutral code
Component: wd300vm.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/21/2024

Send a report | Local help