Add clipboard_opener
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
f8f8e7e76e
commit
f9f9aade69
@ -1614,6 +1614,34 @@ namespace winstd
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
/// Clipboard management
|
||||
///
|
||||
class clipboard_opener
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Opens the clipboard for examination and prevents other applications from modifying the clipboard content
|
||||
///
|
||||
/// \sa [OpenClipboard function](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-openclipboard)
|
||||
///
|
||||
clipboard_opener(_In_opt_ HWND hWndNewOwner = NULL)
|
||||
{
|
||||
if (!OpenClipboard(hWndNewOwner))
|
||||
throw win_runtime_error("OpenClipboard failed");
|
||||
}
|
||||
|
||||
///
|
||||
/// Closes the clipboard
|
||||
///
|
||||
/// \sa [CloseClipboard function](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-closeclipboard)
|
||||
///
|
||||
virtual ~clipboard_opener()
|
||||
{
|
||||
CloseClipboard();
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
/// Console control handler stack management
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user