I run an EXE program from a Windows Service but I can't see form C#? -
i run program windows service
private process runapp(string _applocation) { //create process process _ret = new process(); _ret.startinfo.filename = _applocation; //run administrator. _ret.startinfo.verb = "runas"; //window = normal _ret.startinfo.windowstyle = processwindowstyle.normal; _ret.startinfo.createnowindow = false; _ret.start(); return _ret; }
i see in task manager. working can't see window.
(if can not see can change parent , see it)i try this: create new midichildwindow project and:
[dllimport("user32.dll", setlasterror = true)] static extern intptr setparent(intptr hwndchild, intptr hwndnewparent); [dllimport("user32.dll")] static extern bool showwindow(intptr hwnd, int ncmdshow); private void getlisteners() { process[] memory = process.getprocesses(); foreach (process _prc in memory) { if (_prc.processname == "myrunnedapplication") { setparent(_prc.mainwindowhandle, this.handle); showwindow(_prc.mainwindowhandle, 1); } } }
but not work. runned application child windows service , can not change it.
how see it? (sory bad english)
Comments
Post a Comment