3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 /* $Id: clipboard.c,v 1.13 2004/01/26 08:44:51 weiden Exp $
21 * PROJECT: ReactOS user32.dll
22 * FILE: lib/user32/windows/clipboard.c
24 * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
26 * 09-05-2001 CSH Created
29 /* INCLUDES ******************************************************************/
38 /* FUNCTIONS *****************************************************************/
44 OpenClipboard(HWND hWndNewOwner
)
46 return NtUserOpenClipboard(hWndNewOwner
, 0);
55 return NtUserCloseClipboard();
62 CountClipboardFormats(VOID
)
64 return NtUserCountClipboardFormats();
73 return NtUserEmptyClipboard();
80 EnumClipboardFormats(UINT format
)
82 return NtUserEnumClipboardFormats(format
);
89 GetClipboardData(UINT uFormat
)
91 return NtUserGetClipboardData(uFormat
, 0);
98 GetClipboardFormatNameA(UINT format
, LPSTR lpszFormatName
, int cchMaxCount
)
101 UNICODE_STRING FormatName
;
104 lpBuffer
= HEAP_alloc(cchMaxCount
* sizeof(WCHAR
));
107 SetLastError(ERROR_OUTOFMEMORY
);
110 RtlInitUnicodeString(&FormatName
, lpBuffer
);
111 FormatName
.Length
= 0;
112 FormatName
.MaximumLength
= cchMaxCount
* sizeof(WCHAR
);
113 FormatName
.Buffer
= lpBuffer
;
114 Length
= NtUserGetClipboardFormatName(format
, &FormatName
, cchMaxCount
);
115 DPRINT("GetClipboardFormatNameA(%x): %S\n", format
, lpBuffer
);
116 HEAP_strcpyWtoA(lpszFormatName
, lpBuffer
, Length
);
118 DPRINT("GetClipboardFormatNameA(%x): returning %s\n", format
, lpszFormatName
);
127 GetClipboardFormatNameW(UINT format
, LPWSTR lpszFormatName
, INT cchMaxCount
)
129 UNICODE_STRING FormatName
;
132 FormatName
.Length
= 0;
133 FormatName
.MaximumLength
= cchMaxCount
* sizeof(WCHAR
);
134 FormatName
.Buffer
= (PWSTR
)lpszFormatName
;
135 Ret
= NtUserGetClipboardFormatName(format
, &FormatName
, cchMaxCount
);
136 DPRINT("GetClipboardFormatNameW(%x): returning %S\n", format
, lpszFormatName
);
144 GetClipboardOwner(VOID
)
146 return NtUserGetClipboardOwner();
153 GetClipboardSequenceNumber(VOID
)
155 return NtUserGetClipboardSequenceNumber();
162 GetClipboardViewer(VOID
)
164 return NtUserGetClipboardViewer();
171 GetOpenClipboardWindow(VOID
)
173 return NtUserGetOpenClipboardWindow();
180 GetPriorityClipboardFormat(UINT
*paFormatPriorityList
, INT cFormats
)
182 return NtUserGetPriorityClipboardFormat(paFormatPriorityList
, cFormats
);
189 IsClipboardFormatAvailable(UINT format
)
191 return NtUserIsClipboardFormatAvailable(format
);
198 RegisterClipboardFormatA(LPCSTR lpszFormat
)
200 ULONG Ret
= RegisterWindowMessageA(lpszFormat
);
201 DPRINT("RegisterClipboardFormatA(%s) - %x\n", lpszFormat
, Ret
);
209 RegisterClipboardFormatW(LPCWSTR lpszFormat
)
211 ULONG Ret
= RegisterWindowMessageW(lpszFormat
);
212 DPRINT("RegisterClipboardFormatW(%S) - %x\n", lpszFormat
, Ret
);
220 SetClipboardData(UINT uFormat
, HANDLE hMem
)
222 return NtUserSetClipboardData(uFormat
, hMem
, 0);
229 SetClipboardViewer(HWND hWndNewViewer
)
231 return NtUserSetClipboardViewer(hWndNewViewer
);
238 ChangeClipboardChain(HWND hWndRemove
, HWND hWndNewNext
)
240 return NtUserChangeClipboardChain(hWndRemove
, hWndNewNext
);