Exemplo n.º 1
0
        private Process getProcessByMyApp(MyApps app)
        {
            if (app.Handle != null && app.Handle!=IntPtr.Zero)
            {
                Process p = Process.GetProcessById(app.Handle.ToInt32());
                if (p != null)
                    return p;
            }
            string name = app.Fileinfo.Name.Replace(app.Fileinfo.Extension, "");
            Process[] ps = Process.GetProcessesByName(name);
            if (ps.Length > 0)
                return ps[0];
            return null;

        }
Exemplo n.º 2
0
        private Process getProcessByMyApp(MyApps app)
        {
            if (app.Handle != null && app.Handle != IntPtr.Zero)
            {
                Process p = Process.GetProcessById(app.Handle.ToInt32());
                if (p != null)
                {
                    return(p);
                }
            }
            string name = app.Fileinfo.Name.Replace(app.Fileinfo.Extension, "");

            Process[] ps = Process.GetProcessesByName(name);
            if (ps.Length > 0)
            {
                return(ps[0]);
            }
            return(null);
        }