June 14, 200422 yr 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.
June 14, 200422 yr 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, 200422 yr by wolfshade
June 14, 200422 yr Author ahh yes. pskilling explorer.exe and then bringing it back did just the trick. thanks
June 14, 200422 yr Author 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
June 15, 200422 yr 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..
June 15, 200422 yr Author what settings do i lose by doing it this way? i didn't notice anything awry.
June 15, 200422 yr 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\/\/
June 15, 200422 yr 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\/\/
March 12, 200719 yr 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.
March 12, 200719 yr Here try this Save As RefreshenDesktop.vbs [quote][size=1][code] Dim Act : Set Act = CreateObject("Wscript.Shell") Act.SendKeys "{f5}"[/code][/size][/quote]
March 12, 200719 yr 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.
March 12, 200719 yr 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, 200719 yr by selyb
March 12, 200719 yr 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]
Create an account or sign in to comment