WebBrowser control in .net for windows ce

2019-09-03 20:40发布

问题:

when I navigate to particular page using WebBrowser control in .net for windows ce device, it is not taking clicks for buttons on page.e.g Search button on Google page..

Actually this works for 1 device and not for other..

Can anybody help out solving this?

回答1:

This needs to set registry, and keys that need be set are;

Software\Microsoft\Windows\CurrentVersion\Internet Settings and the value that need to set is "WarnOnZoneCrossing" to '0' in current user registry.

Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3 and the value that need to set is "1601"to '0' and "1609" to '0' in local machine registry.

The code will look like

using (RegistryKey key = Registry.CurrentUser.OpenSubKey (@"\Software\Microsoft\Windows\CurrentVersion\Internet Settings", true))
            {
                if (key == null)
                {                    Registry.CurrentUser.CreateSubKey(@"\Software\Microsoft\Windows\CurrentVersion\Internet Settings");
                    using (RegistryKey newKey = Registry.CurrentUser.OpenSubKey(@"\Software\Microsoft\Windows\CurrentVersion\Internet Settings", true))
                    {
                        newKey.SetValue("WarnOnZoneCrossing", 0);
                    }
                }
                else
                    key.SetValue("WarnOnZoneCrossing", 0);
            }
            //enable submission of non-encrypted form data
            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", true))
            {
                if (key == null)
                {
                    Registry.LocalMachine.CreateSubKey(@"\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3");
                    using (RegistryKey newKey = Registry.LocalMachine.OpenSubKey(@"\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", true))
                    {
                        newKey.SetValue("1601", 0);
                    }
                }
                else
                    key.SetValue("1601", 0);
            }
            //enable the display of mixed content
            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", true))
            {
                if (key == null)
                {
                    Registry.LocalMachine.CreateSubKey(@"\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3");
                    using (RegistryKey newKey = Registry.LocalMachine.OpenSubKey(@"\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", true))
                    {
                        newKey.SetValue("1609", 0);
                    }
                }
                else
                    key.SetValue("1609", 0);
            }