This commit is contained in:
2025-11-09 19:36:54 +10:00
parent 2f83f11e7c
commit edd5c24968
3 changed files with 1 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
open System
open System.Runtime.InteropServices
open System.Text
[<DllImport("user32.dll", SetLastError = true)>]
extern IntPtr FindWindow(string lpClassName, string lpWindowName)
[<DllImport("user32.dll", SetLastError = true)>]
extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow)
[<DllImport("user32.dll", SetLastError = true)>]
extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount)
[<DllImport("user32.dll", SetLastError = true)>]
extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam)
let WM_CLOSE = 0x0010u
let getClassName (hWnd: IntPtr) =
let sb = StringBuilder(256)
if GetClassName(hWnd, sb, sb.Capacity) > 0 then
sb.ToString()
else
""
[<EntryPoint>]
let main _ =
printfn "Running TuneBlade error suppressor..."
while true do
let hwnd = FindWindow(null, "TuneBlade")
if hwnd <> IntPtr.Zero then
let cls = getClassName hwnd
if cls = "#32770" then
printfn "TuneBlade error dialog detected closing."
PostMessage(hwnd, WM_CLOSE, IntPtr.Zero, IntPtr.Zero) |> ignore
let mutable child = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "#32770", "TuneBlade")
while child <> IntPtr.Zero do
printfn "Closing TuneBlade dialog window..."
PostMessage(child, WM_CLOSE, IntPtr.Zero, IntPtr.Zero) |> ignore
child <- FindWindowEx(IntPtr.Zero, child, "#32770", "TuneBlade")
System.Threading.Thread.Sleep(2000)
0