1. PRASHANT NIRGUN
  2. PowerBuilder
  3. Sunday, 11 September 2022 06:10 AM UTC

Hi

This is Prashant here I am using Powerbuilder 12.5.2 Classical, Windows 7 64 Bit. I need to update value of type REG_SZ, I can read it using RegString! but failed to write the value. My code is as following.

```

String ls_key, ls_val,ls_bin
int li_rtn

ls_key ="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Redirected Port\Ports\RPT1:"

RegistryGet( ls_key, "Arguments", RegString!, ls_val)
Messagebox("before info",ls_val)
ls_val = '@D:\myjpgfiles\jpgwriter.txt -c "<</Orientation 2>> setpagedevice" -'
//ls_bin = '2740443a5c6d796a706766696c65735c6a70677772697465722e747874202d6320223c3c2f4f7269656e746174696f6e20323e3e207365747061676564657669636522202d'
//Argument type is REG_SZ
li_rtn = RegistrySet( ls_key, "Arguments", RegString!, ls_val)

IF li_rtn = -1 THEN
Messagebox("Error","Could not set registry")
ELSE
RegistryGet( ls_key, "Arguments", RegMultiString!, ls_val)
Messagebox("after info",ls_val )
END IF

```

Accepted Answer
Andreas Mykonios Accepted Answer Pending Moderation
  1. Sunday, 11 September 2022 12:02 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi.

I do believe you are using the right command. The only problem that I see is that you need to write to HKEY_LOCAL_MACHINE which should require admin rights. Have you tried to run your executable as administrator (or the IDE if you are running this command from PB)?

Andreas.

Comment
  1. Chris Pollach @Appeon
  2. Sunday, 11 September 2022 13:15 PM UTC
Correct... Admin rights would be required.
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.