Peter, You can get the Windows hwnd handle for the MapInfo application window by using the MB 'WindowInfo' function. You can then pass this to the windows API 'SetWindowPos' function to make sure it stays on top - the same function will also allow you to switch the 'always on top' behaviour off again. You could call this API from your MB or your Delphi code (in the latter case you would need to pass the MI HWND to your Delphi app first). If you have access to the web, a search on 'SetWindowPos AND Delphi' should give you what you need to do it from your Delphi app. I found a good example at http://www.undu.com/helpmakers/tips_res/711/000045.html Let me know if you don't have web access. Richard Burkmar. -----Original Message----- From: Peter Zyczynski [mailto:[EMAIL PROTECTED]] Sent: 06 March 2001 06:04 To: [EMAIL PROTECTED] Subject: MI-L DELPHI: Forcing MI to be the front window from an EXE 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. _______________________________________________________________________ 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.