8

寻找有关如何使用 HWND 窗口进入全屏模式的一些解释,我发现了这个响应Win32: full-screen and hidden taskbar

铬响应代码有这一行:

saved_window_info_.maximized = !!::IsZoomed(hwnd_);

从此文件https://src.chromium.org/viewvc/chrome/trunk/src/ui/views/win/fullscreen_handler.cc?revision=HEAD&view=markup第 56 行

我读:

var bar equal not not of mother method

这个对吗 ?

这个“!!::IsZoomed()”是什么意思?

为什么不只是

saved_window_info_.maximized = CWnd::IsZoomed(hwnd_);

?

4

1 回答 1

10

The !! is simply ! and !, two negations. Double negation reduces to noop, but it casts the value to bool. So consider that an alternative syntax to (bool). It's advantage is that it:

  1. it works in C which did not have a separate bool type in C89 (forces the value of 0 or 1) and
  2. MSC++ does not generate the silly “performance warning” for it like it does for (bool).

And the rest is simply ::IsZoomed, i.e. function IsZoomed from top-level namespace.

于 2017-04-24T10:01:29.127 回答