How to suppress SaveFileDialog from WebBrowser?

Mattia Fanti 356 Reputation points
2022-03-06T23:47:31.25+00:00

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 vb.net? I've tried to converted it on vb.net through a c# to vb.net converter but they seems not to work for this code.

Thanks

VB
VB
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