Thanks to all who responded - greatly appreciated!

The common consensus is to write an intermediate EXE to catch the
parameters, and then get the EXE to launch MI Pro and run the MBX.  

>From there, the EXE can do one of two things (actually three if you include
my idea in my original email):

1. DDE
--------
Pass the parameters through a DDE conversation with the MBX, catching them
with the RemoteMsgHandler at the MBX end.  This was the preffered method by
a majority of the replies.  I heasitated with this until I realized how
simple it is write DDE functionality into a Delphi EXE (see reply bellow).

2. OLE
--------
Poking the paramter values directly to global MBX variables through OLE
automation.


Haven't tried these ideas yet:


----------------------------
1.  DDE - by Jakob Lanstorp
----------------------------

I call a Delphi exe and DDE the strings to MapBasic RemoteMessageHandler. 

----- IN DELPHI:
{ DDE-communication }
procedure TMapDDE.SendMapInfoMsg(note:string);
var dde_conv:TDDEClientConv;
    arr:array[0..511] of Char;
begin
   dde_conv:=TDDEClientConv.Create(Application);
   try
     if FileExists(_mbxFile) then begin
       StrPCopy(arr,note);
       dde_conv.SetLink('MapInfo',_mbxFile);
       dde_conv.ExecuteMacro(arr,True);
       dde_conv.CloseLink;
     end;
   finally
     dde_conv.Destroy;
   end;
end;


----- IN MAPBASIC:
Sub RemoteMsgHandler
        Dim sDelphi As String

        sDelphi = CommandInfo(CMD_INFO_MSG)
        Print "sDelphi: " + sDelphi
end sub


----------------------------
2.  OLE - by Lars Nielsen
----------------------------

Use the (limited) object model in MapInfo Pro to access the mbx (in VB:
Application.MBApplication("myapp.mbx") ), and either poke the values to
Global variables in the mbx (in VB:
Application.MBApplication("myapp.mbx").Globals("myvar") ), or use the
MBApplication's Do method to transfer the values one by one, receiving them
with the RemoteMghHandler in the mbx.

No need to use DDE, although it's perfectly easy to use as well.

----------------------------


Thanks again!

Cheers,
Peter Zyczynski


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Peter
Zyczynski
Sent: Tuesday, 10 January 2006 3:12 PM
To: 'MapInfo-L'
Subject: [MI-L] Passing parameters to an MBX

Hi All,

Is it possible to pass parameters to an MBX?

I have to integrate my MBX with a third party application.  The third party
application will launch my MBX passing an ID number to it, my MBX then
assembles a dataset based on this ID number and performs operations on it.

If this can't be done, then any ideas?  

I could write a small EXE in Delphi which could be called by the third party
app, the EXE could write the parameters to a text file and launch the MBX.
The MBX could then read that text file........ is there an easier way
without having to write middleware?

Cheers,
Peter




_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to