HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppWare.Project\shell\Open\Commandand the value I need to read is:
Name Type Data (Default) REG_SZ c:\Program Files\AAA\AppWare\AppWare.exe %1(The above is the only item in the Command Folder)
#Define HKEY_CLASSES_ROOT -2147483648 #Define HKEY_CURRENT_USER -2147483647 #Define HKEY_LOCAL_MACHINE -2147483646 #Define HKEY_USERS -2147483645 #Define REG_SZ 1 && String #Define REG_BINARY 3 && Binary data #Define REG_DWORD 4 && 32bits int #Define ERROR_SUCCESS 0 && OK LOCAL nKey, cSubKey, cValue, cValueRead *--Here is the hive nkey = HKEY_LOCAL_MACHINE cSubKey = "\SOFTWARE\Classes\AppWare.Project\shell\Open\Command\" cValue = "" && What goes here? cValueRead = ReadREG_SZ(nKey, cSubKey, cValue) IF (EMPTY(cValueRead)) THEN =MESSAGEBOX("Function Not Successful.") ELSE ? cValueRead *RETURN cValueRead =MESSAGEBOX("Function Successful.") ENDIF FUNCTION ReadREG_SZ * This function reads a REG_SZ value from the registry. If successful, * it will return the value read. If not successful, it will return an empty string. PARAMETERS nKey, cSubKey, cValue * nKey The root key to open. It can be any of the constants defined below. * #DEFINE HKEY_CLASSES_ROOT -2147483648 * #DEFINE HKEY_CURRENT_USER -2147483647 * #DEFINE HKEY_LOCAL_MACHINE -2147483646 * #DEFINE HKEY_USERS -2147483645 * cSubKey The SubKey to open. * cValue The value that is going to be read. * Constants that are needed for Registry functions #DEFINE REG_SZ 1 * WIN 32 API functions that are used DECLARE Integer RegOpenKey IN Win32API ; Integer nHKey, String @cSubKey, Integer @nResult DECLARE Integer RegQueryValueEx IN Win32API ; Integer nHKey, String lpszValueName, Integer dwReserved,; Integer @lpdwType, String @lpbData, Integer @lpcbData DECLARE Integer RegCloseKey IN Win32API Integer nHKey * Local variables used LOCAL nErrCode && Error Code returned from Registry functions LOCAL nKeyHandle && Handle to Key that is opened in the Registry LOCAL lpdwValueType && Type of Value that we are looking for LOCAL lpbValue && The data stored in the value LOCAL lpcbValueSize && Size of the variable LOCAL lpdwReserved && Reserved Must be 0 * Initialize the variables nKeyHandle = 0 lpdwReserved = 0 lpdwValueType = REG_SZ lpbValue = "" nErrCode = RegOpenKey(nKey, cSubKey, @nKeyHandle) * If the error code isn't 0, then the key doesn't exist or can't be opened. IF (nErrCode # 0) THEN RETURN "" ENDIF lpcbValueSize = 1 * Get the size of the data in the value nErrCode=RegQueryValueEx(nKeyHandle, cValue, lpdwReserved, @lpdwValueType, @lpbValue, @lpcbValueSize) * Make the buffer big enough lpbValue = SPACE(lpcbValueSize) nErrCode=RegQueryValueEx(nKeyHandle, cValue, lpdwReserved, @lpdwValueType, @lpbValue, @lpcbValueSize) =RegCloseKey(nKeyHandle) IF (nErrCode # 0) THEN RETURN "" ENDIF lpbValue = LEFT(lpbValue, lpcbValueSize - 1) RETURN lpbValue * End of Code