mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Refactored code to use SafeHandle where possible, this should fix potential resource leaks and make the code more clear.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2429 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
9288fa8212
commit
201ee7082e
7 changed files with 365 additions and 233 deletions
|
@ -48,9 +48,9 @@ namespace GreenshotPlugin.Controls {
|
|||
get {
|
||||
if (vRefresh == 0) {
|
||||
// get te hDC of the desktop to get the VREFRESH
|
||||
IntPtr hDCDesktop = User32.GetWindowDC(User32.GetDesktopWindow());
|
||||
vRefresh = GDI32.GetDeviceCaps(hDCDesktop, DeviceCaps.VREFRESH);
|
||||
User32.ReleaseDC(hDCDesktop);
|
||||
using (SafeWindowDCHandle desktopHandle = SafeWindowDCHandle.fromDesktop()) {
|
||||
vRefresh = GDI32.GetDeviceCaps(desktopHandle, DeviceCaps.VREFRESH);
|
||||
}
|
||||
}
|
||||
// A vertical refresh rate value of 0 or 1 represents the display hardware's default refresh rate.
|
||||
// As there is currently no know way to get the default, we guess it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue