static User32() { IntPtr library = DynamicImport.ImportLibrary("user32.dll"); CreateWindowEx = DynamicImport.Import <CreateWindowExDelegate>(library, "CreateWindowExW"); DefWindowProc = DynamicImport.Import <DefWindowProcDelegate>(library, "DefWindowProcW"); DestroyWindow = DynamicImport.Import <DestroyWindowDelegate>(library, "DestroyWindow"); DispatchMessage = DynamicImport.Import <DispatchMessageDelegate>(library, "DispatchMessageW"); GetClientRect = DynamicImport.Import <GetClientRectDelegate>(library, "GetClientRect"); GetWindow = DynamicImport.Import <GetWindowDelegate>(library, "GetWindow"); GetWindowRect = DynamicImport.Import <GetWindowRectDelegate>(library, "GetWindowRect"); IsWindow = DynamicImport.Import <IsWindowDelegate>(library, "IsWindow"); IsWindowVisible = DynamicImport.Import <IsWindowVisibleDelegate>(library, "IsWindowVisible"); MoveWindow = DynamicImport.Import <MoveWindowDelegate>(library, "MoveWindow"); PeekMessage = DynamicImport.Import <PeekMessageWDelegate>(library, "PeekMessageW"); RegisterClassEx = DynamicImport.Import <RegisterClassExDelegate>(library, "RegisterClassExW"); SendMessage = DynamicImport.Import <SendMessageDelegate>(library, "SendMessageW"); SetLayeredWindowAttributes = DynamicImport.Import <SetLayeredWindowAttributesDelegate>(library, "SetLayeredWindowAttributes"); SetWindowPos = DynamicImport.Import <SetWindowPosDelegate>(library, "SetWindowPos"); ShowWindow = DynamicImport.Import <ShowWindowDelegate>(library, "ShowWindow"); TranslateMessage = DynamicImport.Import <TranslateMessageDelegate>(library, "TranslateMessage"); UnregisterClass = DynamicImport.Import <UnregisterClassDelegate>(library, "UnregisterClassW"); UpdateWindow = DynamicImport.Import <UpdateWindowDelegate>(library, "UpdateWindow"); WaitMessage = DynamicImport.Import <WaitMessageDelegate>(library, "WaitMessage"); PostMessage = DynamicImport.Import <PostMessageWDelegate>(library, "PostMessageW"); GetForegroundWindow = DynamicImport.Import <GetForegroundWindowDelegate>(library, "GetForegroundWindow"); try { _setThreadDpiAwarenessContext = DynamicImport.Import <SetThreadDpiAwarenessContextDelegate>(library, "SetThreadDpiAwarenessContext"); } catch { } // ignored }
static DwmApi() { IntPtr library = DynamicImport.ImportLibrary("dwmapi.dll"); DwmExtendFrameIntoClientArea = DynamicImport.Import <DwmExtendFrameIntoClientAreaDelegate>(library, "DwmExtendFrameIntoClientArea"); }