c++ - running a gui program in the background -
i created windows service run program. want run program has gui in background don't want gui visible. code used service
but can't edit gui program
is there way set gui hidden or set visible = false service program?
the service windows service created in c++ using visual studios
i used createprocess start exe file here's code i'm using run program service:
path = "c:\mydirectory\myfile.exe"; startupinfo info={sizeof(info)}; process_information processinfo; if (createprocess(path, cmd, null, null, true, 0, null, null, &info, &processinfo)) { ::waitforsingleobject(processinfo.hprocess, infinite); closehandle(processinfo.hprocess); closehandle(processinfo.hthread); }
is possible hide gui without editing program itself?
the closest setting wshowwindow
member of startupinfo structure. work if application honors ncmdshow
parameter in winmain
.
startupinfo info = {0}; info.dwflags = startf_useshowwindow; info.wshowwindow = sw_hide; if (createprocess(path, cmd, null, null, true, 0, null, null, &info, &processinfo)) { //... }
Comments
Post a Comment