Page 1 of 1 1
Topic Options
#83570 - 2002-10-11 09:37 AM ModifyStartMenu()
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
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


 Code:
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


 Code:
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
#83571 - 2002-10-11 09:43 AM Re: ModifyStartMenu()
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Looks Nice...

Will try now
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#83572 - 2002-10-11 09:50 AM Re: ModifyStartMenu()
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Hey guys maybe post comments in this post. UDF forum is for the UDF only, not to discuss it.

http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=14&t=000057&p=2#000046

Lonkero, I'm not sure what you mean with your last comment.

Top
#83573 - 2002-10-17 01:18 PM Re: ModifyStartMenu()
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
Great UDF, thankz ! Solves my issue
_________________________
Kind regards,

Top
#83574 - 2002-11-29 01:06 AM Re: ModifyStartMenu()
Lee Wilmott Offline
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!). [Smile]

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. [Frown]

Is the method you perform in this UDF the only solution?

Cheers, thanks for the UDF,

Lee

Top
#83575 - 2002-11-29 01:34 AM Re: ModifyStartMenu()
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I haven't tested this UDF but to refresh the desktop you might try:

$RC=SetFocus("")
$RC=SendKeys("{F5}")
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#83576 - 2002-11-29 02:59 AM Re: ModifyStartMenu()
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Sorry F5 will not refresh the menu, it will actually do the opposite, it will make it lose the changes.

Microsoft calls an API call to reload the settings from a dynamic cache. This is also accomplished by logging off and then back on.

So until KiXtart handles API calls like Visual Basic and C++ I don't think there is any other way.


Top
#189580 - 2008-09-10 04:37 PM Re: ModifyStartMenu() [Re: NTDOC]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
this UDF does not comply to the rules of the forum.
either fix it or it shall be moved elsewhere.
_________________________
!

download KiXnet

Top
#189596 - 2008-09-10 11:29 PM Re: ModifyStartMenu() [Re: Lonkero]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Well it actually doesn't work so might as well move it or remove it.
Top
#189617 - 2008-09-11 09:50 PM Re: ModifyStartMenu() [Re: NTDOC]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
lol.
are you saying, it never worked?
_________________________
!

download KiXnet

Top
#189623 - 2008-09-11 10:18 PM Re: ModifyStartMenu() [Re: Lonkero]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
It works for some things, but not everything. Also most Admins did not like the fact that it kills the Explorer shell and restarts it, but that often applets that were in the Startup Tray are no longer there.

So it is a bit Kludgey to use overall.

Top
#189632 - 2008-09-12 09:15 AM Re: ModifyStartMenu() [Re: NTDOC]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, yeah, you could get it to work, if you rewrote the script but there are no parameters to be entered, which would allow any control over your script -> not a udf.
sadly, I stared your script for 5 mins and came to this conclusion and gave up. guess how the noobs feel? ;\)
_________________________
!

download KiXnet

Top
#189636 - 2008-09-12 03:15 PM Re: ModifyStartMenu() [Re: Lonkero]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I looked at the options table and tried to find hard coded options in the script. But I presume they just are not there?
Top
#189648 - 2008-09-13 07:00 AM Re: ModifyStartMenu() [Re: Witto]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
DOH! Dang, I didn't even read this. I was thinking of my other UDF to kill explorer for a Desktop refresh, not this one.

This UDF does work, but it probably is not compliant. I'm actually working on something similar at work so I'll take a look at this and if possible will make it a proper UDF. But as a script it DOES WORK.

Top
#189656 - 2008-09-13 11:14 PM Re: ModifyStartMenu() [Re: NTDOC]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
sorry, but like witto said...
I must insist that without major rewrite, one can't get it to do anything he/she wants.
_________________________
!

download KiXnet

Top
#189664 - 2008-09-15 12:19 AM Re: ModifyStartMenu() [Re: Lonkero]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Whatever guy. I can make it do just as it says in the description. I agree the code is junky and old, but it does work.

Correct it is not in proper UDF format, but also there are so many options that it would be difficult to make it a "proper" UDF so aside from the code being here it probably won't be a UDF.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 262 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.067 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org