Dynamics SL Object Model Command Line Args

After searching the documentation and internet in vain for anything helpful on this topic, I created two SL SDK applications and used StartAppAndAutomate() to launch the second app from a button on the first. Here’s what I found.

It works! I created two labels on the second form to show the command line arguments passed by the first. I called ApplGetParms() twice on the second form to get each of them. That emulates what a standard SL SDK app would do to retrieve them. The second exe was named “STOBJ01”.

Here’s the code. The first line was at the form level. The rest was in the button handler.

Private WithEvents _sivApp As SIVApplication

Dim parmStr As String = PRMSEP & “2000” & PRMSEP & “Second_Param”
Dim sivErr As Integer
Dim osErr As Long
_sivApp = StartAppAndAutomate(exePath & “STOBJ01.exe ” & parmStr, sivErr, osErr)

Note the space after “.exe” within StartAppAndAutomate. It didn’t work without that. Using the constant PRMSEP here is optional with just one argument, but is required with multiple args.

Leave a Reply