Search code examples
autocadautocad-pluginautolispobjectarx

How to run application with elevated permissions in AutoLISP or ObjectARX


I need to run the application which requires elevated permissions in AutoCAD/ZWCAD.

By LISP I can run the application using:

(startapp "C:\\[path]\\Application.exe")

But for application requiring elevater permisions startapp returns nil and application not runs.

Tried also:

(setq Shell (vlax-get-or-create-object "Wscript.Shell"))
(setq updater(vlax-invoke-method Shell 'Exec (strcat path "Appname.exe" ) ) )
(vlax-release-object Shell)

but I got:

*error*: Automation error : WshShell.Exec : The requested operation requires elevation.

So is any other way to run external application requiring elevated permisions?


Solution

  • I found that it can be done in both, LISP and C++ ObjectARX so:

    LISP:

    (startapp "C:\\[path]\\run.bat")
    

    and in the run.bat

    CALL "C:\[path]\Application.exe"
    

    works OK on my site

    ObjectARX C++

    CString AppPath = _T("C:\\[path]\\");
    CString App = AppPath + _T("Application.exe");
    HINSTANCE aplication = ShellExecute(0, _T("open") , App , NULL , AppPath , SW_SHOWNORMAL);