ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Apply changes in Registry immediately

(1/3) > >>

Yaron:
Hello,

The following code (in a Firefox extension) toggles the value of the "FontSmoothing" Registry-Key.


--- Code: Javascript ---let regFontSmooth = Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey);regFontSmooth.open(regFontSmooth.ROOT_KEY_CURRENT_USER, "Control Panel\\Desktop", regFontSmooth.ACCESS_ALL);regFontSmooth.writeStringValue("FontSmoothing", regFontSmooth.readStringValue("FontSmoothing") == 0 ? 2 : 0);regFontSmooth.close();
How do I apply the changes immediately (without a reboot or restarting Windows Explorer?

Thank you.

MilesAhead:
I don't know about from inside extension code.  But AutoIt3  has a function EnvUpdate().  Short of logging off, then back on, or restarting Explorer, it is the best I have found so far.  I usually call it 3 times with perhaps a 1/2 second pause between.

Or you can just download the program UpdateEnv from my page:
http://milesaheadsoftware.org/

Yaron:
Hello my friend,

I hope you're doing well.

Thank you for this reply.
And also many thanks for "MoveIt" and "Process Counter"; - I use both frequently and really enjoy them.

I think there's a way to update the registry from a Firefox extension without using external applications.
So, I'd rather wait. Please don't consider this ungrateful. :)

Can you think of other good forums I can post this question? I'd appreciate that.

Have a great weekend.

MilesAhead:
Hello my friend,

I hope you're doing well.

Thank you for this reply.
And also many thanks for "MoveIt" and "Process Counter"; - I use both frequently and really enjoy them.

I think there's a way to update the registry from a Firefox extension without using external applications.
So, I'd rather wait. Please don't consider this ungrateful. :)

Can you think of other good forums I can post this question? I'd appreciate that.

Have a great weekend.
-Yaron (July 03, 2015, 05:01 PM)
--- End quote ---

Glad you enjoy using MoveIt.  The only stuff I ever wrote for browser integration were DLLs using the old Netscape Plugin API.  I have never attempted a modern extension.  Now and then I consider trying to do a simple one.  But I have no clue what programming forums handle that type of thing.  I thought browsers, excluding ActiveX stuff, were precluded from effecting the host OS environment?  If you could call a Windows API I would try the one used by SysInternals sync.exe program.  The author gets Windows to flush file buffers to disk simply by locking the volume, then releasing the lock.  It flushes file buffers but I don't know if it will flush the registry to disk.

Yaron:
Hello MilesAhead,

Thanks again. I appreciate it.

The code I use does change the value in the registry; - it doesn't apply it immediately.
Your replies are very helpful. I'll wait a bit.

Best wishes.

Navigation

[0] Message Index

[#] Next page

Go to full version