Window setting Focus Assist turn On/Off programmatically

184 Views Asked by At

I am trying to Turn On/Off Focus Assist programmatically.

I have tried many ways, (registry/code), but none of them work.

I have found the following code, but this also is not working :

[DllImport("user32.dll")]
public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);
const int WM_SYSCOMMAND = 0x0112;
const int SC_FOCUSASSIST = 0xF182;
public static void ActivateFocusAssist()
{
    SendMessage(-1, WM_SYSCOMMAND, SC_FOCUSASSIST, 0);
}

The program gets stuck at this method ActivateFocusAssist();

Does anyone have an idea of how to achieve the correct solution?

0

There are 0 best solutions below