Skip to main content

[Migrated content. Thread originally posted on 12 April 2006]

I have just stated to look at this and want to set various registry keys. It looked easy in the manual, but I cant even get started. The following code

77 subkey-handle usage is handle.
77 subkey-handle1 usage is handle.
LINKAGE SECTION.
*================
copy "c:\\am2000\\amaster\\copies\\COMMON.DTA".
SCREEN SECTION.
*==============
PROCEDURE DIVISION USING LNK-DTA.
*================================
DECLARATIVES.
END DECLARATIVES.
A-MAIN SECTION.
*==============
A000.
*----
Call "DISPLAY_REG_OPEN_KEY"
USING HKEY_CURRENT_USER
"Software"
SUBKEY-HANDLE,
GIVING return-code.
Call "DISPLAY_REG_CREATE_KEY"
USING HKEY_CURRENT_USER
"Software\\AM PDF Printer\\BypassSaveAs"
SUBKEY-HANDLE1
GIVING return-CODE.


always returns a non zero value in return code, and does not open the 'Software' key under HKEY_CURRENT_USER , nor does it create the key "Software\\AM PDF Printer\\BypassSaveAs" .

What is the obvious thing I am doing wrong?

Keith.:confused:

[Migrated content. Thread originally posted on 12 April 2006]

I have just stated to look at this and want to set various registry keys. It looked easy in the manual, but I cant even get started. The following code

77 subkey-handle usage is handle.
77 subkey-handle1 usage is handle.
LINKAGE SECTION.
*================
copy "c:\\am2000\\amaster\\copies\\COMMON.DTA".
SCREEN SECTION.
*==============
PROCEDURE DIVISION USING LNK-DTA.
*================================
DECLARATIVES.
END DECLARATIVES.
A-MAIN SECTION.
*==============
A000.
*----
Call "DISPLAY_REG_OPEN_KEY"
USING HKEY_CURRENT_USER
"Software"
SUBKEY-HANDLE,
GIVING return-code.
Call "DISPLAY_REG_CREATE_KEY"
USING HKEY_CURRENT_USER
"Software\\AM PDF Printer\\BypassSaveAs"
SUBKEY-HANDLE1
GIVING return-CODE.


always returns a non zero value in return code, and does not open the 'Software' key under HKEY_CURRENT_USER , nor does it create the key "Software\\AM PDF Printer\\BypassSaveAs" .

What is the obvious thing I am doing wrong?

Keith.:confused:
Keith,

I notice you are using the "DISPLAY_" syntax for checking the windows registry. This is the syntax for thin client, so if you are not using thin client, you should remove the "DISPLAY_" and it should work.

Rob

[Migrated content. Thread originally posted on 12 April 2006]

I have just stated to look at this and want to set various registry keys. It looked easy in the manual, but I cant even get started. The following code

77 subkey-handle usage is handle.
77 subkey-handle1 usage is handle.
LINKAGE SECTION.
*================
copy "c:\\am2000\\amaster\\copies\\COMMON.DTA".
SCREEN SECTION.
*==============
PROCEDURE DIVISION USING LNK-DTA.
*================================
DECLARATIVES.
END DECLARATIVES.
A-MAIN SECTION.
*==============
A000.
*----
Call "DISPLAY_REG_OPEN_KEY"
USING HKEY_CURRENT_USER
"Software"
SUBKEY-HANDLE,
GIVING return-code.
Call "DISPLAY_REG_CREATE_KEY"
USING HKEY_CURRENT_USER
"Software\\AM PDF Printer\\BypassSaveAs"
SUBKEY-HANDLE1
GIVING return-CODE.


always returns a non zero value in return code, and does not open the 'Software' key under HKEY_CURRENT_USER , nor does it create the key "Software\\AM PDF Printer\\BypassSaveAs" .

What is the obvious thing I am doing wrong?

Keith.:confused:
Rob

Sorry - I should have said I had tried both versions of the call. Both give a return-code = 1. - i.e. fail.

Keith

[Migrated content. Thread originally posted on 12 April 2006]

I have just stated to look at this and want to set various registry keys. It looked easy in the manual, but I cant even get started. The following code

77 subkey-handle usage is handle.
77 subkey-handle1 usage is handle.
LINKAGE SECTION.
*================
copy "c:\\am2000\\amaster\\copies\\COMMON.DTA".
SCREEN SECTION.
*==============
PROCEDURE DIVISION USING LNK-DTA.
*================================
DECLARATIVES.
END DECLARATIVES.
A-MAIN SECTION.
*==============
A000.
*----
Call "DISPLAY_REG_OPEN_KEY"
USING HKEY_CURRENT_USER
"Software"
SUBKEY-HANDLE,
GIVING return-code.
Call "DISPLAY_REG_CREATE_KEY"
USING HKEY_CURRENT_USER
"Software\\AM PDF Printer\\BypassSaveAs"
SUBKEY-HANDLE1
GIVING return-CODE.


always returns a non zero value in return code, and does not open the 'Software' key under HKEY_CURRENT_USER , nor does it create the key "Software\\AM PDF Printer\\BypassSaveAs" .

What is the obvious thing I am doing wrong?

Keith.:confused:
Rob
Just checked the manual again, it does seem to suggest that the DISPLAY_* call is the one to use for standard run time system, either thin client or not. Do you think this is incorrect?

It States:

"Use the DISPLAY_REG_* name when you want to work with the registry on the display host (this is the local host when the application is run with a standard runtime, and the thin client when the application is run with the thin client)"...........


Keith

[Migrated content. Thread originally posted on 12 April 2006]

I have just stated to look at this and want to set various registry keys. It looked easy in the manual, but I cant even get started. The following code

77 subkey-handle usage is handle.
77 subkey-handle1 usage is handle.
LINKAGE SECTION.
*================
copy "c:\\am2000\\amaster\\copies\\COMMON.DTA".
SCREEN SECTION.
*==============
PROCEDURE DIVISION USING LNK-DTA.
*================================
DECLARATIVES.
END DECLARATIVES.
A-MAIN SECTION.
*==============
A000.
*----
Call "DISPLAY_REG_OPEN_KEY"
USING HKEY_CURRENT_USER
"Software"
SUBKEY-HANDLE,
GIVING return-code.
Call "DISPLAY_REG_CREATE_KEY"
USING HKEY_CURRENT_USER
"Software\\AM PDF Printer\\BypassSaveAs"
SUBKEY-HANDLE1
GIVING return-CODE.


always returns a non zero value in return code, and does not open the 'Software' key under HKEY_CURRENT_USER , nor does it create the key "Software\\AM PDF Printer\\BypassSaveAs" .

What is the obvious thing I am doing wrong?

Keith.:confused:
Keith,

You may be right about the thin/non-thin part. You may want to try REG_OPEN_KEY_EX instead of REG_OPEN_KEY - especially if on a newer operating system.

This is what I use in my programs.

Rob

[Migrated content. Thread originally posted on 12 April 2006]

I have just stated to look at this and want to set various registry keys. It looked easy in the manual, but I cant even get started. The following code

77 subkey-handle usage is handle.
77 subkey-handle1 usage is handle.
LINKAGE SECTION.
*================
copy "c:\\am2000\\amaster\\copies\\COMMON.DTA".
SCREEN SECTION.
*==============
PROCEDURE DIVISION USING LNK-DTA.
*================================
DECLARATIVES.
END DECLARATIVES.
A-MAIN SECTION.
*==============
A000.
*----
Call "DISPLAY_REG_OPEN_KEY"
USING HKEY_CURRENT_USER
"Software"
SUBKEY-HANDLE,
GIVING return-code.
Call "DISPLAY_REG_CREATE_KEY"
USING HKEY_CURRENT_USER
"Software\\AM PDF Printer\\BypassSaveAs"
SUBKEY-HANDLE1
GIVING return-CODE.


always returns a non zero value in return code, and does not open the 'Software' key under HKEY_CURRENT_USER , nor does it create the key "Software\\AM PDF Printer\\BypassSaveAs" .

What is the obvious thing I am doing wrong?

Keith.:confused:
TRIED THIS:

Call "REG_OPEN_KEY_EX"
USING HKEY_CURRENT_USER
"Software"
KEY_ALL_ACCESS
SUBKEY-HANDLE,
GIVING return-code.
Call "REG_CREATE_KEY_EX"
USING HKEY_CURRENT_USER
"Software\\AM PDF Printer\\BypassSaveAs"
"Amaster"
SUBKEY-HANDLE1
REG_OPTION_NON_VOLATILE
DISPOSITION
KEY_ALL_ACCESS
GIVING return-CODE.

SAME RESULT - RETURNS VALUE 1 AND FAILS BOTH CALLS.

I cant help feeling I am doing something stupid - but I cannot see what?

Keith

[Migrated content. Thread originally posted on 12 April 2006]

I have just stated to look at this and want to set various registry keys. It looked easy in the manual, but I cant even get started. The following code

77 subkey-handle usage is handle.
77 subkey-handle1 usage is handle.
LINKAGE SECTION.
*================
copy "c:\\am2000\\amaster\\copies\\COMMON.DTA".
SCREEN SECTION.
*==============
PROCEDURE DIVISION USING LNK-DTA.
*================================
DECLARATIVES.
END DECLARATIVES.
A-MAIN SECTION.
*==============
A000.
*----
Call "DISPLAY_REG_OPEN_KEY"
USING HKEY_CURRENT_USER
"Software"
SUBKEY-HANDLE,
GIVING return-code.
Call "DISPLAY_REG_CREATE_KEY"
USING HKEY_CURRENT_USER
"Software\\AM PDF Printer\\BypassSaveAs"
SUBKEY-HANDLE1
GIVING return-CODE.


always returns a non zero value in return code, and does not open the 'Software' key under HKEY_CURRENT_USER , nor does it create the key "Software\\AM PDF Printer\\BypassSaveAs" .

What is the obvious thing I am doing wrong?

Keith.:confused:
Attached is a small sample program that just opens the Software subkey of the HKEY_CURRENT_USER key. It works for me - gives a return value of 0. Try it and see if it works for you.

Jim

[Migrated content. Thread originally posted on 12 April 2006]

I have just stated to look at this and want to set various registry keys. It looked easy in the manual, but I cant even get started. The following code

77 subkey-handle usage is handle.
77 subkey-handle1 usage is handle.
LINKAGE SECTION.
*================
copy "c:\\am2000\\amaster\\copies\\COMMON.DTA".
SCREEN SECTION.
*==============
PROCEDURE DIVISION USING LNK-DTA.
*================================
DECLARATIVES.
END DECLARATIVES.
A-MAIN SECTION.
*==============
A000.
*----
Call "DISPLAY_REG_OPEN_KEY"
USING HKEY_CURRENT_USER
"Software"
SUBKEY-HANDLE,
GIVING return-code.
Call "DISPLAY_REG_CREATE_KEY"
USING HKEY_CURRENT_USER
"Software\\AM PDF Printer\\BypassSaveAs"
SUBKEY-HANDLE1
GIVING return-CODE.


always returns a non zero value in return code, and does not open the 'Software' key under HKEY_CURRENT_USER , nor does it create the key "Software\\AM PDF Printer\\BypassSaveAs" .

What is the obvious thing I am doing wrong?

Keith.:confused:
Jim

Thanks - that has sorted it - I think my definition of the return code and handles was wrong. Now works just perfect.
Regards
Keith