I don't really know much about C++, but in VB you can connect to a current
instance of MapInfo by using the 'Getobject' instead of the 'Createobject'
command.

e.g.

Set mapinfo = GetObject(, "MapInfo.Application")

mapinfo.do "Open Table ""Q:\file1\mapping2.TAB"" Interactive
mapinfo.do "Map From m_ml1_dcb_dur"

David

> -----Original Message-----
> From: Kenn Garroch [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 9:48 AM
> To:   [EMAIL PROTECTED]
> Subject:      RE: MI-L calling mapbasic from C++
> 
> I should say at the outset that I am not an expert on C++. All of my
> Mapinfo COM experience is from Visual FoxPro.
> 
> However, you should be able to use something like
> createobject("Mapinfo.Application") to start Mapinfo as a COM object
> (depends on your flavour of C++ i.e. createobject returns the object. You
> can then use this object to execute MapBasic commands with DO 
> 
> e.g. if your object is called mm then mm.do('Print "Hi"') will execute
> Mapbasic's print command. mm.visible=true will bring up the Mapinfo
> application window. The problem I have found with all this is that
> createobject always starts a new instance of the application. It would be
> really useful to simply connect to the current instance - so I'm unable to
> help with the second part of your question.
> 
> Regards
> 
> Kenn
> 
> > -----Original Message-----
> > From: Martin Tyberg [mailto:[EMAIL PROTECTED]]
> > Sent: 20 September 2002 18:49
> > To: [EMAIL PROTECTED]
> > Subject: MI-L calling mapbasic from C++
> > 
> > 
> > 
> > Hi,
> > 
> > Is it possible to call a MapBasic program function from 
> > within a DLL. The
> > setup is the following. I have a DLL that exports a function that is
> > called by a MapBasic function. The DLL invokes a dialog that receives
> > input from the user. Based on the input, I would like to call 
> > a MapBasic
> > function in my MapBasic program to update the mapinfo view. Is there
> > some way to achieve this?
> > 
> > Also, is there some way to obtain the current instance of 
> > MapInfo and pass
> > that instance to a DLL from MapBasic so that a DLL can be a client to
> > MapInfo during the execution of the DLL function call?
> > 
> > Thanks.
> > 
> > Martin
> > 
> > 
> > ---------------------------------------------------------------------
> > List hosting provided by Directions Magazine | www.directionsmag.com |
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: 
> > [EMAIL PROTECTED]
> > Message number: 3175
> > 

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 3197

Reply via email to