mirror of
https://github.com/Ximi1970/systray-x.git
synced 2026-05-07 06:15:56 +02:00
close experiments
This commit is contained in:
@@ -39,36 +39,14 @@ unix:!macx: {
|
||||
QMAKE_LFLAGS += -lX11
|
||||
}
|
||||
win32: {
|
||||
LIBS += User32.lib
|
||||
# QMAKE_LFLAGS += -static -lwinpthread -static-libgcc -static-libstdc++ $$(QMAKE_LFLAGS_WINDOWS)
|
||||
|
||||
#
|
||||
# Windows host (not used in cross compiling with mingw on Linux)
|
||||
#
|
||||
contains(QMAKE_HOST.os, Windows): {
|
||||
contains(QMAKE_HOST.version, 192): {
|
||||
#
|
||||
# Windows 10 Universal CRT
|
||||
#
|
||||
UCRT_INCLUDE = "C:/Program Files (x86)/Windows Kits/10/include/10.0.10240.0/ucrt"
|
||||
UCRT_LIBS = "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.10240.0/ucrt"
|
||||
|
||||
INCLUDEPATH += $$UCRT_INCLUDE
|
||||
|
||||
contains(QMAKE_TARGET.arch, x86_64) {
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += $$UCRT_LIBS"/x64/ucrtd.lib"
|
||||
} else {
|
||||
LIBS += $$UCRT_LIBS"/x64/ucrt.lib"
|
||||
}
|
||||
} else {
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += $$UCRT_LIBS"/x86/ucrtd.lib"
|
||||
} else {
|
||||
LIBS += $$UCRT_LIBS"/x86/ucrt.lib"
|
||||
}
|
||||
}
|
||||
}
|
||||
LIBS += User32.lib
|
||||
LIBS += Comctl32.lib
|
||||
}
|
||||
}
|
||||
unix:macx: {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/*
|
||||
* System includes
|
||||
*/
|
||||
|
||||
#include <CommCtrl.h>
|
||||
|
||||
/*
|
||||
* Statics
|
||||
@@ -31,7 +31,12 @@ bool WindowCtrlWin::findWindow( const QString& title )
|
||||
|
||||
EnumWindows( &EnumWindowsProc, (LPARAM)(LPSTR)( title.toStdString().c_str() ) );
|
||||
|
||||
return false;
|
||||
if( m_tb_windows.length() == 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,8 +108,6 @@ void WindowCtrlWin::normalizeWindow( quint64 window )
|
||||
*/
|
||||
void WindowCtrlWin::hideWindow( HWND hwnd )
|
||||
{
|
||||
emit signalConsole( "Hide" );
|
||||
|
||||
long style = GetWindowLong( hwnd, GWL_STYLE );
|
||||
|
||||
style &= ~(WS_VISIBLE);
|
||||
@@ -114,4 +117,62 @@ void WindowCtrlWin::hideWindow( HWND hwnd )
|
||||
SetWindowLong( hwnd, GWL_STYLE, style );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
LRESULT CALLBACK WindowCtrlWin::mySubClassProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData )
|
||||
{
|
||||
MessageBoxA( NULL, "Test", "Test", MB_OK );
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
MessageBoxA( NULL, "Button down!", "Debug", MB_OK );
|
||||
break;
|
||||
|
||||
case WM_NCDESTROY:
|
||||
RemoveWindowSubclass( hWnd, &mySubClassProc, 1 );
|
||||
break;
|
||||
}
|
||||
|
||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Callback for the window enumaration
|
||||
*/
|
||||
LRESULT CALLBACK WindowCtrlWin::WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
MessageBoxA( NULL, "Test", "Test", MB_OK );
|
||||
|
||||
return TRUE;
|
||||
|
||||
if( uMsg == WM_CLOSE )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// return CallWindowProc( prev, hwnd, uMsg,wParam, lParam);
|
||||
|
||||
return DefWindowProc( hwnd, uMsg, wParam, lParam );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Close experiment
|
||||
*/
|
||||
void WindowCtrlWin::closeWindow( HWND hwnd )
|
||||
{
|
||||
emit signalConsole("Close Window intercept");
|
||||
|
||||
// SetWindowSubclass( hwnd, &mySubClassProc, 1, 0);
|
||||
|
||||
MessageBoxA( NULL, "Start test", "Test", MB_OK );
|
||||
|
||||
WNDPROC prev = (WNDPROC)SetWindowLongPtr( hwnd, GWLP_WNDPROC, (LONG_PTR)&WindowCtrlWin::WindowProc );
|
||||
}
|
||||
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
@@ -30,6 +30,11 @@ class WindowCtrlWin : public QObject
|
||||
*/
|
||||
explicit WindowCtrlWin( QObject *parent = nullptr );
|
||||
|
||||
|
||||
void closeWindow( HWND hwnd );
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief findWindow. Find window with title.
|
||||
*
|
||||
@@ -87,6 +92,20 @@ class WindowCtrlWin : public QObject
|
||||
*/
|
||||
static BOOL CALLBACK EnumWindowsProc( HWND hwnd, LPARAM lParam );
|
||||
|
||||
/**
|
||||
* @brief WindowProc
|
||||
*
|
||||
* @param hwnd
|
||||
* @param uMsg
|
||||
* @param wParam
|
||||
* @param lParam
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
static LRESULT CALLBACK WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
static LRESULT CALLBACK mySubClassProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData );
|
||||
|
||||
signals:
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,8 +48,7 @@ void WindowCtrl::slotWindowTest1()
|
||||
displayWindowElements( "- Mozilla Thunderbird" );
|
||||
// findWindow( 4313 );
|
||||
|
||||
|
||||
// captureWindow( "Debugging with Firefox Developer Tools - Mozilla Thunderbird" );
|
||||
// captureWindow( "- Mozilla Thunderbird" );
|
||||
|
||||
emit signalConsole("Test 1 done");
|
||||
}
|
||||
@@ -61,6 +60,13 @@ void WindowCtrl::slotWindowTest2()
|
||||
|
||||
// Do something.
|
||||
|
||||
|
||||
// foreach( quint64 win_id, getWinIds() )
|
||||
// {
|
||||
// closeWindow( (HWND)win_id );
|
||||
// }
|
||||
|
||||
|
||||
/*
|
||||
* Disconnect container?
|
||||
*/
|
||||
@@ -86,25 +92,25 @@ void WindowCtrl::slotWindowTest3()
|
||||
|
||||
bool WindowCtrl::captureWindow( const QString& title )
|
||||
{
|
||||
Q_UNUSED( title )
|
||||
emit signalConsole("Capture");
|
||||
|
||||
#ifdef FF_NEET
|
||||
|
||||
unsigned long WinId;
|
||||
if( !findWindow( title ) )
|
||||
{
|
||||
emit signalConsole("Capture error");
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wrap Thunderbird window
|
||||
*/
|
||||
m_tb_window = QWindow::fromWinId( WinId );
|
||||
m_tb_window = QWindow::fromWinId( getWinIds()[ 0 ] );
|
||||
m_tb_window->parent();
|
||||
|
||||
m_tb_container = QWidget::createWindowContainer( m_tb_window );
|
||||
|
||||
#endif
|
||||
m_tb_container->show();
|
||||
|
||||
emit signalConsole("Capture done");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user