#83570 - 2002-10-11 09:37 AM
ModifyStartMenu()
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11624
Loc: CA
|
;FUNCTION ModifyStartMenu() ; ;ACTION Modifies the Start Menu and Taskbar options ; ;AUTHOR NTDOC ; ;HELP BY: Bryce wrote code to update binary values. ; ;SYNTAX None ; ;PARAMETERS $regstring[52] = "06" ; $regstring[8] = "06" ; Selects which binary value to edit - see table ; $regstate[32]="00" ; Sets XP Menu Style - see table ; ;RETURN 0 if successful, otherwise error code ; ;REMARKS Please read all documentation for options ; ;KIXTART VER 4.12 ; ;DEPENDENCIES Latest version of WMI and KiXtart 4.12 ; ;TESTED ON Windows 98SE, NT, 2000, XP ; ;EXAMPLE $ReturnCode=ModifyStartMenu ; ;KIXTART BBS http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=12&t=000279 ; ;Documentation and Code below
Modifying the Start Menu Options via KiXtart
In order to modify the Start Menu Options via a Regedit or programmatically you need to make the modification first, then either log off or end task the shell (explorer.exe) and your new settings will take affect. The reason is that these settings appear to first be stored in volatile memory and are then written to the Registry when you log off. The GUI apparently makes some kind of undocumented API call to have Explorer reload its settings, which you are not able to do with a simple Regedit change. There also appears to be a state that can't be achieved via the GUI, which is to use the Classic Menu and Small Icons, but can be done via Regedit.
Windows XP: Shell State XP Menu or Classic Menu HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer ShellState Reg_Binary - The 33rd binary value controls this state. 00=Classic Menu 02=XP Menu
Windows XP: Large/Small Icons HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced Start_LargeMFUIcons DWORD 1 Enables large icons 0 Disables large icons when using the XP Menu and not the Classic Menu. The Classic Menu does not use the Start_LargeMFUIcons settings
Windows XP: Lock the Taskbar Menu HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced TaskbarSizeMove DWORD 1 Disables locking the taskbar 0 Enables locking the taskbar
Windows XP: Group Similar Tasbar Buttons HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced TaskbarGlomming DWORD 1 Enables grouping similar buttons 0 Disables grouping similar buttons
Windows Start Menu options are controlled by the following Registry locations. Windows 2000 and XP use the 9th binary value and Windows NT uses the 53 binary value as shown in the table below.
Windows 2000 and XP HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2 Settings Windows NT 4.0 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects Settings Windows 9x HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects Settings
SINGLE OPTIONS: 08 = No Settings Enabled 09 = Auto Hide 00 = Show Clock 0A = Always on Top 0C = Show small icons in Start Menu
MULTIPLE OPTIONS: 01 = Auto Hide and Show Clock 02 = Always on Top and Show Clock 03 = Always on Top and Auto Hide and Show Clock 04 = Show small icons in Start Menu and Show Clock 0E = Always on Top and Show small icons in Start Menu 0F = Always on Top and Auto Hide and Show small icons in Start Menu 06 = Always on Top and Show small icons in Start Menu and Show Clock 07 = All Options Enabled 0B = Always on Top and Auto Hide 0D = Auto Hide and Show small icons in Start Menu
Function ModifyStartMenu()
dim $ars, $i, $count, $settings, $x
If @INWIN=1
$ARS = writevalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","AutoRestartShell","1","REG_DWORD")
EndIF
Select
Case @PRODUCTTYPE="Windows 95"
$settings = readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects","settings")
Case @PRODUCTTYPE="Windows 98"
$settings = readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects","settings")
Case @PRODUCTTYPE="Windows Me"
$settings = readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects","settings")
Case @PRODUCTTYPE="Windows NT Workstation"
$settings = readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects","settings")
Case @PRODUCTTYPE="Windows 2000 Professional"
$settings = readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2","settings")
Case @PRODUCTTYPE="Windows XP Professional"
$settings = readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2","settings")
Case 1
Return
EndSelect
Dim $regstring[(len($settings)/2)-1]
for $i = 1 to len($settings) step 2
$regstring[$count] = substr($settings,$i,2)
$count = $count + 1
next
Select
Case @PRODUCTTYPE="Windows 95"
$regstring[8] = "06"
$x = writevalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects","settings",join($regstring,""),"REG_BINARY")
Case @PRODUCTTYPE="Windows 98"
$regstring[8] = "06"
$x = writevalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects","settings",join($regstring,""),"REG_BINARY")
Case @PRODUCTTYPE="Windows Me"
$regstring[8] = "06"
$x = writevalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects","settings",join($regstring,""),"REG_BINARY")
Case @PRODUCTTYPE="Windows NT Workstation"
$regstring[52] = "06"
$x = writevalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects","settings",join($regstring,""),"REG_BINARY")
Case @PRODUCTTYPE="Windows 2000 Professional"
$regstring[8] = "06"
$x = writevalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2","settings",join($regstring,""),"REG_BINARY")
Case @PRODUCTTYPE="Windows XP Professional"
$regstring[8] = "06"
$x = writevalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2","settings",join($regstring,""),"REG_BINARY")
Case 1
Return
EndSelect
If @PRODUCTTYPE="Windows XP Professional"
$state = readvalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer","shellstate")
Dim $regstate[(len($state)/2)-1]
$count = 0
For $i = 1 to len($state) step 2
$regstate[$count] = substr($state,$i,2)
$count = $count + 1
next
$regstate[32]="00" ; 00=Classic Menu 02=XP Menu
; Start_LargeMFUIcons value of 1=Use Large Icons in XP Menu 0=Use Small Icons in XP Menu
$x = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_LargeMFUIcons","0", "REG_DWORD")
$x = writevalue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer","shellstate",join($regstate,""),"REG_BINARY")
Endif
$COMPUTER=@WKSTA
$PROC = "EXPLORER.EXE"
For each $Process in GetObject("winmgmts:{impersonationLevel=impersonate}!//$COMPUTER").ExecQuery("select * from Win32_Process where Name='$PROC'")
$x=$Process.Terminate
Next
If @INWIN=2
Run "Explorer"
Endif
EndFunction
OPTIONS TABLE
SINGLE OPTIONS:
08 = No Settings Enabled
09 = Auto Hide
00 = Show Clock
0A = Always on Top
0C = Show small icons in Start Menu
MULTIPLE OPTIONS:
01 = Auto Hide and Show Clock
02 = Always on Top and Show Clock
03 = Always on Top and Auto Hide and Show Clock
04 = Show small icons in Start Menu and Show Clock
0E = Always on Top and Show small icons in Start Menu
0F = Always on Top and Auto Hide and Show small icons in Start Menu
06 = Always on Top and Show small icons in Start Menu and Show Clock
07 = All Options Enabled
0B = Always on Top and Auto Hide
0D = Auto Hide and Show small icons in Start Menu
|
Top
|
|
|
|
#83574 - 2002-11-29 01:06 AM
Re: ModifyStartMenu()
|
Lee Wilmott
Starting to like KiXtart
Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
|
NTDOC,
This UDF is absolutely brilliant...very helpful to me indeed.
There is only one comment (if I may; sorry)!
I really don't like the idea of "blowing" away explorer and then reloading it. You end up loosing icons in your system tray...(maybe not the end of the world, but I was hoping for a more elegant way!).
Do you, or anyone else know of a way to reload the shell/start menu?
I tried looking on Microsoft's website and all I came up with was this...http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/shell/refreshmenu.asp. Which I "tried" but I didn't get very far with it.
Is the method you perform in this UDF the only solution?
Cheers, thanks for the UDF,
Lee
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 616 anonymous users online.
|
|
|