LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

NewActiveXCtrl(fromFile/Persistence) ClassID does not match to Function

Hello,
 
i'd like to load different ActiveX controls to the same position at one panel.
I don't want to include those ActiveX controls with right click -> ActiveX -> Select ActiveX Control to the panel, but at runtime programatically.
 
I have found the following functions:
NewActiveXCtrl
NewActiveXCtrlFromFile
NewActiveXCtrlFromPersistence
 
The class id (clsid) that i get for the MS Webbrowser control has the format 8-4-4-4-12 (e.g. 8856F961-340A-11D0-A96B-00C04FD705A2).
 
As far as I know the functions NewActiveXCtrl and NewActiveXCtrlFromFile only accept the format: 0x5, 0x1, 0x1, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2 (e.g.: 0x6F03A, 0x0, 0x0, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x46)
 
How can i convert the 8-4-4-4-12 format to the format that matches to the functions?
 
The function NewActiveXCtrlFromPersistence seems to support the 8-4-4-4-12 format but i have problems to understand and create the "persistence text" as defined in the function prototype:
 
 (extern int CVIFUNC_C NewActiveXCtrlFromPersistence (int panel, const char *ctrlLabel, int top, int left, char *defaultIID, int binaryFormat, char *persistenceText, HRESULT *activeXError);)
 
Does somebody has a clue how to convert the 8-4-4-4-12 format or to create an ActiveX control independent "persistence Text"?
 
Best regards
 
MaWie
 
 
 
0 Kudos
Message 1 of 3
(3,555 Views)

The CVI Activex Driver wizard generates all this code for you. So try the following

Drop down a web browser control on the panel
right click and generate an activex driver for it.
Delete the web browser control from the panel and then use SHDocVw_NewWebBrowserIWebBrowser2() to add a new control on the panel. You can then use GetObjHandleFromActiveXCtrl() to get the object handle from the control ID. The code that the wizard generates is included as well, so you can see how that function is being used.

I hope this helps.

Bilal Durrani
NI
0 Kudos
Message 2 of 3
(3,536 Views)
Hello,
 
because I stucked at the same point again, I'd like to post my results here:
 
Actually it is really simple, the general format for class ids is the 8-4-4-4-12 format.
For any reason the CVI function NewActiveXCtrlFromFile doesn't accept that format, but it accepts a 8,4,4,2,2,2,2,2,2,2,2 format.
 
Example:
Webbrowser class id is :
{8856F961-340A-11D0-A96B-00C04FD705A2}
 
In order to use it with NewActiveXCtrlFromFile you have to transform the class id to:
GUID browserClassId = {0x8856F961, 0x340A ,0x11D0 0xA9, 0x6B 0x00, 0xC0, 0x4F, 0xD7, 0x05, 0xA2};
 
Hope that someone find it useful.
 
 
 
 
 
0 Kudos
Message 3 of 3
(3,404 Views)