Commit b83116ff authored by Elias Steurer's avatar Elias Steurer 🇩🇪
Browse files

Init with new name

parents
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
TEMPLATE = app
QT += qml quick gui opengl av
CONFIG += c++14
SOURCES += main.cpp \
src/screenplay.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH += [QtAVSourceCodeDir]/qml
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
src/screenplay.h
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <qt_windows.h>
#include <QWindow>
#include <QQuickView>
#include "src/screenplay.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine mainWindow(QUrl(QStringLiteral("qrc:/qml/mainWindow.qml")));
ScreenPlay sp(GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
return app.exec();
}
<RCC>
<qresource prefix="/">
<file>qml/mainWindow.qml</file>
<file>qml/ScreenPlay.qml</file>
</qresource>
</RCC>
import QtQuick 2.6
import QtQuick.Window 2.2
import QtCanvas3D 1.1
import QtQuick.Controls 2.1
import QtAV 1.07
Rectangle {
id: rectangle
color: "#f29f6a"
visible: true
width: 2560
height: 1080
}
import QtQuick 2.6
import QtQuick.Window 2.2
import QtCanvas3D 1.1
import QtQuick.Controls 2.1
Window {
id: rectangle
color: "#eeeeee"
visible: true
width: 1366
height: 768
Button {
id: button
text: qsTr("Close")
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
onClicked: Qt.quit();
}
}
#include "screenplay.h"
#include <QDebug>
BOOL WINAPI SearchForWorkerWindow(HWND hwnd, LPARAM lparam)
{
// 0xXXXXXXX "" WorkerW
// ...
// 0xXXXXXXX "" SHELLDLL_DefView
// 0xXXXXXXXX "FolderView" SysListView32
// 0xXXXXXXXX "" WorkerW <---- We want this one
// 0xXXXXXXXX "Program Manager" Progman
if (FindWindowExW(hwnd, nullptr, L"SHELLDLL_DefView", nullptr))
*reinterpret_cast<HWND*>(lparam) = FindWindowExW(nullptr, hwnd, L"WorkerW", nullptr);
return TRUE;
}
ScreenPlay::ScreenPlay(QWindow* parent)
: QWindow(parent)
{
}
ScreenPlay::ScreenPlay(int width, int height)
{
this->setHeight(height);
this->setWidth(width);
this->hwnd = (HWND)this->winId();
HWND progman_hwnd = FindWindowW(L"Progman", L"Program Manager");
// Spawn new worker window below desktop (using some undocumented Win32 magic)
// See
// https://www.codeproject.com/articles/856020/draw-behind-desktop-icons-in-windows
// for more details
const DWORD WM_SPAWN_WORKER = 0x052C;
SendMessageTimeoutW(progman_hwnd, WM_SPAWN_WORKER, 0xD, 0x1, SMTO_NORMAL,
1000, nullptr);
// Get window handle to the worker window and hide it
EnumWindows(SearchForWorkerWindow, reinterpret_cast<LPARAM>(&worker_hwnd));
ShowWindow(worker_hwnd, SW_SHOWDEFAULT);
SetParent(hwnd, worker_hwnd);
SetWindowLongPtr(hwnd, GWL_STYLE,
WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU);
SetWindowLongPtr(hwnd, GWL_EXSTYLE,
WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_NOACTIVATE | WS_EX_TOPMOST | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW);
ShowWindow(hwnd, SW_SHOWDEFAULT);
this->quickRenderer = new QQuickView(QUrl(QStringLiteral("qrc:/qml/ScreenPlay.qml")), this);
Qt::WindowFlags flags = this->flags();
this->setFlags(flags | Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint);
this->show();
quickRenderer->show();
}
ScreenPlay::~ScreenPlay()
{
qDebug()<< "exit";
ShowWindow(worker_hwnd, SW_HIDE);
}
#ifndef SCREENPLAY_H
#define SCREENPLAY_H
#include <QQuickView>
#include <QWindow>
#include <qt_windows.h>
class ScreenPlay : public QWindow {
Q_OBJECT
public:
explicit ScreenPlay(QWindow* parent = 0);
ScreenPlay(int width, int height);
~ScreenPlay();
signals:
public slots:
private:
HWND hwnd = nullptr;
HWND worker_hwnd = nullptr;
QQuickView* quickRenderer;
};
#endif // SCREENPLAY_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment