Back

Topic

[KB1246]Preventing PcVue crash when a required DLL for 3D is missing

Tags: 3D, Scada Basic

5 months ago
By YAMA
Options
Print
Applies to:
PcVue 16.2 onwards
Summary:
To prevent PcVue from crashing when opening a 3D mimic if the required DLL is missing, a function can be used to check for the presence of the file. This check allows access to the mimic to be controlled via a status variable. In next version PcVue should no more crash if this dll is missing.
Details:

Issue

PcVue may crash when opening a 3D mimic if a required DLL is missing at initialization.

Cause

The absence of the DLL at mimic startup causes a critical error, as the file is required for certain 3D functionalities.

Solution

To avoid this issue, the FSTAT instruction can be used in a PcVue program to check for the presence of the DLL during initialization (in the initialization program).

Steps to follow:

  • Create a verification function in a PcVue program:
    • Use the FSTAT instruction to test for the presence of the DLL.
    • FSTAT returns 0 if the file is missing, and 1 if it is present (as it provides the file size and last modification date).
  • Control a bit variable:
    • If the DLL is present → the variable is set to 1.
    • If the DLL is missing → the variable is set to 0.
image
image

sub verif()
DIM res as integer;
DIM bufh as LONG; ‘buffer handle
CONST ALLOC=22; ’22 is the minimum required
Dim str_path as str;
Dim name as str;
Dim chemin as str;
CONST ALLOC=22; ’22 is the minimum required
str_path = GetApplicationDir();’for the access path
chemin = ADDSTRING(str_path,”\\D3DX9_43.dll”);’ the complete access path
bufh=ALLOC_BUFFER(ALLOC);
res=0;
res= FSTAT(chemin,bufh);
print(res);
print(bufh);
if (res=!0) then
@DLL_present =1;
end if
FREE_BUFFER(bufh); ‘free buffer
end sub

  • Configure the Link/open animation of the mimic:
    • In the Interlock condition field, insert the status variable.
    • Define the access condition (e.g., allow access only if the variable = 1).
image
image

Created on: 20 May 2025