excel - GetWindowThreadProcessId method return 0 in c# Console Application -


i using c# console application fetch process id of excel using getwindowthreadprocessid method. when test on machine fetches proper process id, when deploy application on machine, in .net setup not installed, runs gets 0 id.

please me proper process id of excel instance.

[dllimport("user32.dll")] static extern int getwindowthreadprocessid(int hwnd, out int lpdwprocessid);  process getexcelprocess(excel.application excelapp) {     int id;     getwindowthreadprocessid(excelapp.hwnd, out id);     return process.getprocessbyid(id); } 


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -