Adding a register key to the Windows register - SOLVED

Adding a register key to the Windows register - SOLVED

Postby driessen » Mon Jul 10, 2023 10:54 pm

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.
Last edited by driessen on Fri Jul 14, 2023 7:56 am, edited 1 time in total.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Adding a register key to the Windows register

Postby Antonio Linares » Tue Jul 11, 2023 6:33 am

Dear Michel,

Please try this and let me know what you get:

Code: Select all  Expand view
#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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Adding a register key to the Windows register

Postby driessen » Tue Jul 11, 2023 9:27 am

Antonio,
Thank you for your message.
Unfortunately, the register key is not added.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Adding a register key to the Windows register

Postby Antonio Linares » Tue Jul 11, 2023 10:06 am

Dear Michel,

what is shown from the MsgInfo() ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Adding a register key to the Windows register

Postby driessen » Tue Jul 11, 2023 11:37 am

Only a backslash
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Adding a register key to the Windows register

Postby Antonio Linares » Tue Jul 11, 2023 4:51 pm

Dear Michel,

Please use Microsoft regedit.exe and try to locate it manually
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Adding a register key to the Windows register

Postby Jimmy » Tue Jul 11, 2023 5:03 pm

hi,
driessen wrote:Unfortunately, the register key is not added.

have you start it "as Admin" :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Adding a register key to the Windows register

Postby driessen » Tue Jul 11, 2023 5:52 pm

Antonio,

To find the registry key manually is no problem.

Jimmy,

I am administrator.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Adding a register key to the Windows register

Postby Antonio Linares » Tue Jul 11, 2023 6:51 pm

Dear Michel,

Do you have the entry "DisableWarningOnIncludeFieldsUpdate" already created ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Adding a register key to the Windows register

Postby driessen » Tue Jul 11, 2023 6:58 pm

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.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Adding a register key to the Windows register

Postby Otto » Tue Jul 11, 2023 9:22 pm

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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: Adding a register key to the Windows register

Postby Marc Venken » Tue Jul 11, 2023 9:45 pm

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/viewtopic.php?f=3&t=41666#p249622

Code: Select all  Expand view

   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) ;
}

 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Adding a register key to the Windows register

Postby karinha » Wed Jul 12, 2023 2:24 am

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7826
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Adding a register key to the Windows register

Postby alerchster » Wed Jul 12, 2023 7:29 am

Code: Select all  Expand view
// 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

//---------------------------------------------------------------------------//
Regards

Ing. Anton Lerchster
User avatar
alerchster
 
Posts: 93
Joined: Mon Oct 22, 2012 4:43 pm

Re: Adding a register key to the Windows register

Postby driessen » Wed Jul 12, 2023 9:18 am

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.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests