Hi List,

I have a Delphi4 EXE which consists of a form and a button - sounds great
doesn't it!  :-)

When I press the button for the first time, MI starts up and an MBX is
executed.  On subsequent button presses the MBX runs in the already open MI
window.

NOW - how do I force MI to be the front window on subsequent activations?

I tried this statement within the actual MBX but to no avail:
Set Window WIN_MAPINFO Front

Is there code I can add to the actual Delphi EXE that can force MI to be the
front window?  Or is there another way to do it within the MBX.

Here's my Delphi code:


============================================================================
procedure TForm1.btnRunMBXClick(Sender: TObject);
var
   oMI : variant;

const
   MYMBX = 'C:\MyApps\MYapp.MBX';
   MI_POPROGRAM = 'C:\Program Files\MapInfo\Professional\MapInfoW.exe';

begin

   try
      // Try to connect to an existing MI session.
      oMI := getActiveOLEobject('MapInfo.Application');
      //
      // What code do I stick here to force the MI window
      // to become the front active window? ie. I don't want
      // this form as the front window.
      //
      oMI.Do ('run application "' + MYMBX + '"');
   except
      // Start a new session of MI.
      showMessage('Starting MI for the first time');
      WinExec(PChar(MI_POPROGRAM + ' ' + MYMBX), 1);
   end;

end;
============================================================================


Any ideas would be greatly appreciated.
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.

Reply via email to