一个监控程序,以system身份运行在系统中,
这个程序怎么样才能发送一个msgbox给当前登陆的用户的(也就是在当前本地登陆的用户屏幕出现
一个msgbox)
谢谢

解决方案 »

  1.   

    以当前用户身份运行一个程序
    然后再用这个程序发送msgbox
      

  2.   

    '以下函数用指定用户名和密码调用应用程序
    Private Function AnShell(Username As String, Domain As String, Password As String, ApplicationName As String) As Long
    Dim lpUsername As String, lpDomain As String, lpPassword As String, lpApplicationName As String, lpCommandLine As String, lpCurrentDirectory As String
    Dim StartInfo As STARTUPINFO, ProcessInfo As PROCESS_INFORMATION
    lpUsername = Username
    lpDomain = Domain
    lpPassword = Password
    lpApplicationName = ApplicationName
    lpCommandLine = vbNullString
    lpCurrentDirectory = vbNullString
    StartInfo.cb = LenB(StartInfo)
    StartInfo.dwFlags = 0&
    CreateProcessWithLogon StrPtr(lpUsername), StrPtr(lpDomain), StrPtr(lpPassword), LOGON_WITH_PROFILE, StrPtr(lpApplicationName), StrPtr(lpCommandLine), CREATE_DEFAULT_ERROR_MODE Or CREATE_NEW_CONSOLE Or CREATE_NEW_PROCESS_GROUP, ByVal 0&, StrPtr(lpCurrentDirectory), StartInfo, ProcessInfoCloseHandle ProcessInfo.hThread
    CloseHandle ProcessInfo.hProcess
    AnShell = ProcessInfo.dwProcessId
    End Function'mAdmin用户运行一个程序,这里是记事本,参数1为用户名,参数2为域(一般为空就可以了,因为是本机),参数3是密码,参数4为要运行的程序路径和名字
    AnShell "mAdmin", "", "mAdmin@", "notepad.exe"