PC SOFT
ONLINE REPOSITORY
FOR WINDEVWEBDEV AND WINDEV MOBILE

Home |  | Sign in | English US
Alterar o nome do computador via registro do Windows com direitos administrativos
Published by Boller
in the category Tools
New features



Description
Alterar o nome do computador via registro do Windows com direitos administrativos

// Summary: <specify the procedure action>
// Syntax:
//Api_RenameComputer (<Novo_Nome>)
//
// Parameters:
// Novo_Nome:
// Example:
// <Specify a usage example>
//
PROCEDURE Api_RenameComputer(Novo_Nome)

//COMPILAR COM DIREITOS ADMINISTRATIVOS MAXIMOS

OK1,OK2,OK3,OK4,OK5,OK6 is boolean

PC01,PC02,PC03,PC04,PC05,PC06 is string = ""

NovoNome is string = Novo_Nome

IF NovoNome = "" THEN
RETURN
ELSE

NovoNome = Upper( NoSpace( NoAccent(Novo_Nome) ) )

PATH01 is string = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName"
PATH02 is string = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName"
PATH03 is string = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\"
PATH04 is string = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters"

PC01 = RegistryQueryValue(PATH01, "ComputerName", True)

PC02 = RegistryQueryValue(PATH02, "ComputerName", True)

PC03 = RegistryQueryValue(PATH03, "Hostname", True)

PC04 = RegistryQueryValue(PATH03, "NV Hostname", True)

PC05 = RegistryQueryValue(PATH04, "Hostname", True)

PC06 = RegistryQueryValue(PATH04, "NV Hostname", True)

IF RegistryExist(registryModeAuto,PATH01,"ComputerName") = True THEN
//Info(1)
END

IF RegistrySetValue(registryModeAuto,PATH01,"ComputerName",NovoNome,registryTypeString) = True THEN
OK1 = True
END

IF RegistrySetValue(registryModeAuto,PATH02,"ComputerName",NovoNome,registryTypeString) = True THEN
OK2 = True
END

IF RegistrySetValue(registryModeAuto,PATH03,"Hostname",NovoNome,registryTypeString) = True THEN
OK3 = True
END

IF RegistrySetValue(registryModeAuto,PATH03,"NV Hostname",NovoNome,registryTypeString) = True THEN
OK4 = True
END

IF RegistrySetValue(registryModeAuto,PATH04,"Hostname",NovoNome,registryTypeString) = True THEN
OK5 = True
END

IF RegistrySetValue(registryModeAuto,PATH04,"NV Hostname",NovoNome,registryTypeString) = True THEN
OK6 = True
END

// Info(PC01,PC02,PC03,PC04,PC05,PC06)
// Info(OK1,OK2,OK3,OK4,OK5,OK6,ErrorInfo())

END

Illustrations, screen shots
none
none
User reviews
(To evaluate this resource, click 'Write a review')
No review or comment? Be the first one!