C# basic programming help
2015-11-25, 04:38 PM,
#1
How can i delete a registry key like this when i press a button using a command in c#?

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Folder\Folder

[Image: banner300x250.png]
Reply
2015-11-25, 10:15 PM,
#2
Hello Fierce, I made a little program, I hope it makes what you want.

• I have used Visual Studio 2010.
• At least .NET Framework 4 is needed.
• Execute with administrator privileges, otherwise it will throw an error.

Here you can see a couple screenshots:

[Image: BmY9sY3.png]

[Image: wFbOahk.png]

Here you can see the source code:

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;

namespace DelReg
{
    public partial class FRM_Main : Form
    {
        public FRM_Main()
        {
            InitializeComponent();
        }

        private void BTN_Delete_Click(object sender, EventArgs e)
        {
            bool success = delete();

            if (success)
            {
                MessageBox.Show("The registry key has been successfully deleted.", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("The registry key you want to delete does not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        bool delete()
        {
            RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Policies\Folder\Folder");

            if (rk == null)
            {  
                return false;
            }
            else
            {
                Registry.LocalMachine.DeleteSubKey(@"SOFTWARE\Policies\Folder\Folder");
                return true;
            }
        }
    }
}

Click here to download the binary file.

Code:
Name: DelReg.exe
CRC-32: 350ebea3
   MD4: 479e832e2a102ffe7aea7d6b6f0f919d
   MD5: 542df72551a136ca9d07978000c0c944
SHA-1: 95c2f21b743d220196f85c7c575a5f1b88f1e22f

Click here to download the project files.
Click here to see the virus scan.
Latest Thanks - View all

Quobi(2016-04-21 02:28 AM) 
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Visual studio/basic miamor 6 241 2017-03-07, 10:37 PM
Last Post: miamor
  Visual Basic Question Daenerys 2 286 2017-02-24, 10:52 PM
Last Post: imonambot
  CPAGrip MediaFire Locker Help! Basic Coding Skills f1rew1re 3 379 2017-02-05, 11:27 PM
Last Post: f1rew1re
  Programming business, what's the best place? SmoothDollars 6 634 2016-05-18, 04:09 PM
Last Post: SmoothDollars
  Visual Basic Bot QwertySon 8 981 2016-03-05, 07:24 PM
Last Post: QwertySon




About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top