I would prefer to collect data in some sort of browser-based form. How do I present it to the user and lock them out of Windows until it has been submitted?

Samer Jihad Slim (IT Dept) 0 Reputation points
2024-04-22T09:21:22.18+00:00

I would like for the user to be given a form in Windows at the beginning of his or her login session on a computer in the office. It should be impossible to use the computer without filling out and submitting this form.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,655 questions
Windows 10 Security
Windows 10 Security
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
2,758 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. hossein jalilian 2,985 Reputation points
    2024-04-22T20:41:27.9566667+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    Use the LockWorkStation function provided by the Windows API to lock the computer programmatically.

    You can call this function when the user attempts to close the form without submitting it, effectively preventing further use of the computer until the form is completed.

    using System.Runtime.InteropServices;
    class Program
    {
        [DllImport("user32.dll", SetLastError = true)]
        static extern bool LockWorkStation();
        
        static void Main(string[] args)
        {
            // Call LockWorkStation to lock the computer
            LockWorkStation();
        }
    }
    
    

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful