Using Win32 functions in Visual FoxPro Image Gallery
Registry
..msdn
GetPrivateProfileSectionNames
GetPrivateProfileString
GetProfileString
RegCloseKey
RegCreateKeyEx
RegDeleteKey
RegDeleteValue
RegEnumKey
RegEnumKeyEx
RegEnumValue
RegOpenKeyEx
RegQueryInfoKey
RegQueryValueEx
RegSaveKey
RegSetValueEx
SHEnumKeyEx
SHRegCloseUSKey
SHRegEnumUSKey
SHRegOpenUSKey
WritePrivateProfileSection
WritePrivateProfileString
Code examples:
Class library providing access to the System Registry
How to obtain Content-Type value for a file type from the System Registry
How to save registry key including its subkeys and values to a file
Obtaining current Internet Explorer browser version and UserAgent
Reading VFP settings from the Windows Registry
Saving local machine ODBC Registry Entries to XML file
RegOpenKeyEx
..msdn    Add comment     W32 Constants      Translate this page
The RegOpenKeyEx function opens the specified registry key.
Code examples:
Class library providing access to the System Registry
Saving local machine ODBC Registry Entries to XML file
Obtaining current Internet Explorer browser version and UserAgent
How to obtain Content-Type value for a file type from the System Registry
Reading VFP settings from the Windows Registry
How to save registry key including its subkeys and values to a file
Declaration:
LONG RegOpenKeyEx(
  HKEY hKey,         // handle to open key
  LPCTSTR lpSubKey,  // subkey name
  DWORD ulOptions,   // reserved
  REGSAM samDesired, // security access mask
  PHKEY phkResult    // handle to open key
);
FoxPro declaration:
DECLARE INTEGER RegOpenKeyEx IN advapi32;
    INTEGER   hKey,;
    STRING    lpSubKey,;
    INTEGER   ulOptions,;
    INTEGER   samDesired,;
    INTEGER @ phkResult
Parameters:
hKey
[in] Handle to a currently open key or a predefined reserved handle value.

lpSubKey
[in] Pointer to a null-terminated string containing the name of the subkey to open.

ulOptions
Reserved; must be zero.

samDesired
[in] An access mask that specifies the desired access rights to the key.

phkResult
[out] Pointer to a variable that receives a handle to the opened key.
Return value:
If the function succeeds, the return value is 0 (ERROR_SUCCESS). Otherwise, the return value is a nonzero error code.
My comment:
When you no longer need the handle returned by this function, call the RegCloseKey function to close it.

* * *
June 2, 2010. Contributed by Igor Nikiforov:

Under Windows 2008 Server 64-bit, a call to RegOpenKeyEx returns error code 2 (ERROR_FILE_NOT_FOUND) for some keys.

Example:
RegOpenKeyEx(HKEY_LOCAL_MACHINE ,;
        [SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\ ... ;
        ... \InstallProperties], 0, ;
        KEY_READ, @hKey)

Changing samDesired input parameter from KEY_READ to ( KEY_READ | KEY_WOW64_64KEY ) resolves the issue.

RegOpenKeyEx(HKEY_LOCAL_MACHINE , ;
        [SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\ ... ;
        ... \InstallProperties], 0, ;
        BITOR(KEY_READ, KEY_WOW64_64KEY), @hKey)

Find more in Registry Key Security and Access Rights article on MSDN web site.
Word Index links for the RegOpenKeyEx :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2001-09-03 12:00:00
Modified: 2010-06-02 12:11:40
Visited in last 7 days: 35
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.37), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.81.178.153)
11 sec.Function: 'GetKBCodePage'
23 sec.Function: 'ConnectToPrinterDlg'
34 sec.Function: 'WinHttpOpenRequest'
46 sec.Function: 'ImageList_Remove'
57 sec.Updates
1.13 min.
Function group: 'Remote Application Programming (RAPI)'
1.33 min.Function: 'SetWindowRgn'
1.52 min.Function: 'OpenWaitableTimer'
1.7 min.Function: 'GetAdaptersAddresses'
1.92 min.Function: 'PrintDlg'
Google
Advertise here!