Hello,
I have a issue report from user, he was creating a custom DLL and trying to declare it in PcVue using SCADA BASIC. The DLL was placed in PcVue Bin Folder.
The problem is, I tested his project on my laptop and it works fine, and user tried on his workstation, and it works too but failed to be declared inside VM environment.
I put here the code that was done to declare the dll and call the dll function.
Declare Function GetCoordinates LIB "DLL1" ALIAS "GetCoordinates" () As Str;'Private
Declare Function GetCoordinatesX LIB "DLL1" ALIAS "GetCoordinatesX" () As long;'Private
Declare Function GetCoordinatesY LIB "DLL1" ALIAS "GetCoordinatesY" () As long;'Private
Sub testSetPos()
Dim position As Str;
Dim positionx As long;
Dim positiony As long;
Print("At test set pos");
Print("Get position as 40X 40Y : ");
position = GetCoordinates();
positionx = GetCoordinatesX();
positiony = GetCoordinatesY();
Print("REeturn value : ", position);
Print("GetCoordinatesY value : ", positionx);
Print("GetCoordinatesX value : ", positiony);
End Sub
And here is the error that is shown on event viewer when run from VM.
2021/02/25,17:30:21.270,6,A,,9030,,1,BASIC,Program (P) Branch () Line 10 2021/02/25,17:30:21.270,6,A,,9030,,1,BASIC, DLL not found : DLL1 2021/02/25,17:32:14.073,6,A,,9030,,1,BASIC,Program (P) Branch () Line 10 2021/02/25,17:32:14.073,6,A,,9030,,1,BASIC, DLL not found : C:ARC InformatiquePcVue 12BinDLL1 2021/02/25,17:33:00.870,6,A,,9030,,1,BASIC,Program (P) Branch () Line 10 2021/02/25,17:33:00.870,6,A,,9030,,1,BASIC, DLL not found : C:ARC InformatiquePcVue 12BinDLL1.DLL
What I have tried so far (all with error still persists)
- Declare the dll as per above code
- Declare the dll with full path name to PcVue bin folder
- Declare the dll with full path name including extension
- Placed the dll inside TP folder
Does anyone have any trick or solution for this? How to declare custom DLL when PcVue is run from within VM?
Thanks,
Kantha
Hi Kantha,
That's an interesting issue!
I suggest you declare a system DLL and check if it works or not. That will give some clues.
By the way, not related to your issue but, I hope you know there is a basic system dll given the mouse position!!
Nico
Hello Nico,
I tried to declare the DLL in system, but it gave me some error. I am 100% sure the file is in the correct path.
I have requested the user to try to declare from his end and try.
I think the user knows about windows dll, but these guys they do a lot of custom program to be used with PcVue.
Thanks
Kantha
Misunderstanding !!
I was asking you to test a system dll not to register this dll in the system 🙂
For example this famous getMousePosition from our KB
DECLARE SUB GetCursorPos Lib "USER32" (HBF_POSI as long);
'-------- Function main
SUB main()
END sub
'-------- Use of function GetCursorPos
SUB test()
DIM Mouse_Buffer as long;
DIM Mouse_PosX as Integer;
DIM Mouse_PosY as Integer;
Mouse_Buffer = ALLOC_BUFFER(10);
GetCursorPos( Mouse_Buffer );
Mouse_PosX = IGET_BUFFER( Mouse_Buffer , 0); 'X coordinate is available at offset 0
Mouse_PosY = IGET_BUFFER( Mouse_Buffer,4); 'Y coordinate is available at offset 4
PRINT("Mouse_PosX = ",Mouse_PosX);
PRINT("Mouse_PosY = ",Mouse_PosY);
PRINT(" ");
Free_buffer(Mouse_Buffer);
END SUB
That is interesting Nico.
I tried using the program you copied below, it is working fine to get the coordinates.
But using custom DLL, it always throw error DLL not found.
The only difference is, it fails to run in VM environment for custom DLL, but no problem to run the same in physical server.
So a bug?
Thanks,
Kantha
Hi,
Have you already checked the dependencies ?
Maybe one is missing or with an incorrect version.
Ok Kantha, my feeling is the issue is not in PcVue.
So, the best way is to prove it.
I suggest you create a basic vbs script (.vbs) using the Dll (example: here)
I bet you will have the same issue and, here, no PcVue in the loop
Nico
Hello Florent and Nico,
Thank you so much for your assistance. Indeed there was some dependency on the DLL, that is why it failed to run in VM environment.
User have figured it out and the problem is solved now.
Thank you so much.
Kantha


