FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Hide Drives and Partitions
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Hide Drives and Partitions
Posted: Wed Aug 30, 2006 10:23 AM

Exist a function in FW/xHARbour to Restart window's registry for the change to take effect without erestart window ?

Best Regards, Saludos



Falconi Silvio
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Hide Drives and Partitions
Posted: Wed Aug 30, 2006 11:21 AM
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...


Silvio,

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
Posts: 283
Joined: Sat Oct 15, 2005 06:40 AM
Hide Drives and Partitions
Posted: Wed Aug 30, 2006 02:35 PM
Dear Silvio,
I use:
   REGCREATEKEY( HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", @hKey )
   REGSETVALUE( hKey, "NoDrives", 0, REG_DWORD, L2BIN( nVal ), 4 )
   REGCLOSEKEY( hKey )


With nVal is the value for hidden drives.
Is not necessary reboot windows.
Ciao, best regards,

Ugo
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Hide Drives and Partitions
Posted: Wed Aug 30, 2006 02:46 PM

thanks but wich parameter you give to these:

hKey
REG_DWORD
nval
because it me give an error Variables does not exist

Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Hide Drives and Partitions
Posted: Wed Aug 30, 2006 02:47 PM

now run ok

Best Regards, Saludos



Falconi Silvio
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Hide Drives and Partitions
Posted: Wed Aug 30, 2006 03:33 PM

Hi all

In continuation of the subject, please post an example to show the hidden
drive(s) back.

Thanks in advance

  • Ramesh Babu P
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Hide Drives and Partitions
Posted: Wed Aug 30, 2006 04:01 PM
RAMESHBABU wrote:Hi all

In continuation of the subject, please post an example to show the hidden
drive(s) back.

Thanks in advance

- Ramesh Babu P


Dear Ramesh,

just use a 0 ( zero ) and write it into the noDrives key.

Best regards,
Detlef
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Hide Drives and Partitions
Posted: Wed Aug 30, 2006 05:11 PM
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


#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

**********


Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Hide Drives and Partitions
Posted: Wed Aug 30, 2006 07:00 PM
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.
Ugo wrote:

REGCREATEKEY( HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", @hKey )
REGSETVALUE( hKey, "NoDrives", 0, REG_DWORD, L2BIN( nVal ), 4 ) 
REGCLOSEKEY( hKey )


HTH.
Best regards,
Detlef
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Hide Drives and Partitions
Posted: Wed Aug 30, 2006 07:22 PM

Detlef,

>
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.
>

We are going to review it. Thanks for the feedback :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Hide Drives and Partitions
Posted: Thu Aug 31, 2006 09:30 PM
Sorry Ugo,
But now it not run ok
I SEE THE HARD DISK C

THIS IS THE CODE :
#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
Posts: 283
Joined: Sat Oct 15, 2005 06:40 AM
Hide Drives and Partitions
Posted: Fri Sep 01, 2006 09:10 AM
Silvio wrote:Sorry Ugo,
But now it not run ok
...


Dear Silvio,
test this code:
#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
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Hide Drives and Partitions
Posted: Fri Sep 01, 2006 09:34 AM

No it not run well
I see the hard disk

Best Regards, Saludos



Falconi Silvio
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Hide Drives and Partitions
Posted: Fri Sep 01, 2006 01:16 PM

As per tests with the code I have posted in my previous posting, the effect
is taking place only when the system is restarted.

I have tested it only in Windows 98 SE.

  • Ramesh Babu P
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Hide Drives and Partitions
Posted: Sat Sep 02, 2006 07:12 PM

Dear Ugo,
the code sample run but I must restart the system to effect it !!!

Is there an solution to NOTrestart the system?

Best Regards, Saludos



Falconi Silvio

Continue the discussion