WindowsProcessMBS CreateProcessWithLogonW

  1. 7 months ago

    I posted this on the NUG list but might get more response here.

    I am trying to launch an application from within a Xojo app using WindowsProcessMBS (code below). It is important that I use this function as it calls the Windows CreateProcessWithLogonW and I need to authenticate as this is being developed as a Windows service.
    In testing with a console app all works well if I don’t try to authenticate, but when I include credentials, the LastErrorMessage returns "The parameter is incorrect".
    I have reviewed the Microsoft documentation for CreateProcessWithLogonW:

    and tried leaving the domain null and passing the username in UPN format (user@domain). I have also tried entering the domain and username separately. I still get the parameter error.
    Has anyone successfully used this function and any sample code to share?

    dim w as new WindowsProcessMBS
    dim a as Integer
    dim AppPathStr, AppName as string


    w.ApplicationName = AppPathStr + "\" + AppName

    if not then
    print "Launch Error: "+w.LastErrorMessage
    end if

or Sign Up to reply!