03-16-2014 03:22 PM
I am working on embedding google earth in my program using ActiveX. Basic functionality has been fairly easy to achieve so far using the code from this post.
However, I am running into an issue with having the ActiveX container embedded in a tab control. If the tab with the container is enabled at the start of the code, everything works fine. If I start the code on a different tab, Google Earth does not get embedded in the VI.
To reproduce this issue, simple run the code linked to above but start on the debug tab. After everything has initialized, you should see that the ActiveX container on the other tab has not been populated.
One possible solution is to always start the code on the tab with the container, but I would prefer finding a better solution.
03-17-2014 05:46 PM
Hi Martian,
Would setting the cursor and simulating a mouse click accomplish the desire functionality?
Community: Using LabVIEW to Pragmatically Set Cursor Position
https://decibel.ni.com/content/docs/DOC-2186
03-17-2014 05:57 PM
Hi wfernand,
I'm not sure which issue you're suggesting the mouse click would solve. Clicking on the tab? Changing tabs is fairly easy to do programatically, but I'd prefer to not have to change tabs to make the ActiveX container visible.
03-18-2014 11:36 AM
Martian101,
You can use a property node and choose the value property to have the VI change to the main tab every time you run the program. I put that in a sequence structure with a wait ms function of 200 ms (which in my case was enough for the program to get Google earth embedded) and then placed another property node to change the value back to the debug data tab. This works for me. I hope it will help you.
03-18-2014 11:46 AM
Interesting solution. I'm going to keep hunting around to see if I can find a method that doesn't involve switching tabs (which still seems like a bit of a workaround), but might end up needing to just switch to that tab very briefly at the start.
The best way forward I can think of is trying to get the windows handle for a particular tab. I've tried to figure out if that is possible with no luck so far.
03-18-2014 12:12 PM
Martian101,
With this solution you can barely see any tabs changing. However, I understand your concern, if I find a better solution I will post it in here. Thank you.
03-18-2014 12:15 PM
wfernand,
The biggest issue with physically switching tabs isn't being able to see it happening. It is the fact that based on my code structure, there isn't actually a main tab, so I'd just be switching to a random tab. What I might to do until I find a better solution is to record the active tab when the program starts, switch to the map tab, then switch back to that initial tab.
03-18-2014 12:21 PM
If you do the tab switching while a splash screen is being displayed no one will even know it happened.
03-22-2014 10:31 PM
Kelly,
I've actually figure out a bit more of an elegant solution based on what I talked about before. The ActiveX object has an HWND property. Instead of finding the HWND of the application, I can pass the ActiveX HWND and access it even when on a different tab.
I've attached the modified code that does this (along with some other small changes).