Wednesday, 15 July 2015

c - Win32 - A better way to intercept a window before it is created -



c - Win32 - A better way to intercept a window before it is created -

i trying automate external windows application. goal create application start minimized without showing active window/splash screens , without stealing focus other applications.

i wrote little programme on c calls enumwindows() in loop , uses showwindow() minimize required window. quite fast , works in 80% of cases. unfortunately, application window still showing , stealing focus short period of time.

what improve (sure) way intercept window? using setwindowshookex hooks alternative?

have tried using wshowwindow fellow member of startupinfo structure pass createprocess() when starting application? designed things this.

if dwflags specifies startf_useshowwindow, fellow member can of values can specified in ncmdshow parameter showwindow function, except sw_showdefault. otherwise, fellow member ignored.

for gui processes, first time showwindow called, ncmdshow parameter ignored wshowwindow specifies default value. in subsequent calls showwindow, wshowwindow fellow member used if ncmdshow parameter of showwindow set sw_showdefault.

for example:

startupinfo si = { sizeof(si) } si.dwflags = startf_useshowwindow; si.wshowwindow = sw_minimize; createprocess(..., &si, ...);

c windows winapi

No comments:

Post a Comment