Author Archives: CooLMinE
Monitor for clipboard changes using AddClipboardFormatListener
Microsoft has added a new windows function to help monitor when the data in the clipboard has been changed. The new function is called AddClipboardFormatListener but sadly it is only available for Windows Vista and higher. If you are looking for a method that will work for earlier versions of Windows take a look at Monitor clipboard in C#.
The principle is the same with the older method. We need to add our window to the clipboard format listener list so it can receive the WM_CLIPBOARDUPDATE message.
In order to do that we need to pinvoke the AddClipboardFormatListener
and RemoveClipboardFormatListener
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /// <summary> /// Places the given window in the system-maintained clipboard format listener list. /// </summary> [DllImport("user32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] static extern bool AddClipboardFormatListener(IntPtr hwnd); /// <summary> /// Removes the given window from the system-maintained clipboard format listener list. /// </summary> [DllImport("user32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] static extern bool RemoveClipboardFormatListener(IntPtr hwnd); /// <summary> /// Sent when the contents of the clipboard have changed. /// </summary> private const int WM_CLIPBOARDUPDATE = 0x031D; |
Posted in C#.
Tagged AddClipboardFormatListener, C#, csharp, RemoveClipboardFormatListener, snippet, winforms, WM_CLIPBOARDUPDATE
How to set a custom page zoom value in Google Chrome
By default Google Chrome has predefined values for the page zoom setting. But what happens if none of those values satisfy your needs ? Since Google Chrome doesn’t provide you with way to set your own custom value we will need to use a workaround to achieve that.
The following workaround works by modifying the HTML code of the settings page allowing you to add (or remove if needed) more options from the drop down list. Another advantage of this method is that it doesn’t require an extension to be installed therefore not consuming extra unneeded memory.
Lets get started!
Access Google’s Chrome settings page by visiting chrome://settings/.
Posted in Software Tips.
Tagged browser, Chrome, Google, Google Chrome
How to make Firefox ask to save tabs on exit
Sadly the newer versions of Firefox no longer ask you if you want to save the open tabs when you close Firefox. This is probably because of the new feature that has been implemented in the general options which allows Firefox to always remember the open tabs and windows upon closing.
But what happens if you don’t always want to save the open tabs ?
To get back the original functionality of Firefox, that used to show a message on exit asking if we want to save the open tabs or not we need to dig a bit in Firefox’s configuration settings.
- Type about:config in your address bar and press enter.
- There are three entries we are interested in (four if you are using Firefox 12 or higher).
- browser.tabs.warnOnClose
- browser.warnOnQuit
- browser.warnOnRestart
- browser.showQuitWarning (for Firefox 12 and higher)
Search for each one individually and make sure that their value is set to true.
- Restart Firefox.
Now everytime you will close Firefox (assuming you have tabs open) you will get a message asking you if you want to save the current tabs or not.
Posted in Software Tips.
Tagged firefox, Mozilla firefox
Disable grey urls in Firefox’s address bar
Firefox 6 and higher support a new feature that will automatically color the domain name and the top level domain black, greying out the rest of the URL.
Since this feature is enabled by default in the latest versions you might want to disable it if you don’t like the way Firefox is displaying the URL in the address bar. If that is the case simply follow the steps below.
browser.urlbar.formatting.enabled (true)
browser.urlbar.formatting.enabled (false)
How to disable Firefox’s url formatting.
- Type about:config in your address bar and press enter.
- Search for browser.urlbar.formatting.enabled.
- Make sure the value is set to false.
The URL in the address bar should now be colored in black only.
Posted in Software Tips.
Tagged firefox, Mozilla firefox