Jump to content
Sign in to follow this  

Registry Edit file extension

Recommended Posts



When my program starts I need to check if file extensions are hidden and if so change them to visible then apply the new settings so that the file extensions are visible when view in explorer.exe. How can the registry be refreshed so that the file extensions are visible when the script below is run?

#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

;Set HideFileExt to 1 - Show extensions
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", _
            "REG_DWORD", "1")

$GUI = GUICreate("RegChange", 340, 90)
$input = GuiCtrlCreateInput("", 5, 25, 330, 16, -1)
$btnSelect = GUICtrlCreateButton("Select", 260, 45, 75, 25)
    While 1     
        $msg = GUIGetMsg()
            Case $msg = $GUI_EVENT_CLOSE
            Case $msg = $btnSelect
                ;Select Microsoft Excel Workbook:               
                $sFile = FileOpenDialog("Select file:", "C:\Program Files", "Excel Files (*.*)")
                If @error Then ContinueLoop
                 GUICtrlSetData($input, $sFile); GUI will be updated at next iteration

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Share this post

Link to post
Share on other sites

I believe you need to update Explorer, not the registry. This code will do it. Call the function any time after you make the registry change.

Func _Update_Explorer()
    Local $bOld = Opt("WinSearchChildren", True)
    Local $a = WinList("[CLASS:SHELLDLL_DefView]")
    For $i = 0 To UBound($a) - 1
        DllCall("user32.dll", "long", "SendMessage", "hwnd", $a[$i][1], "int", 0x111, "int", 28931, "int", 0)
    Opt("WinSearchChildren", $bOld)
EndFunc;==>_Update_ExploreroÝ÷ Ûú®¢×ºÚ"µÍÜ  ÌÍÚHHHÈPÝ[

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this