Commit 348f7ed0 authored by Frediano Ziglio's avatar Frediano Ziglio
Browse files

Use GetModuleHandle to get some functions from user32 library

The library is surely already loaded as providing clipboard and
other utilities we need.
user32 is one of the main win32 libraries.
Avoid using LoadLibrary that increment the reference so we don't
need to call FreeLibrary to cleanly decrement the reference.
Signed-off-by: Frediano Ziglio's avatarFrediano Ziglio <>
Acked-by: Christophe Fergeau's avatarChristophe Fergeau <>
parent 9264c7f3
......@@ -125,7 +125,6 @@ private:
static VDAgent* _singleton;
HWND _hwnd;
HWND _hwnd_next_viewer;
HMODULE _user_lib;
PCLIPBOARD_OP _add_clipboard_listener;
PCLIPBOARD_OP _remove_clipboard_listener;
clipboard_owner_t _clipboard_owner;
......@@ -183,7 +182,6 @@ VDAgent* VDAgent::get()
: _hwnd (NULL)
, _hwnd_next_viewer (NULL)
, _user_lib (NULL)
, _add_clipboard_listener (NULL)
, _remove_clipboard_listener (NULL)
, _clipboard_owner (owner_none)
......@@ -222,7 +220,6 @@ VDAgent::VDAgent()
......@@ -285,9 +282,9 @@ bool VDAgent::run()
vd_printf("SetProcessShutdownParameters failed %lu", GetLastError());
_user_lib = LoadLibrary(L"User32.dll");
HMODULE _user_lib = GetModuleHandle(L"User32");
if (!_user_lib) {
vd_printf("LoadLibrary failed %lu", GetLastError());
vd_printf("GetModuleHandle failed %lu", GetLastError());
return false;
_add_clipboard_listener =
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment