웹브라우저에서 alert 창 hook하기
http://stackoverflow.com/questions/16828221/prevent-alert-message-while-scrapping
[DllImport("user32.dll", SetLastError = true)] static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll", CharSet = CharSet.Auto)] static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); private void Form1_Deactivate(object sender, EventArgs e) { IntPtr hwnd = FindWindow(null, "Message from webpage"); hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Button", "OK"); uint message = 0xf5; SendMessage(hwnd, message, IntPtr.Zero, IntPtr.Zero); }
'C#' 카테고리의 다른 글
Visual Studio 2015 unfixed bug databinding with setting value occurs error - form load event not fired (0) | 2016.06.09 |
---|---|
ILMerge 오류 Unresolved assembly reference not allowed System.Core (0) | 2015.10.09 |
웹브라우저 HtmlElement 캡처하기 c# capture webbrowser html element (0) | 2015.10.07 |
ILMerge로 dll을 exe에 병합하기 (0) | 2015.10.05 |
현재 외부 IP (Public IP) 가져오는 법 (0) | 2015.09.16 |