GHOSTSKIKDA Posted February 6, 2009 Posted February 6, 2009 (edited) Hi !expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### $Form1 = GUICreate("NoWritInFlashDisk", 443, 186, -1, -1, BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xDBD3CB) $Group1 = GUICtrlCreateGroup("", 16, 9, 401, 145, $BS_RIGHT) $Button1 = GUICtrlCreateButton("؟", 393, 18, 19, 17, 0) GUICtrlSetCursor (-1, 4) $Button2 = GUICtrlCreateButton("Quit", 32, 121, 75, 25, 0) GUICtrlSetCursor (-1, 0) $Button3 = GUICtrlCreateButton("0", 184, 48, 19, 17, 0) $Label1 = GUICtrlCreateLabel("No Write in Flash Disk", 216, 48, 185, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) $Label2 = GUICtrlCreateLabel("Write in Flash Disk", 208, 80, 197, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) $Button4 = GUICtrlCreateButton("0", 184, 80, 19, 17, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button3 RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies","WriteProtect","REG_DWORD",1) GUICtrlSetColor($Label1 , 0x0000FF) GUICtrlSetColor($Label2, 0xFF0000) $Button3 = GUICtrlCreateButton("1", 184, 48, 19, 17, 0) $Button4 = GUICtrlCreateButton("0", 184, 80, 19, 17, 0) Case $Button4 RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies") GUICtrlSetColor($Label2 , 0x0000FF) GUICtrlSetColor($Label1, 0xFF0000) $Button4 = GUICtrlCreateButton("1", 184, 48, 19, 17, 0) $Button3 = GUICtrlCreateButton("0", 184, 80, 19, 17, 0) Case $Button2 Sleep(500) Exit EndSwitch WEnd Edited February 6, 2009 by ALG [center]I LOVE ALGERIA .... ;-)[/center]
KaFu Posted February 6, 2009 Posted February 6, 2009 1) Wrong Forum... this one is reserved for examples, not questions. 2) I would not create button over button, better change value of existing ones with GUICtrlSetData() 3) The value is written to reg... maybe it needs a restart to be in effect? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
GHOSTSKIKDA Posted February 6, 2009 Author Posted February 6, 2009 Thank you for clarification, my friend [center]I LOVE ALGERIA .... ;-)[/center]
GHOSTSKIKDA Posted February 6, 2009 Author Posted February 6, 2009 Code correct expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### $Form1 = GUICreate("NoWritInFlashDisk", 443, 186, -1, -1, BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xDBD3CB) $Group1 = GUICtrlCreateGroup("", 16, 9, 401, 145, $BS_RIGHT) $Button1 = GUICtrlCreateButton("؟", 393, 18, 19, 17, 0) GUICtrlSetCursor (-1, 4) $Button2 = GUICtrlCreateButton("Quit", 32, 121, 75, 25, 0) GUICtrlSetCursor (-1, 0) $Button3 = GUICtrlCreateButton("0", 184, 48, 19, 17, 0) $Label1 = GUICtrlCreateLabel("No Write in Flash Disk", 216, 48, 185, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) $Label2 = GUICtrlCreateLabel("Write in Flash Disk", 208, 80, 197, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) $Button4 = GUICtrlCreateButton("0", 184, 80, 19, 17, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $a=RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies","WriteProtect") if $a=1 Then GUICtrlSetColor($Label1 , 0x0000FF) GUICtrlSetColor($Label2, 0xFF0000) GUICtrlSetData($Button3, "1") GUICtrlSetData($Button4, "0") Else GUICtrlSetColor($Label2 , 0x0000FF) GUICtrlSetColor($Label1, 0xFF0000) GUICtrlSetData($Button4, "1") GUICtrlSetData($Button3, "0") EndIf While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button3 RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies","WriteProtect","REG_DWORD",1) GUICtrlSetColor($Label1 , 0x0000FF) GUICtrlSetColor($Label2, 0xFF0000) GUICtrlSetData($Button3, "1") GUICtrlSetData($Button4, "0") Case $Button4 RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies") GUICtrlSetColor($Label2 , 0x0000FF) GUICtrlSetColor($Label1, 0xFF0000) GUICtrlSetData($Button4, "1") GUICtrlSetData($Button3, "0") Case $Button2 Sleep(500) Exit EndSwitch WEnd [center]I LOVE ALGERIA .... ;-)[/center]
euverve Posted February 18, 2009 Posted February 18, 2009 (edited) @ALG Please check my sample: http://www.autoitscript.com/forum/index.php?autocom=downloads&showfile=136 Edited February 18, 2009 by euverve
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now