LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Differences between Microsoft RegSetValue and NI RegWriteString

Solved!
Go to solution

I am trying to write the registry using the function RegWriteString as follows

 

iLocalFail = RegWriteString(REGKEY_HKCU, "Software\\Custom PDF Printer\\OutputFile", "OutputFile", caFilenameWithPathInfo);  I get a Default and OutputFile under the Custom PDF Printer\Outputfile key, see attachment NI Write.jpg.

 


When I use the Microsoft RegCreateKeyEx and RegSetValue functions

 

lReturnValue = RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Custom PDF Printer", 0, NULL , REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKeyHandle, &ulReturnValue);

 

lReturnValue = RegSetValue(hKeyHandle, "OutputFile", REG_SZ, caFilenameWithPathInfo, strlen(caFilenameWithPathInfo));

 

I only get the Default value set to the filename, see attachment Microsoft Write.jpg.

 

The program that I am setting the registry for wants the Microsoft results.  The NI functions make the program cleaner, but why are the results different.

Download All
0 Kudos
Message 1 of 3
(4,022 Views)
Solution
Accepted by topic author Paul_Knight_Lockheed_Mart

Hey Paul - 

 

To get what you're looking for, you just need to pass NULL to the "ValueName" parameter:

 

NickB11-17, 16_53_02.png


NickB

National Instruments 

0 Kudos
Message 2 of 3
(4,010 Views)
Thanks, that works
0 Kudos
Message 3 of 3
(3,996 Views)