我的WINDOWS服务程序用WEXEC()或SHELLEXECUTE()调用一个EXE怎么看不到EXE的界面?我要怎么做?

解决方案 »

  1.   

    BOOL ShowWindow(
      HWND hWnd,     // handle to window
      int nCmdShow   // show state            //SW_HIDE
    );
      

  2.   

    用ShellExecute应该可以的呀,除非你这个exe执行时本来就没有界面:(
    你把你的代码贴出来看看吧!
      

  3.   

    呵呵,看错了,你那个EXE原来有界面的吗。
      

  4.   

    在服务里面调用用SHOWWINDOW()不行的!好象服务程序调用后被调用的程序没有在用户桌面运行,在任务管理器中是可以看到的!
      

  5.   

    HINSTANCE ShellExecute(          HWND hwnd,
        LPCTSTR lpOperation,
        LPCTSTR lpFile,
        LPCTSTR lpParameters,
        LPCTSTR lpDirectory,
        INT nShowCmd
    );
    你看看,是不是你的nShowCmd参数没有设置正确?一般设置成SW_SHOWNORMALnShowCmd
    [in] Flags that specify how an application is to be displayed when it is opened. If lpFile specifies a document file, the flag is simply passed to the associated application. It is up to the application to decide how to handle it.
    SW_HIDE
    Hides the window and activates another window.
    SW_MAXIMIZE
    Maximizes the specified window.
    SW_MINIMIZE
    Minimizes the specified window and activates the next top-level window in the z-order.
    SW_RESTORE
    Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window.
    SW_SHOW
    Activates the window and displays it in its current size and position.
    SW_SHOWDEFAULT
    Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application. An application should call ShowWindow with this flag to set the initial show state of its main window.
    SW_SHOWMAXIMIZED
    Activates the window and displays it as a maximized window.
    SW_SHOWMINIMIZED
    Activates the window and displays it as a minimized window.
    SW_SHOWMINNOACTIVE
    Displays the window as a minimized window. The active window remains active.
    SW_SHOWNA
    Displays the window in its current state. The active window remains active.
    SW_SHOWNOACTIVATE
    Displays a window in its most recent size and position. The active window remains active.
    SW_SHOWNORMAL
    Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
      

  6.   

    服务程序所在桌面和用户登录所在桌面不同
    你可能要用IPC在进程之间交互