• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 7 رای - 2.14 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: سورس کد بدست اورن لیست برنامه های نصب شده c#
حالت موضوعی
#1
Instructions: 1. Add 'Using Microsoft.Win32' at the top of your code.
2. Put the following code into a class.
3. See example on using the code.

با سورس میتونید برنامه های که روی ویندوز نصب شده رو بدست اورید.

کد:
/// <summary>
        /// Gets a list of installed software and, if known, the software's install path.
        /// </summary>
        /// <returns></returns>
        private string Getinstalledsoftware()
        {
            //Declare the string to hold the list:
            string Software = null;

            //The registry key:
            string SoftwareKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
            using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(SoftwareKey))
            {
                //Let's go through the registry keys and get the info we need:
                foreach (string skName in rk.GetSubKeyNames())
                {
                    using (RegistryKey sk = rk.OpenSubKey(skName))
                    {
                        try
                        {
                            //If the key has value, continue, if not, skip it:
                            if (!(sk.GetValue("DisplayName") == null))
                            {
                                //Is the install location known?
                                if (sk.GetValue("InstallLocation") == null)
                                    Software += sk.GetValue("DisplayName") + " - Install path not known\n"; //Nope, not here.
                                else
                                    Software += sk.GetValue("DisplayName") + " - " + sk.GetValue("InstallLocation") + "\n"; //Yes, here it is...
                            }
                        }
                        catch (Exception ex)
                        {
                            //No, that exception is not getting away... :P
                        }
                    }
                }
            }

            return Software;
        }


//EXAMPLE USAGE:
private void get_software_list_button__Click(object sender, EventArgs e)
        {
            MessageBox.Show(Getinstalledsoftware());
        }
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
 
پاسخ
  


موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  سورس کد تبدیل عکس رنگی به سیاه سفید (سی شارپ) Amin_Mansouri 1 7,223 10-08-2022، 08:06 PM
آخرین ارسال: sonusood
  سورس کد تبدیل عکس به ایکون ( سی شارپ ) Amin_Mansouri 1 4,385 10-08-2022، 07:37 PM
آخرین ارسال: sonusood
  سورس کد تغییر دادن سایز عکس ( سی شارپ) Amin_Mansouri 1 6,778 10-08-2022، 07:08 PM
آخرین ارسال: sonusood
  سورس کد ساخت فایل pdf (سی شارپ) Amin_Mansouri 3 12,081 07-01-2017، 10:05 AM
آخرین ارسال: 7seo
Bug پشتیبانی آموزشی رایگان برای فراگیران زبان های برنامه نویسی one hacker alone 0 2,685 08-09-2016، 11:53 PM
آخرین ارسال: one hacker alone
  سورس کد الگوریتم رمزنگاری تصویر زهرا ترکاشوند 3 9,369 05-17-2016، 01:41 PM
آخرین ارسال: mehdisadeghi
  سورس کد ifc saraj00n 1 3,672 05-13-2016، 01:46 PM
آخرین ارسال: saraj00n
  بدست اوردن میزارن کنتراست عکس saraj00n 1 3,820 05-01-2016، 05:32 PM
آخرین ارسال: Amin_Mansouri
  سورس کد اضافه ,ویرایش,حذف,جستجو در دیتابیس(سی شارپ) Amin_Mansouri 6 24,099 12-09-2015، 08:17 AM
آخرین ارسال: Amin_Mansouri
  فروش سورس کد کتابساز اندروید دانشجو omid_student 1 4,698 08-12-2014، 11:00 AM
آخرین ارسال: Amin_Mansouri

پرش به انجمن:


Browsing: 1 مهمان