Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jhamard
Partner - Contributor III
Partner - Contributor III

Calling a DLL function in my QV script ...

Hello,

I'm trying to do something special in QlikView Desktop and need your help …
I want to call (in my script) a Function() stored in a DLL.

In this simple example, the called function returns the “DoubleClickTime” which is a NUMBER in milliseconds.
The function is stored in "user32.dll" and is called "GetDoubleClickTime()".
I've read it's mandatory to use a wrapper (eg DynamicWrapperX in my case) to load a DLL in VBScript.
It's one of the big diffences between VB/VBA and VBScript ...

My QV sript (CTRL+E):

DATA:

LOAD

  'TOTO'        AS F1

  ,Test()       AS F2

  ,AddOne(100)  AS F3

AutoGenerate(1);


My QV module (CTRL+M):
Function AddOne(Val)
  AddOne = Val + 1
End Function
'--
Function Test()
  Dim DWX
  Set DWX = CreateObject("DynamicWrapperX")
  DWX.Register "user32.dll", "GetDoubleClickTime", "r=u"
  Test=DWX.GetDoubleClickTime
End Function

test.qvw application is attached to this discution.

After reloading the application, my result is a table named DATA having one line:
F1F2F3
TOTOnull()101

Addone() is a very simple function used to validate that calling a VBScript function in a script work. And it works well.
Test() is more complicated, and doesn’t work. It return a null() value rater than "500" wich is the expected result.
I’m using a wrapper (DynamicWrapperX 2.1.1.1) to call "GetDoubleClickTime()" function which is stored in "user32.dll".
Easy, isn't it ?

The Test() function has been tested in a simple VBScript named “test.vbs” lookink like this :
wscript.echo "DoubleClickTime is " & Test & " ms"

Function Test()
   Dim DWX
   Set DWX = CreateObject("DynamicWrapperX")
   DWX.Register "user32.dll", "GetDoubleClickTime", "r=u"
   Test=DWX.GetDoubleClickTime
End Function

test.vbs script is attached to the discution.


I’ve registred the DynamicWrapperX DLL with administrator privileges.

Using cmd.exe (opened with admin account) :

C:\...\>regsvr32 dynwrapx.dll

Execute the script using cmd.exe (with administrator privileges):

C:\...\>cscript test.vbs

Microsoft (R) Windows Script Host Version 5.812

Copyright (C) Microsoft Corporation. Tous droits réservés.


DoubleClickTime is 500 ms


The result is good
Thus it should work in QlikView, isn't it ? But it don't 

Where is the problem in QlikView ???
Any suggestion is welcome ...
I've remark several things:
  1. There's nothing special in the QV application logs. No Error.
  2. In QV 'Edit Module', when I test my Test() function, i receive this message : ActiveX component can't create object: 'DynamicWrapperX'
  3. ActiveX component can't create object: 'DynamicWrapperX' message appears when I call 'cscript test.vbs' and if I haven't registred the DynamicWrapperX in Windows (regsvr32 dynwrapx.dll).
  4. I've to be administror to execute the test.vbs script. Otherwise I have the error message : ActiveX component can't create object: 'DynamicWrapperX'. Why ? I don't know
  5. I've to be administror too, to register the dll. Otherwise I have the error message : ActiveX component can't create object: 'DynamicWrapperX'
I've tried a lot of things that don't work:
  1. Using full dll path when calling CreateObject() --> ActiveX component can't create object: 'DynamicWrapperX'
  2. Copying the DLL in the QV DLL folders & binary folders, in System32 folder too ... --> ActiveX component can't create object: 'DynamicWrapperX'
  3. Opening/reloading the application with administrator account. It doesn't change anything ... --> ActiveX component can't create object: 'DynamicWrapperX'
  4. A lot of little things ... --> ActiveX component can't create object: 'DynamicWrapperX'
  5. Drinking beers & tea ... --> ActiveX component can't create object: 'DynamicWrapperX'

My sources :
Why am I doing that ?
Because the use of DLL hugely opens opportunities to QlikView. Like IBAN validation (too complex in QV script), encryption capability (not a simple hashing), complex transformations using C/C++/VB/... functions, ..., to go on the moon perhaps
Many thanks for reading me. Even more for helping me ...
-
Julien
1 Solution

Accepted Solutions
marcus_sommer

Your AciveX error-message is caused from security-settings. At first within the module-editor you need to enable system-access (left pane in the mid) and then the settings from the OS (mostly configured within the options of the IE).

What is the aim from the use of these function within the load-execution?

- Marcus

View solution in original post

2 Replies
marcus_sommer

Your AciveX error-message is caused from security-settings. At first within the module-editor you need to enable system-access (left pane in the mid) and then the settings from the OS (mostly configured within the options of the IE).

What is the aim from the use of these function within the load-execution?

- Marcus

jhamard
Partner - Contributor III
Partner - Contributor III
Author

Many thanks Marcus.

My problem was solved by changing the Module & Local Security.

Untitled.png

Calling "user32.dll" and getting the double-click time is a simple test.

What I need to do is calling a proprietary decryption dll during the load of data comming from an encrypted database.

-

Julien