Registry Mnemonics

From CometWiki

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
-
<h1>
+
'''Using the Windows Registry in your IB Programs'''
-
Using the Windows Registry in your IB Programs
+
'''<b>Introduction:</b>'''
-
</h1>
 
-
{| cellpadding=5 cellspacing=2
 
-
|-valign="top"
 
-
|<b>Introduction:</b>
 
-
|
 
The Registry Mnemonics allow you to create and manage Windows registry settings for your IB application.  Entries may be made under either HKEY_CURRENT_USER\Software or HKEY_LOCAL_MACHINE\Software.
The Registry Mnemonics allow you to create and manage Windows registry settings for your IB application.  Entries may be made under either HKEY_CURRENT_USER\Software or HKEY_LOCAL_MACHINE\Software.
-
|-valign="top"
+
 
-
| '''Syntax:'''
+
'''Syntax:'''
-
|
+
 
<b>Print (RegCreateKey = Type$, BaseKey$, SubKey$)
<b>Print (RegCreateKey = Type$, BaseKey$, SubKey$)
</b>
</b>
Line 32: Line 27:
Deletes the specified Name/Value pair.
Deletes the specified Name/Value pair.
-
|-valign="top"
+
'''Discussion:'''
-
| '''Discussion:'''
+
 
-
|
+
For all functions:  
For all functions:  
Type$ = "USER" or "SYSTEM" where "USER" translates as HKCU\Software; "SYSTEM" translates as HKLM\Software
Type$ = "USER" or "SYSTEM" where "USER" translates as HKCU\Software; "SYSTEM" translates as HKLM\Software
BaseKey$ = an EXISTING registry key which may contain "\" for subkeys, For example: "Signature Systems\DocMgr"
BaseKey$ = an EXISTING registry key which may contain "\" for subkeys, For example: "Signature Systems\DocMgr"
-
<!--
+
 
-
|-valign="top"
+
'''Example:'''
-
|'''Example:'''
+
 
Length 254 & Local RegKey$
Length 254 & Local RegKey$
 +
SET STARTUPBASEKEY$ = "MyCompanyName\MyAppName\Settings"
SET STARTUPBASEKEY$ = "MyCompanyName\MyAppName\Settings"
 +
SET REPORTSDIR$ = "RptDir"
SET REPORTSDIR$ = "RptDir"
print (RegCreateKey="USER","","MyCompanyName",0)
print (RegCreateKey="USER","","MyCompanyName",0)
 +
input Result$
input Result$
 +
print (RegCreateKey="USER","MyCompanyName","MyAppName",0)
print (RegCreateKey="USER","MyCompanyName","MyAppName",0)
 +
input Result$
input Result$
 +
print (RegCreateKey="USER","MyCompanyName\MyAppName","Settings",0)
print (RegCreateKey="USER","MyCompanyName\MyAppName","Settings",0)
 +
input Result$
input Result$
 +
print (RegCreateKey="USER",STARTUPBASEKEY$,UserName$,0)
print (RegCreateKey="USER",STARTUPBASEKEY$,UserName$,0)
-
input Result$
+
 
 +
input Result$
 +
 
if strip(Result$) ne "+OK" UseReg = false
if strip(Result$) ne "+OK" UseReg = false
RegKey$ = STARTUPBASEKEY$ + "\" + User$
RegKey$ = STARTUPBASEKEY$ + "\" + User$
 +
print (RegSetValue = "USER", RegKey$, REPORTSDIR$,RptDir$,1)
print (RegSetValue = "USER", RegKey$, REPORTSDIR$,RptDir$,1)
 +
input Result$
input Result$
RegKey$ = STARTUPBASEKEY$ + "\" + UserName$
RegKey$ = STARTUPBASEKEY$ + "\" + UserName$
 +
print (RegGetValue = "USER", RegKey$, REPORTSDIR$)
print (RegGetValue = "USER", RegKey$, REPORTSDIR$)
 +
input Result$
input Result$
 +
if sub(Result$,1,6) = "+OK 1:"
if sub(Result$,1,6) = "+OK 1:"
-
|
 
-
|}
 
-
-->
 
The Registry Mnemonics were introduced in Comet16/32 2011.
The Registry Mnemonics were introduced in Comet16/32 2011.

Revision as of 17:50, 7 November 2011

Using the Windows Registry in your IB Programs

Introduction:

The Registry Mnemonics allow you to create and manage Windows registry settings for your IB application. Entries may be made under either HKEY_CURRENT_USER\Software or HKEY_LOCAL_MACHINE\Software.

Syntax:

Print (RegCreateKey = Type$, BaseKey$, SubKey$) Creates a new registry entry.

Print (RegDeleteKey = Type$, BaseKey$, SubKey$) Deletes a registry entry and all of its name/value pairs.

Print (RegSetValue = Type$, BaseKey$, Name$, Value$, Type) Assigns the specified Name/Value pair of a given type.

Print (RegGetValue = Type$, BaseKey$, Name$) Returns the the Type and Value of the specified Name/Value pair.

Print (RegDeleteValue = Type$, BaseKey$, Name$) Deletes the specified Name/Value pair.

Discussion:

For all functions: Type$ = "USER" or "SYSTEM" where "USER" translates as HKCU\Software; "SYSTEM" translates as HKLM\Software BaseKey$ = an EXISTING registry key which may contain "\" for subkeys, For example: "Signature Systems\DocMgr"


Example:

Length 254 & Local RegKey$

SET STARTUPBASEKEY$ = "MyCompanyName\MyAppName\Settings"

SET REPORTSDIR$ = "RptDir"

print (RegCreateKey="USER","","MyCompanyName",0)

input Result$

print (RegCreateKey="USER","MyCompanyName","MyAppName",0)

input Result$

print (RegCreateKey="USER","MyCompanyName\MyAppName","Settings",0)

input Result$

print (RegCreateKey="USER",STARTUPBASEKEY$,UserName$,0)

input Result$

if strip(Result$) ne "+OK" UseReg = false

RegKey$ = STARTUPBASEKEY$ + "\" + User$

print (RegSetValue = "USER", RegKey$, REPORTSDIR$,RptDir$,1)

input Result$

RegKey$ = STARTUPBASEKEY$ + "\" + UserName$

print (RegGetValue = "USER", RegKey$, REPORTSDIR$)

input Result$

if sub(Result$,1,6) = "+OK 1:"


The Registry Mnemonics were introduced in Comet16/32 2011.

Personal tools