I've written a little wrapper program to fire up and set the console font size
for my PBCC application. For some reason, I cannot seem to write rData successfully to the registry. What am I doing wrong here? It must be simple and I just can't see it.
My installer program performs the task perfectly when give it
0x000c0005 as a value to write, so I'm puzzled. I'm sure I'll be
embarrassed when someone illumines the problem.
-----------------------
lpKey = %HKEY_CURRENT_USER
cMainKey = "Console"
Key = "FontSize"
FUNCTION SetConsoleRegValue(lpKey AS LONG,BYVAL cMainKey AS STRING, BYVAL Key AS STRING) AS LONG
ON ERROR RESUME NEXT
LOCAL hKey AS LONG
LOCAL Result AS LONG
Local rData As String
IF Key = "*" THEN Key = CHR$(0,0)
IF RegCreateKeyEx(lpKey, cMainKey + CHR$(0),0, "", %REG_OPTION_NON_VOLATILE, _
%KEY_ALL_ACCESS, BYVAL %NULL, hKey, Result) <> %ERROR_SUCCESS THEN
FUNCTION = 0
EXIT FUNCTION
END IF
rData = "0x000c0005" + chr$(0)
RegSetValueEx hKey, Key+CHR$(0), 0, %REG_DWORD, ByVal StrPtr(rData), 11
RegCloseKey hKey
FUNCTION = 0
END Function
for my PBCC application. For some reason, I cannot seem to write rData successfully to the registry. What am I doing wrong here? It must be simple and I just can't see it.
My installer program performs the task perfectly when give it
0x000c0005 as a value to write, so I'm puzzled. I'm sure I'll be
embarrassed when someone illumines the problem.
-----------------------
lpKey = %HKEY_CURRENT_USER
cMainKey = "Console"
Key = "FontSize"
FUNCTION SetConsoleRegValue(lpKey AS LONG,BYVAL cMainKey AS STRING, BYVAL Key AS STRING) AS LONG
ON ERROR RESUME NEXT
LOCAL hKey AS LONG
LOCAL Result AS LONG
Local rData As String
IF Key = "*" THEN Key = CHR$(0,0)
IF RegCreateKeyEx(lpKey, cMainKey + CHR$(0),0, "", %REG_OPTION_NON_VOLATILE, _
%KEY_ALL_ACCESS, BYVAL %NULL, hKey, Result) <> %ERROR_SUCCESS THEN
FUNCTION = 0
EXIT FUNCTION
END IF
rData = "0x000c0005" + chr$(0)
RegSetValueEx hKey, Key+CHR$(0), 0, %REG_DWORD, ByVal StrPtr(rData), 11
RegCloseKey hKey
FUNCTION = 0
END Function
Comment