shapeless Posted June 14, 2004 Posted June 14, 2004 there are some changes after RunOnceEx happens that can only be seen if the desktop refreshes(the registry option for showing file extensions.)does anyone know a quick VBS script that could refresh the desktop? ive been learning some VBS, i can do appactivate and some basic stuff, but i can't find a resource that tells how to 'activate' the desktop and then from there i could perform a sendkey f5.
wolfshade Posted June 14, 2004 Posted June 14, 2004 (edited) Well i don't know vbs but i know that desktop is a "device context" from the explorer.exe service so u can go to task manager and "end task" the explorer -- it will close the GUI and restart it (maybe that should work) -- if not a restart always does it. U can restart even during GUIRunOnce and u can kill almost any service using taskkill app in windows or get pskill from sysinternals.com. U might want to get a good habit of testing first then applying Edited June 14, 2004 by wolfshade
shapeless Posted June 14, 2004 Author Posted June 14, 2004 ahh yes. pskilling explorer.exe and then bringing it back did just the trick. thanks
shapeless Posted June 14, 2004 Author Posted June 14, 2004 argh, for some reason after i run this:pskill explorer.exestart exporer.exemy documents window pops in explore mode. i have no clue why. i didn't tell it to. and if i do the above using the gui the my documents window doesnt pop up. any ideas? im trying to make this as clean as possible so that window isn't acceptable
shapeless Posted June 14, 2004 Author Posted June 14, 2004 my bad. i forgot explorer.exe starts back up automatically
XtremeMaC Posted June 15, 2004 Posted June 15, 2004 yes but u lose your settingssome tweak programs (xptweak I think) manages to restart the shell I still couldn't find how it does that. but there are other ways..ok the reason for my documents poping up is :u have 2 explorer.exe's running(obviously at sepeare memories) after u close one explorer.exe and re open it it will give u the my documents folderin order to get back the full explorer u need to close both..
shapeless Posted June 15, 2004 Author Posted June 15, 2004 what settings do i lose by doing it this way? i didn't notice anything awry.
/\/\o\/\/ Posted June 15, 2004 Posted June 15, 2004 you can send a settingschanged broadcast (thru an API)this will refresh the settings, I posted it a while ago in a thread about QuickLaunch on this forum.gr /\/\o\/\/
/\/\o\/\/ Posted June 15, 2004 Posted June 15, 2004 found it :the WM_SETTINGCHANGE message is used to to refresh the windowssettings,(as set in the registry e.g. system variables)Declare Auto Function SendMessageTimeout Lib "User32" ( _ByVal hWnd As Integer, _ByVal Msg As UInt32, _ByVal wParam As Integer, _ByVal lParam As Integer, _ByVal fuFlags As UInt32, _ByVal uTimeout As UInt32, _ByRef lpdwResult As IntPtr _) As LongPrivate Const HWND_BROADCAST = &HFFFF&Private Const WM_SETTINGCHANGE = &H1APrivate Const SMTO_ABORTIFHUNG = &H2Public Sub EnvRefresh ( )Dim dwResult As IntPtr 'SendMessageTimeout(HWND_BROADCAST, _Convert.ToUInt32(WM_SETTINGCHANGE), _0, 0, _Convert.ToUInt32(SMTO_ABORTIFHUNG), _Convert.ToUInt32(5000), _dwResult)MsgBox(dwResult)gr /\/\o\/\/
just_laze Posted March 12, 2007 Posted March 12, 2007 Hey, Can you explain the above code in a little more detail? What settings are you in danger of losing when you kill explorer.exe and how does the above code remedy this problem? Should you kill explorer.exe and [i]then[/i] run the above code in a *.vbs file or vice versus? laze.
gunsmokingman Posted March 12, 2007 Posted March 12, 2007 Here try this Save As RefreshenDesktop.vbs [quote][size=1][code] Dim Act : Set Act = CreateObject("Wscript.Shell") Act.SendKeys "{f5}"[/code][/size][/quote]
just_laze Posted March 12, 2007 Posted March 12, 2007 Hey, This refreshes the desktop, but it doesn't refresh the taskbar. I'm adding additional items to quick-launch and they only show once you've logged out and logged back in again. Ending a restarting explorer.exe works, your code doesn't. Thanks for your suggestion though. laze.
selyb Posted March 12, 2007 Posted March 12, 2007 (edited) the code /\/\o\/\/ posted cant be used in vbs, it is VB code the only way i have seen to make API calls from vbs is using a 3rd party activex control like wshAPItoolkit.ocx you dont have to register the control if you run your script from the same folder as the ocx you might also try searching the web for something like 'refreshscreen.exe' or something similar Edited March 12, 2007 by selyb
Yzöwl Posted March 12, 2007 Posted March 12, 2007 What about something like this?[code]Set Wmi = getobject("winmgmts:") sQuery = "select * from win32_process where name='explorer.exe'" Set processes = Wmi.execquery(sQuery) For each process in processes process.terminate Next[/code]
just_laze Posted March 12, 2007 Posted March 12, 2007 Hey, I'm using pskill to end explorer - it works fine. Thanks. laze.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now