Peter -
 
Although I agree with the earlier comment regarding DDE, I occasionally use the 
following method:

It's a workspace, which starts a mapbasic program and then  "feeds" the program 
with arguments. I use it to "start MapInfo with a MapBasic program and 
command-line parameters" from a windows shortcut (pointing to the workspace) or 
from a batch file.

The workspace can also be created on-the-fly from an external or another 
MapBasic program.  The same program can execute the workspace afterwards.
 

Workspace (simple.wor)
++++++++++++++++++++

!Workspace
!Version 600
!Charset WindowsLatin1

Run application "simple.mbx"
dim n as integer
n = DDEInitiate("MapInfo","simple.mbx")
DDEExecute  n, "1. argument" 
DDEExecute  n, "2. argument" 
undim n
++++++++++++++++++++


Program (simple.mb)
++++++++++++++++++++

include "mapbasic.def"

Declare Sub Main ()
Declare Sub RemoteMsgHandler () 

Sub Main ()
' Do nothing here..
End Sub

Sub RemoteMsgHandler
  Dim sArg as string
  sArg = CommandInfo(CMD_INFO_MSG)

' Do something with the argument here..
  print sArg

' if MapInfo must be stopped 
' after processing the argument 
' then uncomment the next line
'  End MapInfo

End Sub 

Regards 
Bo Thomsen
GeoConsult I/S


-----Oprindelig meddelelse-----
Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne af Peter Zyczynski
Sendt: 10. januar 2006 05:12
Til: 'MapInfo-L'
Emne: [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
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to