OLD | NEW |
| (Empty) |
1 // Copyright 2004-2009 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 | |
16 | |
17 #ifndef OMAHA_BASE_WINDOW_UTILS_H_ | |
18 #define OMAHA_BASE_WINDOW_UTILS_H_ | |
19 | |
20 #include <atlcoll.h> | |
21 #include "base/basictypes.h" | |
22 | |
23 namespace omaha { | |
24 | |
25 // Flags for window requirements. | |
26 const uint32 kWindowMustBeTopLevel = 0x00000001; | |
27 const uint32 kWindowMustHaveSysMenu = 0x00000002; | |
28 const uint32 kWindowMustBeVisible = 0x00000004; | |
29 | |
30 class WindowUtils { | |
31 public: | |
32 // Finds all the primary windows owned by the given process. For the | |
33 // purposes of this function, primary windows are top-level, have a system | |
34 // menu, and are visible. | |
35 static bool FindProcessWindows(uint32 process_id, | |
36 uint32 window_flags, | |
37 CSimpleArray<HWND>* windows); | |
38 | |
39 // Forces the window to the foreground. | |
40 static void MakeWindowForeground(HWND wnd); | |
41 | |
42 // Returns true if the window is the "main window" of a process: | |
43 // if it's Visible, and Top Level | |
44 static bool IsMainWindow(HWND wnd); | |
45 | |
46 // Returns true if the window has a System Menu | |
47 static bool HasSystemMenu(HWND wnd); | |
48 | |
49 // Sets a window's icon to the specified icon embedded within the running exe | |
50 // module. | |
51 static HRESULT SetWindowIcon(HWND hwnd, WORD icon_id, HICON* hicon); | |
52 | |
53 private: | |
54 DISALLOW_IMPLICIT_CONSTRUCTORS(WindowUtils); | |
55 }; | |
56 | |
57 } // namespace omaha | |
58 | |
59 #endif // OMAHA_BASE_WINDOW_UTILS_H_ | |
OLD | NEW |