Archive: [Search] unknown system call


[Search] unknown system call
we have a little problem...

anyony knows tweaking tools like TuneUp or TweakUI

now we have this entry

REGEDIT4

[HKEY_CURRENT_USER\Control Panel\Desktop]
"MenuShowDelay"="8"

(this speeds up the menu open)

it is very simple to write a script for it, but unfortunately system does not take this value - only after restart.
but tweaking tools do so w/o system restart

so i suppose an unknown system call to establish those values

pls help


You probably need to send WM_WININICHANGE. Try:

SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Control Panel"
/TIMEOUT=5000


sorry for bringing up confusion in my previous post. it should work when you use

SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:MenuShowDelay" /TIMEOUT=500


nothing :/

;--------------------------------
;Configuration

!define PRODUCT "MenuShowDelay"
!define VERSION "1.0"

Name "'${PRODUCT}'"

Caption "MenuShowDelay 1.0"
OutFile "MenuShowDelay.exe"

!include WinMessages.nsh

;--------------------------------
;Installer Sections

Section ""
SectionEnd

;--------------------------------
;Installer Functions

Function .onInit
ReadINIStr $R0 "$EXEDIR\MenuShowDelay.ini" MenuShowDelay MenuShowDelay
WriteRegStr HKCU "Control Panel\Desktop" "MenuShowDelay" $R0
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:MenuShowDelay" /TIMEOUT=500
Quit
FunctionEnd

i'm sorry. by trying to take back the confusion of my previous post, i created some more confusion. doesn't work indeed :(

SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) (LPCTSTR)"MenuShowDelay");

this is what i got from MSDN, but WM_SETTINGCHANGE is not supported by NSIS


never mind, was just a try.

the damned nview desktop manager resets on startup the delay to 400 and i tried to help my friend...

thx 4all


still i'd love to see a solution :)


WM_SETTINGCHANGE is identical to WM_WININICHANGE.


>> 1 warning:
>>unknown variable/constant "{WM_SETTINGCHANGE}" detected, ignoring

:cry:


As I already said, WM_WININICHANGE is the same. But I've added WM_SETTINGCHANGE so you can also use the modern name.


guess that's why it still doesn't work ;)


would it be possible to do the same by commandline (rundll or anything like that)? does anybody know about such stuff?


Try this:


!define PRODUCT "MenuShowDelay"
!define VERSION "1.0"

Name "'${PRODUCT}'"

Caption "MenuShowDelay 1.0"
OutFile "MenuShowDelay.exe"

!include WinMessages.nsh
!define SPI_SETMENUSHOWDELAY 107
!define SPIF_SENDINICHANGE 3

;--------------------------------
;Installer Sections

Section ""
SectionEnd

;--------------------------------
;Installer Functions

Function .onInit
Push $R0
Push $R1
ReadINIStr $R0 "$EXEDIR\MenuShowDelay.ini" MenuShowDelay MenuShowDelay
System::call "user32::SystemParametersInfo(i ${SPI_SETMENUSHOWDELAY}, i R0 , i 0, i ${SPIF_SENDINICHANGE}) i .R1"
MessageBox MB_OK "Done: $R1"
Pop $R1
Pop $R0
Quit
FunctionEnd

not sure if it's coincidence or if my system went unusuable after trying this. however, i can't tell what made my system unusable and i don't want to claim it was was the script's fault. in any case, i'm now using vmware to test scripts with code i don't understand. :p

i'd like to know more about this system call. what is SPI_SETMENUSHOWDELAY? is this meant to refresh the MenuDelay setting only? i'd be interested in finding out more about this, since i want to reload other settings from the registry aswell.


Its a documented Windows API call- I don't see why it would mess up your system. Look up MSDN documentation on SystemParametersInfo. It is the same call made by TweakUI.
SPI_SETMENUSHOWDELAY is only for MenuDelay. There are a bunch of other settings, they're all in the API documentation.


thanks for the reference, will look myself into it.

must've been coincidence, didn't mean to offend you.

thanks iceman_k!


No offence taken. :)


i compiled and ran the script again, my system got kinda unusable.

whenever i right-click a file, submenus like "Send to.." or "Open with.." take several seconds until they are getting displayed.

next time i ran RegMon to see what the script does. i thought it just reads a setting (MenuDelay in this case) from the registry and applies it (otherwise one has to reboot to apply the setting). actually MenuShowDelay gets set to "0" (default is "400"). when i set this back to 400 and applied the setting, the menu still take several seconds until they appear.

this also brings up the question, what these variables are used for, since the "0" is the value, to which the menudelay is getting set.

any clue how i can reset all the settings made by this script?


hm, i reinstalled directx and now the problem is fixed.. how weird is that


The script is not reading the default value from the registry.
It expects you to have a file called MenuShowDelay.ini in the same directory as the MenuShowDelay.exe executable, with a section called MenuShowDelay and a value called MenuShowDelay.
I just tested the script on 3 different machines, two running Win XP Pro and one running Win 2K Pro. It ran fine on all three.

I don't know why directx would be an issue at all. SystemParametersInfo is a standard Windows API. SPI_MENUSHOWDELAY is supported on all versions except Windows 95.


well, i know it sounds odd, but what can i say. it happened before and i was unsure, this time i could be sure. didn't happen on xp, but on a 2003 server, though it has the same registry entries. however, i'm glad i could solve this.


Originally posted by iceman_k
Its a documented Windows API call- I don't see why it would mess up your system. Look up MSDN documentation on SystemParametersInfo. It is the same call made by TweakUI.
just to clear this up:

There is a bug in Windows Server 2003 that will cause short bursts of unresponsiveness when loading a sub menu such as SendTo. The cause of this problem is when the MenuShowDelay is set to "0" (which allows sub menus to instantly appear). This tweak is applied by either TweakUI, X-Setup, or by editing the Registry.

i found this on msfn.org

OK, so if the MenuShowDelay.ini file is missing, then the $R0 value is probably being set to 0 by default, hence the MenuShowDelay is also being set to 0- which triggers this bug.
The fix would be to modify the script to check that the value is > 0.


!define PRODUCT "MenuShowDelay"
!define VERSION "1.0"

Name "'${PRODUCT}'"

Caption "MenuShowDelay 1.0"
OutFile "MenuShowDelay.exe"

!include WinMessages.nsh
!define SPI_SETMENUSHOWDELAY 107
!define SPIF_SENDINICHANGE 3

;--------------------------------
;Installer Sections

Section ""
SectionEnd

;--------------------------------
;Installer Functions

Function .onInit
Push $R0
Push $R1
ReadINIStr $R0 "$EXEDIR\MenuShowDelay.ini" MenuShowDelay MenuShowDelay
IntCmp $R0 0 done done 0
System::call "user32::SystemParametersInfo(i ${SPI_SETMENUSHOWDELAY}, i R0 , i 0, i ${SPIF_SENDINICHANGE}) i .R1"
MessageBox MB_OK "Done: $R1"
done:
Pop $R1
Pop $R0
Quit
FunctionEnd

wow, after a year passed by this thread is still alive :)
meanwhile i dropped my investigations this way cause nvidia may solved this annoying bug. one of the latest drivers (66.xx).

"menushowdelay" is 8 here, 0 is too fast and default 400 is lame ;p