OLE question (OpenInsight 32-Bit)
At 24 MAY 2005 05:48:05PM Todd Hames wrote:
Using OLE in OI 7.1 does anyone know how to access properties that are within a property. For example, using Microsoft MapPoint and the VB example (listed below) Microsoft gives, how would I access the Name property of the ActiveMap property using OI?
Thanks for any help!
Dim objApp As New MapPoint.ApplicationMsgBox "Map name: " + objApp.ActiveMap.Name
At 24 MAY 2005 06:07PM [email protected]'s Kevin Fournier wrote:
As long as it's a property within a property, you should be able to do this with Set_Property/Get_Property. For your example, you'd write:
MapName=Get_Property(CtrlEntId, "OLE.ActiveMap.Name")
I don't know if there's a limit to how deep you can go, but I haven't had any problems yet, especially in OI. If however, the property you're looking for can only be accessed via the return value of an OLE method, then you have a problem.
At 25 MAY 2005 12:45PM Todd Hames wrote:
Thanks so much for your help! I guess I should have included in the first post that I was using OleCreateInstance and OleGetProperty functions. I've been playing around with the OLE control (MapPoint.Control) and I think it is working using Get_Property, I say that because I may not have the exact property names figured out yet. Do you know if OI Ole functions should work as well as embedding the control in an OI form? I'm really wanting to control Mappoint as a seperate app rather than embedded in an OI form.
At 25 MAY 2005 01:29PM [email protected] wrote:
As covered in the presentation there is currently a bug in using idispatches to retrieve other idispatches. The workaround is to use the windows scripting control to instantiate the required OLE control and then to control this using jScript which has no such problems.
The Sprezzatura Group Web Site
World Leaders in all things RevSoft
At 25 MAY 2005 02:18PM Todd Hames wrote:
I was trying to avoid using Windows Scripts. I have never done that before, but I have noticed a lot of info on the internet about how to setup Windows Scripts. What do you mean by "as covered in the presentation"? And just to be sure I understand, at this point, it's probably better to embed controls in OI rather than link using OLE unless I use Windows Scripts. Is that right? Thanks for the info!
At 25 MAY 2005 03:04PM [email protected] wrote:
Sorry Tod - one of the Sprezz Presentations at Vegas was on using OleCreateInstance et al to play with OLE controls from Basic+. At that presentation an explanation was given of a bug in the current implementation of OLE from Basic+ whereby taking one IDispatch pointer (the handle to a container within an OLE object to simplify) and using it to try and obtain another IDispatch pointer rather than a simple property or method call caused OI to GPF. It was suggested that until this was fixed it was easier to create a Windows Scripting Control OLEInstance and use jScript (which is ideally suited to manipulating DOMs) to implement Office Automation and the like.
The Sprezzatura Group Web Site
World Leaders in all things RevSoft
At 25 MAY 2005 06:03PM Todd Hames wrote:
I can open a map file just fine in an OLE control (MapPoint.Control) in OI using Send_Message(CtrlEntId,'OLE.OpenMap mapdata.ptm'). I'm trying to use the ZoomIn method which is in the Map object. According to MapPoint help I should be able to Send_Message(CtrlEntId,'ActiveMap.ZoomIn'). ActiveMap is a property that points to the Map object. The full path to the method would be MapPoint.Control.ActiveMap.ZoomIn. I'm begining to think OI has a problem executing ZoomIn from the Map object which the ActiveMap property points to. Do you think this is the case? It seems from the responses to this post that it is not possible to link to the MapPoint application using OLE since OleCreateInstance creates a new instance of the object.
At 25 MAY 2005 06:46PM [email protected]'s Kevin Fournier wrote:
Todd,
You may actually be able to pull this one off. Try:
ActiveMap=Get_Property(CtrlEntId, "OLE.ActiveMap") rv=OLECallMethod(ActiveMap, "ZoomIn")I know it was mentioned that OI can't get an idispatch from another idispatch, but perhaps this route will work. If not, the only immediate solution is to have someone write a DLL that can do this for you. That's what I did to acheive a similar solution prior to 7.1.
At 25 MAY 2005 07:47PM Todd Hames wrote:
It seems from this post that OI is not capable of linking to an application using OLE; like MS MapPoint. And using the embedded method OI seems to have problems. For example, embedding an OLE control in OI using MapPoint.Control, which does display a map after executing the method OpenMap. Then Send_Message(CtrlEntId,'OLE.ActiveMap.ZoomIn'). ZoomIn is a method of the Map object (member of MapPoint.Control). ActiveMap property points to the Map object. This is the correct syntax according to MapPoint programming help & examples and the object browser in Execl. If I'm understanding wrong, please set me straight … thanks for any help!
At 25 MAY 2005 08:01PM Todd Hames wrote:
Already tried this, except I used the return value of Send_Message(CtrlEntId,'OLE.OpenMap','mapdata.ptm') which returns the Map object basicly the same as what you gave me. But, just to be sure I tried your example anyway, OleStatus() returns -2147418113 which I have no idea what that error msg is. Thanks for trying.
P.S. - Sorry I posted the same basic question right next to this post, I thought the first one didn't go through.