LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DS_Open and Microsoft WebBrowser ActiveX conflict?

Solved!
Go to solution

In the past days I found a problem (or a kind of conflict) between DS_Open function and Microsoft WebBrowser ActiveX.

On my PC (Win XP Pro SP2, CVI 6.0 with a later installation of CVI RTE 8.1) it's easy to reproduce the problem:

- download the dsweb.zip example from here

- if you launch this example everything should work fine

- on the uir add a Microsoft WebBrowser Activex

- recompile the project and run it

- when you  press "Get Web Page" you have a fatal error in RunUserInterface() function

 

could someone help me? 

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 4
(4,401 Views)
The problem is in dsweb.c. It is incorrectly calling DS_DiscardObjHandle in the DataSocket callback - this causes the DataSocket object to be prematurely destroyed. The solution is to discard the datasocket object outside the datasocket callback - say, after QuitUserInterface.
Message 2 of 4
(4,390 Views)

Thank you very much Mohan; your suggestion fixes the behaviour perfectly.

Now I have another strange problem in my application, that unfortunately is very long and complex...

After I call a DS_Open function I see the following problem:

  • when I call FileSelectPopup() with fileTypeList set to "*.html", I can see the list of files in the defaultDirectory, but the icons aren't the usual Internet Explorer icons: they are the Unknown File Type icons
  • when I double-click a file, I load a new panel with a Microsoft WebBrowser ActiveX in it, but the LoadPanel() function crashes with the fatal "ActiveX error". If I haven't called the DS_Open() before, everything works fine. Even if I call DS_DiscardObjHandle() before FileSelectPopup() the program crashes anyway.
Have you any ideas?
Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 3 of 4
(4,341 Views)
Solution
Accepted by topic author vix

I am not sure about the icon problem. You can check how these files look when you open the default directory in Windows Explorer. It is probably a system specific thing - but I am not sure.

 

About the other problem - I think this is because of threading model conflict. Try calling

CA_InitActiveXThreadStyleForCurrentThread (0, COINIT_APARTMENTTHREADED);

as the first call in main() before any calls to DS_Open or LoadPanel.

Message 4 of 4
(4,331 Views)