title: Qt::nativeEvent calls
body: <p>I am working on a Windows 8 x64 laptop. Developing with Qt5.
  I have some difficulties to handle non-client area color (especially the color frame).
  I did not find some easy-to-use functions or processes to do that. I found that the DWM message to handle for the title bar color is WM_DWMCOLORIZATIONCOLORCHANGED and I would like to modify its wParam variable to set a new color.</p>
  
  <p>For now I am trying to extend the frame into the client area, using the QtWin::extendFrameIntoClientArea function in an implementation of the nativeEvent function. as it follows:</p>
  
  <pre><code>bool SkyFlies::nativeEvent(const QByteArray &amp;eventType, void *message, long *result)
  {
    Q_UNUSED(result);
    Q_UNUSED(eventType);
  
    MSG *msg = static_cast&lt;MSG*&gt;(message);
    if(msg-&gt;message == WM_ACTIVATE)
    {
       const QMargins marge(-1, -1, -1, -1);
       QtWin::extendFrameIntoClientArea(this, marge);
    }
    return false;
  }
  </code></pre>
  
  <p>My question is the following:
  In the piece of code where I would like to call the preceding function,</p>
  
  <pre><code>SkyFlies::SkyFlies()
  {
    ...
    this-&gt;nativeEvent();
    ...
  }
  </code></pre>
  
  <p>I would like to know how to fill the function parameters.
  I know it sounds a bit foolish, but I quite stuck.</p>
  
  <p>Thanks!</p>
  
  <p>Here is an update:</p>
  
  <p>errors like LNK2019 unresolved external symbol... really suck!!!</p>
  
  <p>As I googled my concerns, I found a pretty code to customize the window frame. I used it in my code and after fixing compiler errors, I got a LNK 2019 error for the <strong>DwmExtendFrameIntoClientArea</strong> function
  here is the code:
  the header file-</p>
  
  <pre><code>#include &lt;QtWidgets&gt;
  
  #ifdef Q_OS_WIN
  
  #include &lt;Windows.h&gt;
  #include &lt;WinUser.h&gt;
  #include &lt;windowsx.h&gt;
  #include &lt;dwmapi.h&gt;
  #include &lt;minmax.h&gt;
  #include &lt;gdiplus.h&gt;
  #include &lt;gdipluscolor.h&gt;
  
  #endif
  
  class SkyFlies : public QMainWindow
  {
      Q_OBJECT
  
      ...
  
      void showEvent(QShowEvent *event);  // Manage window borders
      void windowBorderless();    // Show a borderless window for Windows system
      void windowShadow();    // Set shadow border effect
  
      ...
  };
  </code></pre>
  
  <p>The implementation file-</p>
  
  <pre><code>// Manage window borders
  void SkyFlies::showEvent(QShowEvent *event)
  {
      QWidget::showEvent(event);
  
  #ifdef Q_OS_WIN
  
      this-&gt;windowBorderless();
  
  #endif
  }
  
  #ifdef Q_OS_WIN
  
  void SkyFlies::windowBorderless()
  {
      if(this-&gt;isVisible())
      {
          SetWindowLongPtr((HWND)winId(), GWL_STYLE, WS_POPUP | WS_CAPTION | WS_THICKFRAME | WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
          this-&gt;windowShadow();
          SetWindowPos((HWND)winId(), 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
      }
  }
  
  void SkyFlies::windowShadow()
  {
      const MARGINS shadow={1, 1, 1, 1};
      HRESULT hr = S_OK;
      hr = DwmExtendFrameIntoClientArea((HWND)winId(), &amp;shadow);
  }
  
  #endif
  </code></pre>
  
  <p>Please, how can I resolve the LNK2019 issue?
  I tried to run QMake without any success. Here is my .pro file:</p>
  
  <pre><code>QT += widgets
  
  SOURCES += \
      main.cpp \
      SkyFlies.cpp
  
  HEADERS += \
      SkyFlies.h \
      SkyWord.h
  </code></pre>
  
  <p>The SkyWord file is empty.
  Thanks</p>
  
  <p>As another update, I just read the last answer, I fixed the linker issue few hours ago by adding</p>
  
  <pre><code>#pragma comment (lib,"Dwmapi.lib")
  </code></pre>
  
  <p>in the header file.
  In definitive, I got a window extended through the title bar. Now I'm struggling to find a way to change the color of the title bar. But I don't see any satisfactory solution. I thought that I could handle the WM_DWMCOLORIZATIONCHANGED message but no.</p>
  
  <p>And the MSDN example about custom title bar(<a href="http://msdn.microsoft.com/en-us/library/bb688195%28VS.85%29.aspx#appendixb" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb688195%28VS.85%29.aspx#appendixb</a>) do not talk about changing colors. But maybe there are things to do with the WM_NCPAINT message.</p>