ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

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
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
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 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.
  • 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
// Load the external component integrated into the project
ResLoad is int
ResLoad = ComponentLoad(MyComponent, "C:MyApplication")
SWITCH ResLoad
CASE cisAbsent:
Error("The specified path does not correspond to the specified external component")
CASE cisVersionTooOld, cisVersionTooRecent:
Error("The version of the external component is not compatible with the executable")
CASE cisLoaded:
Info("The external component is loaded")
END
// Load a component
compo is Component
IF ComponentLoad(compo, fExeDir() + fSep() + "ComponentExample.wdk") THEN
Trace("OK")
// Execution of the component procedures
Trace(ComponentExecute("GlobalProcedures.Test"))
Trace(ComponentExecute("GlobalProcedures.TestWithParameters", (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 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.

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: wd290vm.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/14/2023

Send a report | Local help