VirtualBox

source: vbox/trunk/include/VBox/GuestHost/SharedClipboard-win.h@ 78345

Last change on this file since 78345 was 78307, checked in by vboxsync, 6 years ago

Shared Clipboard/URI: First commit; work in progress.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/** @file
2 * Shared Clipboard - Common Guest and Host Code, for Windows OSes.
3 */
4
5/*
6 * Copyright (C) 2006-2019 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef VBOX_INCLUDED_GuestHost_SharedClipboard_win_h
27#define VBOX_INCLUDED_GuestHost_SharedClipboard_win_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <iprt/types.h>
33#include <iprt/win/windows.h>
34
35#ifndef WM_CLIPBOARDUPDATE
36# define WM_CLIPBOARDUPDATE 0x031D
37#endif
38
39#define VBOX_CLIPBOARD_WNDCLASS_NAME "VBoxSharedClipboardClass"
40
41#define VBOX_CLIPBOARD_WIN_REGFMT_HTML "VBox HTML Format"
42#define VBOX_CLIPBOARD_WIN_REGFMT_URI_LIST "VBox URI List"
43
44/** Default timeout (in ms) for passing down messages down the clipboard chain. */
45#define VBOX_CLIPBOARD_CBCHAIN_TIMEOUT_MS 5000
46
47/** Sets announced clipboard formats from the host. */
48#define VBOX_CLIPBOARD_WM_SET_FORMATS WM_USER
49/** Reads data from the clipboard and sends it to the host. */
50#define VBOX_CLIPBOARD_WM_READ_DATA WM_USER + 1
51
52/* Dynamically load clipboard functions from User32.dll. */
53typedef BOOL WINAPI FNADDCLIPBOARDFORMATLISTENER(HWND);
54typedef FNADDCLIPBOARDFORMATLISTENER *PFNADDCLIPBOARDFORMATLISTENER;
55
56typedef BOOL WINAPI FNREMOVECLIPBOARDFORMATLISTENER(HWND);
57typedef FNREMOVECLIPBOARDFORMATLISTENER *PFNREMOVECLIPBOARDFORMATLISTENER;
58
59/**
60 * Structure for keeping function pointers for the new clipboard API.
61 * If the new API is not available, those function pointer are NULL.
62 */
63typedef struct VBOXCLIPBOARDWINAPINEW
64{
65 PFNADDCLIPBOARDFORMATLISTENER pfnAddClipboardFormatListener;
66 PFNREMOVECLIPBOARDFORMATLISTENER pfnRemoveClipboardFormatListener;
67} VBOXCLIPBOARDWINAPINEW, *PVBOXCLIPBOARDWINAPINEW;
68
69/**
70 * Structure for keeping variables which are needed to drive the old clipboard API.
71 */
72typedef struct VBOXCLIPBOARDWINAPIOLD
73{
74 /** Timer ID for the refresh timer. */
75 UINT timerRefresh;
76 /** Whether "pinging" the clipboard chain currently is in progress or not. */
77 bool fCBChainPingInProcess;
78} VBOXCLIPBOARDWINAPIOLD, *PVBOXCLIPBOARDWINAPIOLD;
79
80typedef struct VBOXCLIPBOARDWINCTX
81{
82 /** Window handle of our (invisible) clipbaord window. */
83 HWND hWnd;
84 /** Window handle which is next to us in the clipboard chain. */
85 HWND hWndNextInChain;
86 /** Structure for maintaining the new clipboard API. */
87 VBOXCLIPBOARDWINAPINEW newAPI;
88 /** Structure for maintaining the old clipboard API. */
89 VBOXCLIPBOARDWINAPIOLD oldAPI;
90} VBOXCLIPBOARDWINCTX, *PVBOXCLIPBOARDWINCTX;
91
92int VBoxClipboardWinOpen(HWND hWnd);
93int VBoxClipboardWinClose(void);
94int VBoxClipboardWinClear(void);
95int VBoxClipboardWinCheckAndInitNewAPI(PVBOXCLIPBOARDWINAPINEW pAPI);
96bool VBoxClipboardWinIsNewAPI(PVBOXCLIPBOARDWINAPINEW pAPI);
97int VBoxClipboardWinAddToCBChain(PVBOXCLIPBOARDWINCTX pCtx);
98int VBoxClipboardWinRemoveFromCBChain(PVBOXCLIPBOARDWINCTX pCtx);
99VOID CALLBACK VBoxClipboardWinChainPingProc(HWND hWnd, UINT uMsg, ULONG_PTR dwData, LRESULT lResult);
100int VBoxClipboardWinGetFormats(PVBOXCLIPBOARDWINCTX pCtx, uint32_t *puFormats);
101
102#endif /* !VBOX_INCLUDED_GuestHost_SharedClipboard_win_h */
103
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette