Network Time Protocol request in C#

I’m writing an application in C# that needs to know if the system time is not fake (only if the network is on). For this reason, I make a class that retrieves the time from a NTP server. The class is written to prevent that the same servers are called too often using a simple circular array. For the data returned by the servers, I invite you to see the RFC-2030.

Read more

ExitWindowsEx in C#

I post you my simple class to shutdown, reboot and logoff Windows using the famous ExitWindowsEx.

Each method is overloaded with another that force the action, in other words, it executes the action without prohibiting Windows to send the WM_QUERYENDSESSION message. In this way the user can’t cancel this action.

Read more

Hide Console Window in C#

I just made a silent application to check how much time my little brother stays on his computer. But, I needed to make an application that doesn’t show any window. Now, I show you my personal solutions to do this for the Console Application Projects and for the Windows Forms Application Projects.

Read more