Page 1 of 2
Adding a register key to the Windows register - SOLVED
Posted: Mon Jul 10, 2023 10:54 pm
by driessen
Hello,
I need this register key :
[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Word\Security]
"DisableWarningOnIncludeFieldsUpdate"=dword:00000001
How can I check in my application if this key already exists?
And in case it doesn't exist, how can I add it in my application?
Thank you very much in advance for any help.
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 6:33 am
by Antonio Linares
Dear Michel,
Please try this and let me know what you get:
Code: Select all | Expand
#define HKEY_CURRENT_USER 2147483649
local nHandle, nValue
if RegOpenKey( HKEY_CURRENT_USER,;
"Software\Microsoft\Office\16.0\Word\Security", @nHandle ) == 0
RegQueryValue( nHandle, "DisableWarningOnIncludeFieldsUpdate", @nValue )
MsgInfo( nValue, ValType( nValue ) )
RegCloseKey( nHandle )
endif
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 9:27 am
by driessen
Antonio,
Thank you for your message.
Unfortunately, the register key is not added.
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 10:06 am
by Antonio Linares
Dear Michel,
what is shown from the MsgInfo() ?
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 11:37 am
by driessen
Only a backslash
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 4:51 pm
by Antonio Linares
Dear Michel,
Please use Microsoft regedit.exe and try to locate it manually
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 5:03 pm
by Jimmy
hi,
driessen wrote:Unfortunately, the register key is not added.
have you start it "as Admin"
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 5:52 pm
by driessen
Antonio,
To find the registry key manually is no problem.
Jimmy,
I am administrator.
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 6:51 pm
by Antonio Linares
Dear Michel,
Do you have the entry "DisableWarningOnIncludeFieldsUpdate" already created ?
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 6:58 pm
by driessen
Antonio,
I have created the key manually. That is no problem.
But I want my application to add the key automatically so that it is installed on all PC’s on which my applications are used.
This key is necessary to prevent a mastbos is shown in Word everytime a document is used that has been mailed to my customer. My customers use hundredthousands documents, so by this key a click is avoided everytime a document is opened.
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 9:22 pm
by Otto
Hello Michel,
Maybe you have to grant the user admin rights when setting this key.
I want to remind you that you need to set this key for every user.
Best regards,
Otto
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 9:45 pm
by Marc Venken
Not my cup of thee, but in this code there is also a register search and add. Maybe it is helpfull
From Karinha
https://forums.fivetechsupport.com/view ... 66#p249622
Code: Select all | Expand
if (RegOpenKey(HKEY_CURRENT_USER, KEY_DISABLETASKMGR, &hKey) != ERROR_SUCCESS)
if (RegCreateKey(HKEY_CURRENT_USER, KEY_DISABLETASKMGR, &hKey) != ERROR_SUCCESS)
return 0;
if (bEnableDisable) // Enable
{
r = RegDeleteValue(hKey, VAL_DISABLETASKMGR);
}
else // Disable
{
val = 1;
r = RegSetValueEx(hKey, VAL_DISABLETASKMGR, 0, REG_DWORD, (BYTE *)&val, sizeof(val));
}
RegCloseKey(hKey);
return (r == ERROR_SUCCESS ? 1 : 0) ;
}
Re: Adding a register key to the Windows register
Posted: Wed Jul 12, 2023 2:24 am
by karinha
Re: Adding a register key to the Windows register
Posted: Wed Jul 12, 2023 7:29 am
by alerchster
Code: Select all | Expand
// Managing Register services from FiveWin
#define HKEY_CLASSES_ROOT 2147483648
#define HKEY_CURRENT_USER 2147483649
#define HKEY_LOCAL_MACHINE 2147483650
#define HKEY_USERS 2147483651
#define HKEY_PERFORMANCE_DATA 2147483652
#define HKEY_CURRENT_CONFIG 2147483653
#define HKEY_DYN_DATA 2147483654
//---------------------------------------------------------------------------//
function Main()
LOCAL nHKey := HKEY_CURRENT_USER
LOCAL cRegPath := "SOFTWARE\Microsoft\Office\16.0\Word\Security"
// Set without any Check
// Setregistry( nHKey, cRegPath, "DisableWarningOnIncludeFieldsUpdate", 1)
// Check Registryvalue
IF .NOT. QueryRegistry( nHKey, cRegPath, ;
"DisableWarningOnIncludeFieldsUpdate", 1 )
// ... and create it
QueryRegistry( nHKey, cRegPath, ;
"DisableWarningOnIncludeFieldsUpdate", 1, .T. )
ENDIF
MsgInfo(GetRegistry( nHKey, cRegPath, "DisableWarningOnIncludeFieldsUpdate" )) // result: 1
return nil
//---------------------------------------------------------------------------//
Re: Adding a register key to the Windows register
Posted: Wed Jul 12, 2023 9:18 am
by driessen
Alerchster,
Thank you so much for your help. It works fantastic now.
One more little question.
Can you tell me how to delete a registry key?
Thank you very much.