note 30044 deleted from ref.com by cmb
| From: | cmb@php.net | Date: | Sun, 30 Jun 2019 07:42:08 +0000 |
| Subject: | note 30044 deleted from ref.com by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211409@lists.php.net to get a copy of this message | ||
Note Submitter: alex at domini dot net
----
To manage the Windows Register at HKEY_LOCAL_MACHINE\SOFTWARE\ use these functions:
<?php
/**
* @return string
* @param aplicacio string
* @param nom string
* @desc Retorna el valor del registre HKEY_LOCAL_MACHINE\SOFTWARE\aplicacio\nom
*/
function rtv_registre($aplicacio, $nom)
{
Global $WshShell;
$registre = "HKEY_LOCAL_MACHINE\SOFTWARE\\" . $aplicacio . "\\" . $nom;
$valor = $WshShell->RegRead($registre);
return($valor);
}
/**
* @return string
* @param aplicacio string
* @param nom string
* @param valor string
* @param tipus string
* @desc Actualitza el valor del registre HKEY_LOCAL_MACHINE\SOFTWARE\aplicacio\nom
*/
function put_registre($aplicacio, $nom, $valor, $tipus="REG_SZ")
{
Global $WshShell;
$registre = "HKEY_LOCAL_MACHINE\SOFTWARE\\" . $aplicacio . "\\" . $nom;
$retorn = $WshShell->RegWrite($registre, $valor, $tipus);
return($retorn);
}
//
// Creem una instància del COM que ens serveix per
// accedir al registre de Windows, i la mantenim.
// D'aquesta manera millorem el rendiment.
$WshShell = new COM("WScript.Shell");
?>