VB6-CreateProcessWithLogonW在Windows 10上不工作-错误代码740

VB6-CreateProcessWithLogonW在Windows 10上不工作-错误代码740,vb6,windows-10,advapi32,createprocesswithlogonw,Vb6,Windows 10,Advapi32,Createprocesswithlogonw,我需要维护一个旧的VB6应用程序 在应用程序功能中,调用CreateProcessWithLogonW,在Windows 10上运行时不起作用(但在Windows 7上运行正常) 我通过调用Err.LastDllError收到的错误代码是错误代码740,我认为与“请求的操作需要提升。”UAC在我运行此操作的Win 10机器上被禁用,因此我不确定这是什么问题 有没有人有这方面的经验??非常感谢您的帮助 真正让我困惑的是,它在Win7上运行时一点问题都没有 代码示例如下: 以下是函数声明: Priv

我需要维护一个旧的VB6应用程序

在应用程序功能中,调用CreateProcessWithLogonW,在Windows 10上运行时不起作用(但在Windows 7上运行正常)

我通过调用
Err.LastDllError
收到的错误代码是错误代码740,我认为与“请求的操作需要提升。”UAC在我运行此操作的Win 10机器上被禁用,因此我不确定这是什么问题

有没有人有这方面的经验??非常感谢您的帮助

真正让我困惑的是,它在Win7上运行时一点问题都没有

代码示例如下:

以下是函数声明:

Private Declare Function CreateProcessWithLogon Lib "Advapi32" Alias "CreateProcessWithLogonW" ( _
    ByVal UserName As Long, _
    ByVal domain As Long, _
    ByVal Password As Long, _
    ByVal dwLogonFlags As Long, _
    ByVal ApplicationName As Long, _
    ByVal strCommandLine As Long, _
    ByVal dwCreationFlags As Long, _
    ByVal lpEnvironment As Long, _
    ByVal strCurrentDirectory As Long, _
    ByRef lpStartupInfo As STARTUPINFO, _
    ByRef lppiProcessInfo As PROCESS_INFORMATION) As Long
下面是函数调用

CreateProcessWithLogon(StrPtr(UserName), StrPtr(domain), StrPtr(Password), _
                                LOGON_WITH_PROFILE, StrPtr(ApplicationName), StrPtr(strCommandLine), _
                                CREATE_DEFAULT_ERROR_MODE Or CREATE_NEW_CONSOLE Or CREATE_NEW_PROCESS_GROUP, _
                                ByVal 0&, StrPtr(strCurrentDirectory), suiStartUpInfo, piProcessInfo)

你检查过这个了吗?是的,我认为你说的UAC没有完全瘫痪是对的。即使警报滑块一直向下,我认为UAC仍可能受到流程启动的影响。我已经实现了一个C#work-around,可能已经足够了。谢谢你的帮助@P_Fitz你的C#变通方法是什么?@nessa我在这篇博文之后启动了一个提升的commad提示符,以调用一个批处理文件,该文件是我所需要做的工作。希望这有帮助!