How to suppress SaveFileDialog from WebBrowser?

Mattia Fanti 356 Reputation points

I'm working with a WebBrowser control on a website that download files, but unfortunately it open a savefiledialog automatically. I looked for this problem online and I only found This SO topic where the code reported in c# is

GetClassName(hWnd, ClassName, ClassName.Capacity);
GetWindowText(hWnd, DialogTitle, DialogTitle.Capacity);
DialogHandle = FindWindow(DIALOG_CLASS, DialogTitle.ToString());

if (ClassName.ToString() == DIALOG_CLASS && DialogTitle.ToString().Contains(TempFilename))
     ReturnValue = SendMessage(DialogHandle, WM_CLOSE, IntPtr.Zero, IntPtr.Zero);

How can I Actually use it on I've tried to converted it on through a c# to converter but they seems not to work for this code.


An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,610 questions
{count} votes