Starting external application from RTC (again)

ccbryan63ccbryan63 Member Posts: 115
edited 2011-04-29 in NAV Three Tier
Hi... I have a pretty simple question. This
CREATE(wShExec);
ReturnCode := wShExec.Run('C:\FindItemsExec\FindItems.exe');
CLEAR(wShExec);

works fine in 2009 Classic. The main window of my FindItems application appears and all is right with the world. However it does not work in the RTC. wShExec is an Automation variable subtype shell.

In this case the file server, application server and client are all the same machine. Interestingly, if I watch the Task Manager, the RTC does start up a FindItems.exe process, but not an application. The Classic client starts both a process and an application.

This code is within its own codeunit that I am 'running' directly in the Classic client; in the RTC I have a menu item calling the codeunit.

So what am I missing?

Comments

  • kinekine Member Posts: 12,562
    edited 2011-04-29
    Once again: the automation is created on the server - thus you cannot run the app there... ;-)

    You need to create the automation as Client-side... CREATE(wShExec, false, TRUE);

    Edited: I forgot the second param... :-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • henrikmhenrikm Member, Microsoft Employee Posts: 66
    Yes, you need to specify that the com object should run on the server, as kine says this is done in the CREATE call. I currently use this approach:

    CREATE(myCom, false, true);

    where the third parameter means that it should run on the client.
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Henrik Metzger, Software Development Engineer, Dynamics NAV
    MSFT
  • IsakssonMiIsakssonMi Member Posts: 77
    If you are running NAV2009 R2, use .NET interop and take a look at the Process class. It has a static method named Start that can easily be used.
  • henrikmhenrikm Member, Microsoft Employee Posts: 66
    Small note on DotNet objects:
    For the DotNet interop there is a property (Shift+F4) on the variable definition where it needs to be set that it is a client side dot net object. The default here is also server side.
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Henrik Metzger, Software Development Engineer, Dynamics NAV
    MSFT
  • ccbryan63ccbryan63 Member Posts: 115
    Thank you!! (again!)
Sign In or Register to comment.