I think I was a bit premature in announcing my success.
I'm still having problems accessing the actual MBX variable.

Can any of you Delphi OLE gurus tell me why the following line generates an
exception:

     showMessage( oMBX.MBGlobals('gsMyGlobalVar').Value );


------------------------------------------------------------------
var
   oMI, oMBX : Variant;
   i, iMBXcount : smallint;

begin
   try
      oMI := getActiveOLEobject('MapInfo.Application');

      //-----------------
      try
          iMBXCount := oMI.MBApplications.Count;

          for i := 1 to iMBXcount do begin
              oMBX := oMI.MBApplications.Item(i);
              if UpperCase(oMBX.Name) = 'MYAPP.MBX' then begin
                  showMessage( 'MYAPP is running!' );
                  showMessage( oMBX.MBGlobals('gsMyGlobalVar').Value );
              end;
          end;

      except
        showMessage('Extracting variable value failed!');
      end;
      //-----------------

        except
        showMessage('MapInfo is presently not running');
   end;

end;
------------------------------------------------------------------



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Peter Zyczynski
Sent: Friday, 6 July 2001 1:34 PM
To: [EMAIL PROTECTED]
Subject: RE: MI-L MB / Delphi / OLE - Seeing MBX variables from within
Delphi

Never mind, I worked it out.
Here's a snippet if anyone's interested:

-------------------------------------------------------------
var
   oMI, oMBX : Variant;
   sMBXrunning : string;
   i, iMBXcount : smallint;

begin
   try
      //Attempt to connect to an existing iMapPRO session.
      oMI := getActiveOLEobject('MapInfo.Application');
      iMBXCount := oMI.MBApplications.Count;

      for i := 1 to iMBXcount do begin
         oMBX := oMI.MBApplications.Item(i);
         sMBXrunning := oMBX.Name;
         showMessage('MBX(' + intToStr(i) + ') = ' + sMBXrunning);
      end;

   except
        ShowMessage('MapInfo not running');
   End; //try

End;
-------------------------------------------------------------


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Peter Zyczynski
Sent: Friday, 6 July 2001 12:18 PM
To: [EMAIL PROTECTED]
Subject: MI-L MB / Delphi / OLE - Seeing MBX variables from within Delphi

Greetings List,

I'm trying to examine MBX variables from within Delphi.

In the MIL archives there's a few examples on how to do this in VisBasic,
however I'm having problems converting the syntax to work in Delphi.

If anyone could help that would be great!

Here's what I got so far (not much):
------------------------------------------------------
Var
   oMI, oMBX : variant;

Begin
   oMI := getActiveOLEobject('MapInfo.Application');
   oMBX := oMI.MBApplications;

   //Now I need to check for the presence of and
   //somehow connect to "MyApp.MBX"

   //And then I would like to see variable "TheMBXvariable"
end;
------------------------------------------------------

Also if anyone knows of any reference material that explains methods and
properties encapsulated in the "MBApplications" object (with a Delphi
flavour) I would be happy to hear from you too.

Thanks,

Peter Zyczynski
Analyst Programmer
Landfile Consultancy
Australia
Ph: (03) 6244-7344
email: [EMAIL PROTECTED]




_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.



_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.



_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to