- [C#] Hướng dẫn fix lỗi Visual Studio 2022 not Support Target Net Framework 4.5.2
- [C#] Giới thiệu thư viện Sunny UI thiết kế giao diện trên Winform
- [DATABASE] Hướng dẫn thêm và cập nhật Extended Property Column trong Table Sqlserver
- [DEVEXPRESS] Hướng dẫn sử dụng Vertical Gridview để hiển thị thông tin sản phẩm
- [C#] Hướng dẫn sử dụng Json Schema để Validate chuỗi string có phải json
- [C#] Hướng dẫn sử dụng công cụ Clean Code trên Visual Studio
- [C#] Hướng dẫn Drag and Drop File vào RichTextBox
- [C#] Hướng dẫn tạo hiệu ứng Karaoke Text Effect Winform
- [C#] Sử dụng thư viện ZedGraph vẽ biểu đồ Line, Bar, Pie trên Winform
- [DATABASE] Hướng dẫn sort sắp xếp địa chỉ IP trên sqlserver sử dụng hàm PARSENAME
- [C#] Theo dõi sử kiện process Start hay Stop trên Winform
- [ASP.NET] Chia sẻ source code chụp hình sử dụng camera trên website
- [C#] Chạy ứng dụng trên Virtual Desktop (màn hình ảo) Winform
- [C#] Mã hóa và giải mã Data Protection API trên winform
- [C#] Hướng dẫn tạo Gradient Background trên Winform
- [DATABASE] Hướng dẫn convert Epoch to DateTime trong sqlserver
- [DATABASE] Hướng dẫn sử dụng STRING_AGG và CONCAT_WS trong sqlserver 2017
- [C#] Hướng dẫn Copy With All Property in Class Object
- [DEVEXPRESS] Hướng dẫn load Json DataSource vào GridView
- [C#] Hướng dẫn tạo chữ ký trên winform Signature Pad
Hướng dẫn viết ứng dụng thay đổi (Icon ổ đĩa máy tính) bằng VB.NET
Hôm nay, mình xin hướng dẫn các bạn thay đổi Icon ổ đĩa trong computer bằng một icon mới. Cái này chủ yếu là mình thay đổi registry trong hệ thống, cũng giống như bài hôm trước mình hướng dẫn các bạn khóa taskmanager, cài đặt ứng dụng chạy khi khởi động máy tính...
Các bạn có thể xem qua demo chương trình của mình ở dưới đây:
- Viết sự kiện thay đổi icon, khi click vào button thay đổi icon:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Text = "" Then
MsgBox("Please select an icon.", MsgBoxStyle.Exclamation)
End If
If ComboBox1.SelectedItem = "" Then
MsgBox("Please select a drive letter.", MsgBoxStyle.Exclamation)
Else
My.Computer.Registry.CurrentUser.CreateSubKey("SoftwareClassesApplicationsExplorer.exeDrives" & "" & ComboBox1.SelectedItem & "" & "DefaultIcon")
My.Computer.Registry.SetValue("HKEY_CURRENT_USERSoftwareClassesApplicationsExplorer.exeDrives" & ComboBox1.SelectedItem & "" & "DefaultIcon", "", TextBox1.Text, Microsoft.Win32.RegistryValueKind.String)
MsgBox("Icon changed successfully!", MsgBoxStyle.Information)
End If
End Sub
- Viết sự kiện reset lại icon ổ đĩa mặc định của window:
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If ComboBox1.SelectedItem = "" Then
MsgBox("Please select the drive letter of which you want to reset the icon.", MsgBoxStyle.Exclamation)
Else
Try
My.Computer.Registry.CurrentUser.DeleteSubKey("SoftwareClassesApplicationsExplorer.exeDrives" & ComboBox1.SelectedItem & "" & "DefaultIcon")
My.Computer.Registry.CurrentUser.DeleteSubKey("SoftwareClassesApplicationsExplorer.exeDrives" & ComboBox1.SelectedItem)
MsgBox("Success!", MsgBoxStyle.OkOnly)
Catch ex As Exception
MsgBox("That drives icon was never changed.", MsgBoxStyle.Exclamation)
End Try
End If
End Sub
Chúc các bạn thành công!
Tải project thay đổi icon ổ đĩa bằng vb.net