forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow_station_and_desktop.h
43 lines (30 loc) · 1.22 KB
/
window_station_and_desktop.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_HOST_WIN_WINDOW_STATION_AND_DESKTOP_H_
#define REMOTING_HOST_WIN_WINDOW_STATION_AND_DESKTOP_H_
#include <windows.h>
#include "base/basictypes.h"
namespace remoting {
// Scoper for a pair of window station and desktop handles. Both handles are
// closed when the object goes out of scope.
class WindowStationAndDesktop {
public:
WindowStationAndDesktop();
~WindowStationAndDesktop();
HDESK desktop() const { return desktop_; }
HWINSTA window_station() const { return window_station_; }
// Sets a new desktop handle closing the owned desktop handle if needed.
void SetDesktop(HDESK desktop);
// Sets a new window station handle closing the owned window station handle
// if needed.
void SetWindowStation(HWINSTA window_station);
// Swaps contents with the other WindowStationAndDesktop.
void Swap(WindowStationAndDesktop& other);
private:
HDESK desktop_;
HWINSTA window_station_;
DISALLOW_COPY_AND_ASSIGN(WindowStationAndDesktop);
};
} // namespace remoting
#endif // REMOTING_HOST_WIN_WINDOW_STATION_AND_DESKTOP_H_