private static IntPtr MessageBoxHookProc(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode < 0) { return(MessageBoxManager.CallNextHookEx(MessageBoxManager.hHook, nCode, wParam, lParam)); } MessageBoxManager.CWPRETSTRUCT cWPRETSTRUCT = (MessageBoxManager.CWPRETSTRUCT)Marshal.PtrToStructure(lParam, typeof(MessageBoxManager.CWPRETSTRUCT)); IntPtr idHook = MessageBoxManager.hHook; if (cWPRETSTRUCT.message == 272u) { MessageBoxManager.GetWindowTextLength(cWPRETSTRUCT.hwnd); StringBuilder stringBuilder = new StringBuilder(10); MessageBoxManager.GetClassName(cWPRETSTRUCT.hwnd, stringBuilder, stringBuilder.Capacity); if (stringBuilder.ToString() == "#32770") { MessageBoxManager.nButton = 0; MessageBoxManager.EnumChildWindows(cWPRETSTRUCT.hwnd, MessageBoxManager.enumProc, IntPtr.Zero); if (MessageBoxManager.nButton == 1) { IntPtr dlgItem = MessageBoxManager.GetDlgItem(cWPRETSTRUCT.hwnd, 2); if (dlgItem != IntPtr.Zero) { MessageBoxManager.SetWindowText(dlgItem, MessageBoxManager.OK); } } } } return(MessageBoxManager.CallNextHookEx(idHook, nCode, wParam, lParam)); }