It is currently Thu Nov 21, 2019 9:43 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Refresh Registry [Windows]
PostPosted: Wed Jun 05, 2019 9:53 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3458
Hi
Example : After auto arrange Icons
#1 : Using VBscript
Code:
RunProgram("REG"," ADD "+Chr(34)+"HKCU\SOFTWARE\Microsoft\Windows\Shell\Bags\1\Desktop"+Chr(34)+" /V FFLAGS /T REG_DWORD /D 1075839524 /F","")
OpenFile(0,GetHomeDirectory()+"rashad.vbs")
  Restore StringData
  For i = 1 To 10
    Read.s MyData$
    WriteStringN(0,MyData$)
  Next
CloseFile(0)
RunProgram(GetHomeDirectory()+"rashad.vbs","","",#PB_Program_Hide)
Delay(50)
;DeleteFile(GetHomeDirectory()+"rashad.vbs")
 
DataSection   
  StringData:
    Data.s "Function RefreshExplorer()"
    Data.s "dim strComputer, objWMIService, colProcess, objProcess"
    Data.s "strComputer = "+Chr(34)+"."+Chr(34)
    Data.s "Set objWMIService = GetObject("+Chr(34)+"winmgmts:"+Chr(34)+" & "+Chr(34)+"{impersonationLevel=impersonate}!\\"+Chr(34)+" & strComputer & "+Chr(34)+"\root\cimv2"+Chr(34)+")"
    Data.s "Set colProcess = objWMIService.ExecQuery ("+Chr(34)+"Select * from Win32_Process Where Name = 'explorer.exe'"+Chr(34)+")"
    Data.s "For Each objProcess in colProcess"
    Data.s "objProcess.Terminate()"
    Data.s "Next"
    Data.s "End Function"
    Data.s "Call RefreshExplorer"
EndDataSection



#2 : Using PowerShell
Code:
RunProgram("REG"," ADD "+Chr(34)+"HKCU\SOFTWARE\Microsoft\Windows\Shell\Bags\1\Desktop"+Chr(34)+" /V FFLAGS /T REG_DWORD /D 1075839524 /F","")
RunProgram("powershell.exe","stop-process -name explorer -force","",#PB_Program_Hide)

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Refresh Registry [Windows]
PostPosted: Wed Jun 05, 2019 11:25 am 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4528
Location: Lyon - France
I don't know if that works, because i not have something to change, needed to refresh BDR for the moment :oops:
But i have often search this style of code in the past time :|
In all case, thanks for sharing MASTER this usefull code 8)

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye