Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Hide Window by CreateProcess WinApi
QtWS25 Last Chance

Hide Window by CreateProcess WinApi

Scheduled Pinned Locked Moved Unsolved General and Desktop
winapihide windowcreateprocess
1 Posts 1 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TomNow99
    wrote on 3 Jun 2020, 13:10 last edited by TomNow99 6 Mar 2020, 16:36
    #1

    Hello,

    I would like to hide qemu application and create application something like fsproxy. I find very interesting function WinApi "CreateProcess" and structure "STARTUPINFO". So i Wrote:

    wchar_t qemu_args[2048] = L"\"C:\\Users\Tom\\Desktop\\apps\\qemu.exe (here args)\"";
    wchar_t path[256]= L"C:\\Users\\Tom\\Desktop\\apps\\";
    
    STARTUPINFO si;
    memset(&si, 0, sizeof(STARTUPINFO));
    GetStartupInfo(&si);
    si.dwFlags	   = STARTF_USESHOWWINDOW;
    si.wShowWindow = SW_HIDE;
    
    CreateProcess(NULL, qemu_args, NULL, NULL, FALSE, 0, NULL, path, &si, &xa);
    

    When I set si (dwFlags and wShowWindow) I get 2 windows: myQTApplication ( xyz.exe ) and qemu
    When I don't set si I get 3 windows: myQTApplication ( xyz.exe ), qemu and consoleWindow (its name is pathToBuildXYZexe)

    So si structure only hide that ConsoleWindow ( pathToBuildXYZexe ).

    I know that I can get hmnd to qemu window by name and hide window, but I would like to do that when process is created.

    And my second question is: Why I can't set the 8-th parameter ( path ) to NULL. When I give here NULL, QEMU don't start. I have to give path to qemu folder.

    EDIT:
    Now I wrote very basic console application in QT abc.exe:

    #include <QCoreApplication>
    #include <QDebug>
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
        qDebug()<<"1";
        return a.exec();
    }
    

    When I execute abc.exe from xyz.exe ( myMainQTGUIApplication ) by CreateProcess and when si is set I get 2 windows: xyz.exe and consoleWindow (its name is pathToBuildXYZexe) with text "1" ( this is output from abc.exe).
    When I execute abc.exe from xyz.exe ( myMainQTGUIApplication ) by CreateProcess and when si isn't set I get 2 windows: xyz.exe and consoleWindow (its name is pathToBuildXYZexe) with notext.

    EDIT2
    Back to qemu. When I don't set si there are 3 windows. But when I close qemu, the window with name pathToBuildXYZexe is closed too. When I close pathToBuildXYZexe, qemu is closed too. In manager I see 2 processess: qemu and xyz.exe.

    EDIT3
    I think qemu is not hidden beacuse it's blocking terminal Application. But I think there is another solution...

    1 Reply Last reply
    0

    1/1

    3 Jun 2020, 13:10

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved