ใช้ล็อกโฟลเดอร์ด้วย CLSID ใน Registry
- Code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=beta
#AutoIt3Wrapper_icon=..\..\icon.ico
#AutoIt3Wrapper_Compression=3
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
Opt("TrayIconHide", 1)
Global $R1 = ""
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("PSsix Lock Folder โปรแกรล็อคโฟลเดอร์", 376, 133, 366, 294)
GUISetBkColor(0xFFFFFF)
$Button1 = GUICtrlCreateButton("ล็อกโฟลเดอร์", 152, 96, 75, 25, $WS_GROUP)
GUICtrlSetBkColor(-1, 0x3399FF)
$Group1 = GUICtrlCreateGroup("ไอคอนที่จะสร้างแทนโฟลเดอร์", 8, 8, 361, 81)
$Radio1 = GUICtrlCreateRadio("Computer", 24, 32, 110, 17)
$Radio2 = GUICtrlCreateRadio("Recycle Bin", 24, 56, 110, 17)
$Radio3 = GUICtrlCreateRadio("Printers and Faxes", 152, 32, 110, 17)
$Radio4 = GUICtrlCreateRadio("Programs Folder", 152, 56, 110, 17)
$Radio5 = GUICtrlCreateRadio("IE", 264, 32, 100, 17)
$Radio6 = GUICtrlCreateRadio("Network", 264, 56, 100, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button2 = GUICtrlCreateButton("ปลดล็อก", 232, 96, 75, 25, $WS_GROUP)
GUICtrlSetBkColor(-1, 0x3399FF)
$Label1 = GUICtrlCreateLabel("", 8, 100, 131, 17)
$Button3 = GUICtrlCreateButton("PSsix", 328, 96, 43, 33, $WS_GROUP)
GUICtrlSetBkColor(-1, 0xC0DCC0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Form1
Case $Button1
if $R1 = "" then
#Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=None
MsgBox(0,"ยังไม่ได้เลือกไอคอน","คุณยังไม่ได้เลือกไอคอนที่จะใช้ล็อกโฟลเดอร์")
#EndRegion --- CodeWizard generated code End ---
Else
$var = FileSelectFolder("เลือกโฟลเดอร์ที่จะล็อก", "")
if StringInStr($var , "{") Then ;ตรวจดูว่าเคยล็อกโฟลเดอร์หรือเปล่า ถ้าเคยล็อกตัดออกก่อน
$foldername = StringSplit($var ,".{")
DirMove ($var,$foldername[1]&$R1) ;เปลี่ยนชื่อโฟลเดอร์ให้กลับเป็นแบบปกติที่ไม่มี clsid
GUICtrlSetData($Label1,"ล็อกโฟลเดอร์เรียบร้อย")
Else
DirMove ($var,$var&$R1)
GUICtrlSetData($Label1,"ล็อกโฟลเดอร์เรียบร้อย")
EndIf
EndIf
Case $Radio1
$R1 = ".{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
Case $Radio2
$R1 = ".{645FF040-5081-101B-9F08-00AA002F954E}"
Case $Radio3
$R1 = ".{2227A280-3AEA-1069-A2DE-08002B30309D}"
Case $Radio4
$R1 = ".{7be9d83c-a729-4d97-b5a7-1b7313c39e0a}"
Case $Radio5
$R1 = ".{871C5380-42A0-1069-A2EA-08002B30309D}"
Case $Radio6
$R1 = ".{208D2C60-3AEA-1069-A2D7-08002B30309D}"
Case $Button2
$var = FileSelectFolder("เลือกโฟลเดอร์ที่จะปลดล็อก", "")
if StringInStr($var , "{") Then ;ตรวจดูว่าเคยล็อกโฟลเดอร์หรือเปล่า ถ้าเคยล็อกตัดออกก่อน
$foldername = StringSplit($var ,".{")
DirMove ($var,$foldername[1]) ;เปลี่ยนชื่อโฟลเดอร์ให้กลับเป็นแบบปกติที่ไม่มี clsid
GUICtrlSetData($Label1,"ปลดล็อกโฟลเดอร์เรียบร้อย")
Else
#Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Info
MsgBox(64,"ปลดล็อกไม่ได้","โฟลเดอร์ที่เลือกปลดล็อกไม่ได้")
#EndRegion --- CodeWizard generated code End ---
EndIf
Case $Label1
Case $Button3
_IECreate("http://pssix.blogspot.com/", 1, 1, 0)
EndSwitch
WEnd