[GRASS-dev] db_start_driver without window

When a driver is started from QGIS on Windows using db_start_driver ->
G_spawn_ex -> do_spawn -> win_spawn > CreateProcess, it opens black
window.

Is there a possibility to prevent opening that window by setting some
global Windows param before db_start_driver is called? If not, would
it be possible to prevent it by giving
CREATE_NO_WINDOW (or something like that) as dwCreationFlags to
CreateProcess in win_spawn?

Radim

On Wed, Oct 14, 2015 at 7:39 PM, Radim Blazek <radim.blazek@gmail.com> wrote:

When a driver is started from QGIS on Windows using db_start_driver ->
G_spawn_ex -> do_spawn -> win_spawn > CreateProcess, it opens black
window.

Is there a possibility to prevent opening that window by setting some
global Windows param before db_start_driver is called? If not, would
it be possible to prevent it by giving
CREATE_NO_WINDOW (or something like that) as dwCreationFlags to
CreateProcess in win_spawn?

At time I see the 0 hardcoded in the function all in
lib/gis/spawn.c

static int win_spawn(const char *cmd, const char **argv, const char **envp,
    const char *cwd, HANDLE handles[3], int background,
    int shell)
[...]
result = CreateProcess(
  program, /* lpApplicationName */
  args, /* lpCommandLine */
  NULL, /* lpProcessAttributes */
  NULL, /* lpThreadAttributes */
  1, /* bInheritHandles */
  0, /* dwCreationFlags */
  env, /* lpEnvironment */
  cwd, /* lpCurrentDirectory */
  &si, /* lpStartupInfo */
  &pi /* lpProcessInformation */
);

@devs: related documentation:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
--> therein page ref with the of "Process Creation Flags"
    --> CREATE_NO_WINDOW

Did you try and this works then?

Markus

On Thu, Oct 15, 2015 at 9:00 AM, Markus Neteler <neteler@osgeo.org> wrote:

On Wed, Oct 14, 2015 at 7:39 PM, Radim Blazek <radim.blazek@gmail.com> wrote:

When a driver is started from QGIS on Windows using db_start_driver ->
G_spawn_ex -> do_spawn -> win_spawn > CreateProcess, it opens black
window.

Is there a possibility to prevent opening that window by setting some
global Windows param before db_start_driver is called? If not, would
it be possible to prevent it by giving
CREATE_NO_WINDOW (or something like that) as dwCreationFlags to
CreateProcess in win_spawn?

At time I see the 0 hardcoded in the function all in
lib/gis/spawn.c

static int win_spawn(const char *cmd, const char **argv, const char **envp,
    const char *cwd, HANDLE handles[3], int background,
    int shell)
[...]
result = CreateProcess(
  program, /* lpApplicationName */
  args, /* lpCommandLine */
  NULL, /* lpProcessAttributes */
  NULL, /* lpThreadAttributes */
  1, /* bInheritHandles */
  0, /* dwCreationFlags */
  env, /* lpEnvironment */
  cwd, /* lpCurrentDirectory */
  &si, /* lpStartupInfo */
  &pi /* lpProcessInformation */
);

@devs: related documentation:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
--> therein page ref with the of "Process Creation Flags"
    --> CREATE_NO_WINDOW

Did you try and this works then?

Not yet, I was not able to compile GRASS, it cannot find various
dependencies (zlib, regex, proj...) even if dev packages are
installed. I'll try again and post the problems.

Radim