FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Adding a register key to the Windows register - SOLVED
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Adding a register key to the Windows register - SOLVED
Posted: 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.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 06:33 AM
Dear Michel,

Please try this and let me know what you get:
Code (fw): Select all Collapse
#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
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 09: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 10:06 AM

Dear Michel,

what is shown from the MsgInfo() ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 11:37 AM

Only a backslash

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 04:51 PM

Dear Michel,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 05:03 PM
hi,
driessen wrote:Unfortunately, the register key is not added.
have you start it "as Admin" :?:
greeting,

Jimmy
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 05: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 06:51 PM

Dear Michel,

Do you have the entry "DisableWarningOnIncludeFieldsUpdate" already created ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 06: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 09: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

Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Adding a register key to the Windows register
Posted: Tue Jul 11, 2023 09: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 (fw): Select all Collapse
   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.08 with Harbour
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Adding a register key to the Windows register
Posted: Wed Jul 12, 2023 02:24 AM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 137
Joined: Mon Oct 22, 2012 04:43 PM
Re: Adding a register key to the Windows register
Posted: Wed Jul 12, 2023 07:29 AM
Code (fw): Select all Collapse
// 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
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Adding a register key to the Windows register
Posted: Wed Jul 12, 2023 09: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773