c# - How to get All MS Word running process by name -
i trying running ms word processes, returns 1
. how can exact number of processes? have more 1 file open.
process[] localbyname = process.getprocessesbyname("winword"); foreach (process p in localbyname) { if (!string.isnullorempty(p.mainwindowtitle)) { rect notepadrect = new rect(); intptr ptr = p.mainwindowhandle; getwindowrect(ptr, ref notepadrect); objschemedetail.top = notepadrect.top; objschemedetail.bottom = notepadrect.bottom; objschemedetail.left = notepadrect.left; objschemedetail.right = notepadrect.right; } }
the entire premise on question based wrong. believe each word top level window associated distinct process. belief incorrect. architecture of word has 1 process multiple windows. simple enough verify using task manager program.
what want find top level windows associated specific process. question has been asked here many times before. instance: how enumerate windows belonging particular process using .net?
Comments
Post a Comment