Get registry key values ​​using InstallShield

zhaozj2021-02-16  49

/ * Written by Jaron, 2002-07-03 * // * Original: Jiangdu Information Network Forum http://www.jiangdu.net/bbs * // * Reprint Please indicate the source and keep this copyright information * // * Welcome to SiteManager website management system http://sitemanager.cnzone.net * /

Use nvType = REGDB_NUMBER; szKey = "// SYSTEM // CurrentControlSet // Servic es // {58ECC408-265E-4342-9DA4-70BF1796D81D} // Parameters // Tcpip"; szName = "EnableDHCP" RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE); RegDBGetKeyvalueEx (szKey, szName, nvType, svvalue, nvSize); if (svvalue = "1") then szName = "DhcpIPAddress"; else szName = "IPAddress"; endif; nvType = REGDB_STRING; RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE); RegDBGetKeyvalueEx (szKey, szName , NVTYPE, SVVALUE, NVSIZE);

The above program is actually how to get the key value in the registry, if used to get IP, the above {58ECC408-265E-4342-9DA4-70BF1796D81D} is my machine on, you and I might GUID is not the same, but you can also be obtained from the following registry: HKEY_LOCAL_MACHINE / SYSTEM / CurrentControlSet / Services / Tcpip / Parameters / Adapters HKEY_LOCAL_MACHINE / SYSTEM / CurrentControlSet / Services / Tcpip / Parameters / Interfaces HKEY_LOCAL_MACHINE / SYSTEM / CURRENTCONTROLSET / SERVICES / EL90X1 / parameters / TCPIP (if present)

Similarly, if you want to get your hostname, you can by the following procedure: RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE); RegDBGetKeyvalueEx ( "SYSTEM // CurrentControlSet // Control // ComputerName // ComputerName", "ComputerName", nvType, szServerPort, nvSize) ;

Everyone can obtain other key values ​​of the registry through the above examples.

转载请注明原文地址:https://www.9cbs.com/read-27156.html

New Post(0)