#if defined (_WIN32) || defined (_WIN64) #define WIN32_LEAN_AND_MEAN #include //----------------------------------------------------------------------------- void setRoundedCorners ( void* windowHandle, bool rounded ) { if ( auto hDwmApi = LoadLibrary ( "dwmapi.dll" ); hDwmApi ) { typedef HRESULT ( WINAPI* PFNSETWINDOWATTRIBUTE )( HWND hWnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute ); if ( auto pfnSetWindowAttribute = reinterpret_cast( GetProcAddress ( hDwmApi, "DwmSetWindowAttribute" ) ); pfnSetWindowAttribute ) { enum : DWORD { DWMWA_WINDOW_CORNER_PREFERENCE = 33, DWMWCP_DEFAULT = 0, DWMWCP_DONOTROUND, DWMWCP_ROUND, }; // Set corners to rounded auto preference = rounded ? DWMWCP_ROUND : DWMWCP_DONOTROUND; pfnSetWindowAttribute ( (HWND)windowHandle, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof ( preference ) ); } FreeLibrary ( hDwmApi ); } } //----------------------------------------------------------------------------- #endif