0

The purpose is to firstly make a modification in the registry for my touchpad and then apply them by sending a WM_SETTINGCHANGE broadcast.

Here is the link I have been looking on mostly:

https://learn.microsoft.com/en-us/windows/win32/winmsg/wm-settingchange

The registry I wanted to modify is:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\PrecisionTouchPad\TapsEnabled

How do I resolve this?

The platform is windows and the programming language is preferred c++.

Snakehater
  • 145
  • 1
  • 9

1 Answers1

3

As stated in the documentation you linked to:

Applications should send WM_SETTINGCHANGE to all top-level windows when they make changes to system parameters. (This message cannot be sent directly to a window.) To send the WM_SETTINGCHANGE message to all top-level windows, use the SendMessageTimeout function with the hwnd parameter set to HWND_BROADCAST.

...

Parameters

wParam

...

When an application sends this message, this parameter must be NULL.

lParam

When the system sends this message as a result of a SystemParametersInfo call, lParam is a pointer to a string that indicates the area containing the system parameter that was changed. This parameter does not usually indicate which specific system parameter changed. (Note that some applications send this message with lParam set to NULL.) In general, when you receive this message, you should check and reload any system parameter settings that are used by your application.

This string can be the name of a registry key or the name of a section in the Win.ini file. When the string is a registry name, it typically indicates only the leaf node in the registry, not the full path.

...

So, for example:

DWORD_PTR res;
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)TEXT("TapsEnabled"), 0, 1000, &res);
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • Thank you but the HWND_BROADCAST just gets 'identifier "HWND" is undefined'. – Snakehater Sep 07 '20 at 07:02
  • 1
    @Snakehater the only way that can happen is if you are missing core Win32 API `#include`s in your code. `#include ` is the bare minimum needed. Do you have that? – Remy Lebeau Sep 07 '20 at 08:00
  • No I didn't have it included at all, but now I have architecture not specified error bit I think that is a visual studio error. – Snakehater Sep 07 '20 at 16:10