wildzero
asked on
Twebbrowser re-set / reload registry settings
Hello there,
I have a Twebbrowser on my form, and if I browse to a few sites, I want to be able to 'reset' the browser - reloading the IE settings from the registry.
Exmaple, if I surf sites, disable images from loading I need to 'reset' the browser to reload those changed IE settings.
Also, if someone knows how to get IE to disable active X I will up the points :)
Cheers all.
I have a Twebbrowser on my form, and if I browse to a few sites, I want to be able to 'reset' the browser - reloading the IE settings from the registry.
Exmaple, if I surf sites, disable images from loading I need to 'reset' the browser to reload those changed IE settings.
Also, if someone knows how to get IE to disable active X I will up the points :)
Cheers all.
ASKER
Huh?
If I have a twebrowser on my form
I browse some sites
I then disable IE from showing images, I have to close and open the program for the twebbroser to re-read the registry to get the setting to say not to download the images.
I would like to be able to disable images and not have to close the program...
If I have a twebrowser on my form
I browse some sites
I then disable IE from showing images, I have to close and open the program for the twebbroser to re-read the registry to get the setting to say not to download the images.
I would like to be able to disable images and not have to close the program...
To learn how to write and read to registry have a look at these:
https://www.experts-exchange.com/questions/20387935/write-to-registry.html
https://www.experts-exchange.com/questions/10834801/read-and-write-the-registry.html
Explaining my concept:
-Read Registry Keys to Change
-Add these to listbox ( listbox1.items.add(readstr ing(...));
-Write changes to registry: writestring(...);
-When done revert back: writestring(listbox1.items .strings[x ]...);
The settings for IE are found in the following key:
HKEY_CURRENT_USER\Software \Microsoft \Internet Explorer
Related Settings:
HKEY_CURRENT_USER\Software \Microsoft \Windows\C urrentVers ion\Intern et Settings
Regards,
Hypoviax
https://www.experts-exchange.com/questions/20387935/write-to-registry.html
https://www.experts-exchange.com/questions/10834801/read-and-write-the-registry.html
Explaining my concept:
-Read Registry Keys to Change
-Add these to listbox ( listbox1.items.add(readstr
-Write changes to registry: writestring(...);
-When done revert back: writestring(listbox1.items
The settings for IE are found in the following key:
HKEY_CURRENT_USER\Software
Related Settings:
HKEY_CURRENT_USER\Software
Regards,
Hypoviax
ASKER
Hypoviax...
I know how to do that part, I just want the changes to happen without having to close and open the program
I know how to do that part, I just want the changes to happen without having to close and open the program
Ahhh... Sorry i didn't understand.
Try freeing the webbrowser then recreating it, that might work
Regards,
Hypoviax
Try freeing the webbrowser then recreating it, that might work
Regards,
Hypoviax
ASKER
Ok :)
How do I do that? :)
How do I do that? :)
Ill post tommorow...
ASKER
Cheers that would be excellent :D
No need to do that, use TRegistry SaveKey and RestoreKey.
SaveKey to save the Key's data to a file and RestoreKey restores the data from the file saved
using SaveKey.
SaveKey to save the Key's data to a file and RestoreKey restores the data from the file saved
using SaveKey.
ASKER
The who what?
*I just want the changes to happen without having to close and open the program*
*I just want the changes to happen without having to close and open the program*
Ok,
After you change your settings free the browser:
webbrowser1.free;
Then once you have done this recreate it and the new settings *should* apply:
var web:twebbrowser;
begin
Web := TWebBrowser.Create( Self );
Web.ParentWindow := Form1.Handle;
Web.Navigate( 'http://www.google.com' ); //You can set the width and height , left and top properties here too.
//You may wish to declare the web variable globally so that you can access it with other controls etc.
//To do this put it in the public or private sections towards the top of the code. With your controls you may want to specify something like:
Example for navigate button:
If webbrowser1.visible then //if it has not been destroyed
webbrowser1.navigate('http://www.google.com')
else
Web.Navigate( 'http://www.google.com' ); //if so use the created one
If you want to destroy the created one the same procedure applys as for the original
Regards,
Hypoviax
After you change your settings free the browser:
webbrowser1.free;
Then once you have done this recreate it and the new settings *should* apply:
var web:twebbrowser;
begin
Web := TWebBrowser.Create( Self );
Web.ParentWindow := Form1.Handle;
Web.Navigate( 'http://www.google.com' ); //You can set the width and height , left and top properties here too.
//You may wish to declare the web variable globally so that you can access it with other controls etc.
//To do this put it in the public or private sections towards the top of the code. With your controls you may want to specify something like:
Example for navigate button:
If webbrowser1.visible then //if it has not been destroyed
webbrowser1.navigate('http://www.google.com')
else
Web.Navigate( 'http://www.google.com' ); //if so use the created one
If you want to destroy the created one the same procedure applys as for the original
Regards,
Hypoviax
ASKER
Hupoviax,
Cool cheers for that.
Is there a way to re-create it using it's original name, that way don't have to worry about if it's webbrowser1 or Web
ie
webbrowser1.create(self); ?
Cool cheers for that.
Is there a way to re-create it using it's original name, that way don't have to worry about if it's webbrowser1 or Web
ie
webbrowser1.create(self); ?
ASKER
Just thinking because if it gets free'd and created say 5-6 times, don't want it to be to hard to 'track'
Yeah, that should work i think or try this too:
webbrowser1 := TWebBrowser.Create( Self );
webbrowser1.ParentWindow := Form1.Handle;
webbrowser1.Navigate( 'http://www.google.com' );
Regards,
Hypoviax
webbrowser1 := TWebBrowser.Create( Self );
webbrowser1.ParentWindow := Form1.Handle;
webbrowser1.Navigate( 'http://www.google.com' );
Regards,
Hypoviax
Yep, my code works, i don't think yours works although you might be able to get it working.
Just a suggestion, when you are freeing and recreating, it is probably best to store all the browser properties so that you can easily adjust when freeing and recreating:
global variables:
webleft,webright, webwidth,webheight:integer ;
on form create:
webleft:=webbrowser1.left
etc for others
When recreating
webbrowser1.left:=webleft
etc for others
Regards,
Hypoviax
global variables:
webleft,webright, webwidth,webheight:integer
on form create:
webleft:=webbrowser1.left
etc for others
When recreating
webbrowser1.left:=webleft
etc for others
Regards,
Hypoviax
ASKER
....i don't think yours works although you might be able to get it working.... ? eh??
I tired your last bit of code, and it does work, it frees it, re-creates it perfect.
I changed the Form1.Handle to Tabsheet1.Handle as it's on a tab sheet.
The only thing is, it doesn't seem to want to align it's self to the client.
I've done
webbrowser1.Free;
webbrowser1 := TWebBrowser.Create( Self );
webbrowser1.ParentWindow := TabSheet1.Handle;
webbrowser1.Align := alClient;
But all I get is a square that isn't alClient.... - so when I resize the form, it doesn't resize with it..
Extra points here :)
I tired your last bit of code, and it does work, it frees it, re-creates it perfect.
I changed the Form1.Handle to Tabsheet1.Handle as it's on a tab sheet.
The only thing is, it doesn't seem to want to align it's self to the client.
I've done
webbrowser1.Free;
webbrowser1 := TWebBrowser.Create( Self );
webbrowser1.ParentWindow := TabSheet1.Handle;
webbrowser1.Align := alClient;
But all I get is a square that isn't alClient.... - so when I resize the form, it doesn't resize with it..
Extra points here :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Beautiful!
:)
Thats right on man, supper excellent
:)
Thats right on man, supper excellent
I'm looking for that ActiveX thing now
Thanks,
Do you just want the ActiveX registry key?
I'll have a look around for it if that is so
Regards,
Hypoviax
Do you just want the ActiveX registry key?
I'll have a look around for it if that is so
Regards,
Hypoviax
ASKER
If you do find it that'd be great
If you manage to find it, i'll open another question and get you to answer there
just a key is here
set it to whatever
I can code the rest :)
If you manage to find it, i'll open another question and get you to answer there
just a key is here
set it to whatever
I can code the rest :)
Ok, that would be great,
Thanks again,
Hypoviax
Thanks again,
Hypoviax
I think this is the key:
HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\Internet Explorer\ActiveX Compatibility
Registry Settings
System Key: [HKEY_LOCAL_MACHINE\SOFTWA RE\Microso ft\Interne t Explorer\ActiveX Compatibility\{CLSID of the ActiveX control}]
Value Name: Compatibility Flags
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = allow, 1024 (400hex) = disable)
http://www.winguides.com/registry/display.php/1188/
Regards,
Hypoviax
HKEY_LOCAL_MACHINE\SOFTWAR
Registry Settings
System Key: [HKEY_LOCAL_MACHINE\SOFTWA
Value Name: Compatibility Flags
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = allow, 1024 (400hex) = disable)
http://www.winguides.com/registry/display.php/1188/
Regards,
Hypoviax
Regards,
Hypoviax