diff --git a/app/SysTray-X/windowctrl-win.cpp b/app/SysTray-X/windowctrl-win.cpp index 369a726..c512cbc 100644 --- a/app/SysTray-X/windowctrl-win.cpp +++ b/app/SysTray-X/windowctrl-win.cpp @@ -135,4 +135,34 @@ void WindowCtrlWin::hideWindow( HWND hwnd ) SetWindowLong( hwnd, GWL_STYLE, style ); } + +/* + * Remove minimize, maximize, close, moving a window + */ +void WindowCtrlWin::changeStyleWindow( HWND hwnd ) +{ + emit signalConsole( QString("Set style for %1").arg((quint64)hwnd) ); + + long style = GetWindowLong( hwnd, GWL_STYLE ); + + emit signalConsole( QString("Has style %1").arg((quint64)style) ); + +// WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_BORDER | WS_DLGFRAME | +// WS_SYSMENU | WS_SIZEBOX | WS_GROUP | WS_TABSTOP + + +// style &= ~(WS_VISIBLE); +// style |= WS_EX_TOOLWINDOW; +// style &= ~(WS_EX_APPWINDOW); + +// long style = (WS_BORDER | WS_CAPTION) & (~WS_ICONIC); +// SetWindowLong( hwnd, GWL_STYLE, GetWindowLong( hwnd, GWL_STYLE)&~WS_SIZEBOX); + + style &= ~(WS_BORDER); + style &= ~(WS_DLGFRAME); + style &= ~(WS_SIZEBOX); + + SetWindowLongPtr( hwnd, GWL_STYLE, style ); +} + #endif // Q_OS_WIN diff --git a/app/SysTray-X/windowctrl-win.h b/app/SysTray-X/windowctrl-win.h index 8198bf1..bb63cec 100644 --- a/app/SysTray-X/windowctrl-win.h +++ b/app/SysTray-X/windowctrl-win.h @@ -76,6 +76,10 @@ class WindowCtrlWin : public QObject */ void normalizeWindow( quint64 window ); + + + void changeStyleWindow( HWND hwnd ); + private: /** diff --git a/app/SysTray-X/windowctrl.cpp b/app/SysTray-X/windowctrl.cpp index f83f5ab..360c4e7 100644 --- a/app/SysTray-X/windowctrl.cpp +++ b/app/SysTray-X/windowctrl.cpp @@ -76,8 +76,8 @@ void WindowCtrl::shutdown() /* * Remove the TB container */ - m_container->removeWidget( m_tb_container ); - m_container->hide(); +// m_container->removeWidget( m_tb_container ); +// m_container->hide(); /* * Cleanup @@ -121,8 +121,15 @@ void WindowCtrl::slotWindowTest1() // findWindow( 4313 ); // captureWindow( "Debugging with Firefox Developer Tools - Mozilla Thunderbird" ); + + +// findWindow( "- Mozilla Thunderbird" ); +// changeStyleWindow( (HWND)getWinIds()[ 0 ] ); + + captureWindow( "- Mozilla Thunderbird" ); + emit signalConsole("Test 1 done"); } @@ -154,6 +161,12 @@ void WindowCtrl::slotWindowTest3() // Do something. + EnableMenuItem(GetSystemMenu( (HWND)getWinIds()[ 0 ], FALSE), SC_CLOSE, + MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); + + SetWindowLong( (HWND)getWinIds()[ 0 ], GWL_STYLE, + GetWindowLong((HWND)getWinIds()[ 0 ], GWL_STYLE) & ~WS_MINIMIZEBOX); + emit signalConsole("Test 3 done"); } @@ -171,14 +184,17 @@ bool WindowCtrl::captureWindow( const QString& title ) * Wrap Thunderbird window */ m_tb_window = QWindow::fromWinId( getWinIds()[ 0 ] ); + // m_tb_window->setFlags( Qt::Widget | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint ); + // m_tb_container = QWidget::createWindowContainer( m_tb_window, nullptr, Qt::Widget | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint ); m_tb_container = QWidget::createWindowContainer( m_tb_window ); + m_tb_container->show(); /* * Integrate the window container */ - m_container->setWidget( m_tb_container ); - m_container->setGeometry( getWinGeos()[ 0 ] ); - m_container->show(); +// m_container->setWidget( m_tb_container ); +// m_container->setGeometry( getWinGeos()[ 0 ] ); +// m_container->show(); #endif