dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: CreateProcessAsUser() not showing CreateWindow of running Process [C#]

  1. #1
    Join Date
    Feb 2005
    Posts
    24

    Question CreateProcessAsUser() not showing CreateWindow of running Process [C#]

    My system has 2 accounts (USER and ADMIN) and a service (Service.exe) running under LocalSystem.
    The user logs into the USER account, the LocalService can then launch a process (CreateProcessAsUser(...)) as the ADMIN user.

    The process the Service runs (Tool.exe) is a legacy C++ application that performs a job and also displays information to the user by using CreateWindow(...), but when launching it by the Service the Window does not show...

    When the process is created by the Service I first load the Profile & Environment of the ADMIN user so that the correct context is used ...
    (was still hoping the Window would display to USER)


    Now, initialy I thought this would cause a problem as ADMIN is running the process so why would the CreateWindow(...) output in the USER desktop, so I tried with a simple command-line test.exe app and when launched as ADMIN the Command Prompt window appeared - so why does that work fine where-as the CreateWindow(...) doesn't display correctly?

    Any clues on how I can get the STATUS (using CreateWindow in Tool.exe) running under ADMIN to show in the USER logged-on session?

    Can I use the ENVIRONMENT somehow, I tried the following thinking it might work but didn't:
    Code:
        startInfo.lpDesktop = @"WinSta0\Default";
        startInfo.dwFlags = STARTF_USESHOWWINDOW;
        startInfo.wShowWindow = SW_SHOW;
    The Window is created as follows (in Tool.exe):
    Code:
        HWND hwnd = CreateWindow
        (
            "Tool", 
            "Tool WINDOW",
            WS_POPUP | WS_VISIBLE,
            0,0,uWidth,uHeight,
            NULL, 
            NULL, 
            hInstance, 
            Text
        );
    Is the lpDesktop wrong (not exactly sure how this works)?


    I know how crazy this sounds - I just would rather not have to launch another ToolDisplay.exe as USER which communicates with Tool.exe as ADMIN as a display when the Tool.exe used to handle everything on its own - so checking to see if there isn't some nice way to handle this...

    Any help would be much appreciated...
    Thanks,

  2. #2
    Join Date
    Feb 2005
    Posts
    24

    Question

    Simplified Question:
    My system has 2 accounts (USER and ADMIN), the user is always logged on as USER but at some specific times a process (Tool.exe) is launched under the ADMIN account (by a LocalSystem Service using CreateProcessAsUser(...)), almost everything works fine except for the fact that the process (Tool.exe) is supposed to display status to the user using CreateWindow(...).

    When Tool.exe is running (as ADMIN) and the user is logged-on as USER the window is not shown (obviously)...
    Is there a way to show the window of Tool.exe running under ADMIN to the user logged-on as USER?

    Any help would be much appreciated...
    Thanks,

Similar Threads

  1. Replies: 1
    Last Post: 09-16-2009, 10:31 AM
  2. Replies: 1
    Last Post: 08-19-2006, 04:15 PM
  3. reading the list of process running
    By MLSrinivas in forum VB Classic
    Replies: 1
    Last Post: 06-23-2005, 02:31 AM
  4. Programmatically killing a running process
    By Phani in forum VB Classic
    Replies: 10
    Last Post: 12-21-2001, 04:52 PM
  5. Programmatically killing a running process
    By Phani in forum VB Classic
    Replies: 0
    Last Post: 12-17-2001, 03:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center