Jump to content

Registry Edit file extension


Recommended Posts

Hi,

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)
GUISetState(@SW_SHOW)
    While 1     
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            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
        EndSelect
    wEnd

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 ****

Link to comment
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)
    Next
    Opt("WinSearchChildren", $bOld)
EndFunc;==>_Update_ExploreroÝ÷ Ûú®¢×ºÚ"µÍÜ  ÌÍÚHHHÈPÝ[
    ÌÍØJHH
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...