Hide Drives and Partitions
- Detlef Hoefner
- Posts: 312
- Joined: Sat Oct 08, 2005 9:12 am
- Location: Germany
- Contact:
Silvio,Silvio wrote:I cannot restart windows
there is a possibility to restart using an function ?
If I restart the program ?
it must be made without restart window ...then If I want to show disc C I must restart window...
there is no need to restart Windows.
The drives should be immediatelly hidden.
You only have to refresh the Explorer.
Now the bad news: the FiveWin class treg32 seems not to be able writing REG_BINARY key values.
You can only write subkey values with type REG_DWORD and REG_SZ.
Antonio, am i right ?
Sorry Silvio, can't help you further.
Regards,
Detlef
Dear Silvio,
I use:
With nVal is the value for hidden drives.
Is not necessary reboot windows.
I use:
Code: Select all
REGCREATEKEY( HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", @hKey )
REGSETVALUE( hKey, "NoDrives", 0, REG_DWORD, L2BIN( nVal ), 4 )
REGCLOSEKEY( hKey )
Is not necessary reboot windows.
Ciao, best regards,
Ugo
Ugo
- RAMESHBABU
- Posts: 591
- Joined: Fri Oct 21, 2005 5:54 am
- Location: Secunderabad (T.S), India
- Detlef Hoefner
- Posts: 312
- Joined: Sat Oct 08, 2005 9:12 am
- Location: Germany
- Contact:
- RAMESHBABU
- Posts: 591
- Joined: Fri Oct 21, 2005 5:54 am
- Location: Secunderabad (T.S), India
Dear Mr.Detlef
Thank you very much for your quick reply.
Please go through the following code and advise me where I am going
wrong.
With the following code I did not get the expected result.
Please correct it to get the hidden drive to appear back.
Once again thank you very much.
- Ramesh Babu P
Thank you very much for your quick reply.
Please go through the following code and advise me where I am going
wrong.
With the following code I did not get the expected result.
Please correct it to get the hidden drive to appear back.
Once again thank you very much.
- Ramesh Babu P
#INCLUDE "fivewin.ch"
#define HKEY_CURRENT_USER -2147483647 // 2147483649
FUNCTION Main()
registra(0)
RETURN nil
*********
FUNCTION registra(nNumber)
oReg := TReg32():New(HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\explorer")
oReg:Set("NoDrives", nNumber)
oReg:Close()
RETURN nil
**********
- Detlef Hoefner
- Posts: 312
- Joined: Sat Oct 08, 2005 9:12 am
- Location: Germany
- Contact:
Dear Ramesh,
as i already wrote, i fear that you can not write the desired values with the methods of class TReg32. At least i didn't succeed.
I think you must use the WinApi functions as Ugo showed us.
HTH.
Best regards,
Detlef
as i already wrote, i fear that you can not write the desired values with the methods of class TReg32. At least i didn't succeed.
I think you must use the WinApi functions as Ugo showed us.
Code: Select all
Ugo wrote:
REGCREATEKEY( HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", @hKey )
REGSETVALUE( hKey, "NoDrives", 0, REG_DWORD, L2BIN( nVal ), 4 )
REGCLOSEKEY( hKey )
Best regards,
Detlef
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Sorry Ugo,
But now it not run ok
I SEE THE HARD DISK C
THIS IS THE CODE :
Perhaps there is something wrong....
But now it not run ok
I SEE THE HARD DISK C
THIS IS THE CODE :
Code: Select all
#INCLUDE "fivewin.ch"
#define HKEY_CURRENT_USER -2147483647 // 2147483649
PROCEDURE Main()
LOCAL hKey
Local REG_DWORD
LOCAL nval
nVal:= nDriveNum( "C" )
? nVal
REGCREATEKEY( HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", @hKey )
REGSETVALUE( hKey, "NoDrives", 0, REG_DWORD, L2BIN( nVal ),4 )
REGCLOSEKEY( hKey )
RETURN
FUNCTION nDriveNum( cDrives )
LOCAL nRet := 0
LOCAL n := 0
for n := 1 to len( cDrives )
nRet += 2 ^( asc( upper( substr( cDrives, n, 1 ) ) ) - 65 )
next
RETURN( int( nRet ) )
Perhaps there is something wrong....
Best Regards, Saludos
Falconi Silvio
Falconi Silvio
Dear Silvio,Silvio wrote:Sorry Ugo,
But now it not run ok
...
test this code:
Code: Select all
#INCLUDE "fivewin.ch"
#define HKEY_CURRENT_USER 2147483649
#define REG_DWORD ( 4 ) // 32-bit number
PROCEDURE Main()
LOCAL hKey
LOCAL nval := 4 // Drive C
REGCREATEKEY( HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", @hKey )
REGSETVALUE( hKey, "NoDrives", 0, REG_DWORD, L2BIN( nVal ),4 )
REGCLOSEKEY( hKey )
RETURN
Ciao, best regards,
Ugo
Ugo
- RAMESHBABU
- Posts: 591
- Joined: Fri Oct 21, 2005 5:54 am
- Location: Secunderabad (T.S), India