Skip to content

Instantly share code, notes, and snippets.

@habibg1232191
Last active July 13, 2022 11:30
Show Gist options
  • Select an option

  • Save habibg1232191/8d618b0f08b13f593cb9d1380968b7f5 to your computer and use it in GitHub Desktop.

Select an option

Save habibg1232191/8d618b0f08b13f593cb9d1380968b7f5 to your computer and use it in GitHub Desktop.
#include "juliwindow2.h"
bool JuliWindow2::nativeEvent(const QByteArray &eventType, void *message, long *res) {
if(eventType == "windows_generic_MSG") {
MSG* ms = (MSG*) message;
res = (long*) WndProc(ms->hwnd, ms->message, ms->wParam, ms->lParam);
}
return true;
}
LRESULT CALLBACK JuliWindow2::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_NCLBUTTONDOWN: {
qDebug() << "WM_NCLBUTTONDOWN";
ReleaseCapture();
return DefWindowProc(hwnd, message, wParam, lParam);
}
case WM_NCHITTEST: {
qDebug() << "WM_NCHITTEST";
return HTCAPTION;
}
case WM_NCCALCSIZE: {
qDebug() << "WM_NCHITTEST";
return 0;
}
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
#ifndef JULIWINDOW2_H
#define JULIWINDOW2_H
#include <QQuickWindow>
#include "windows.h"
class JuliWindow2 : public QQuickWindow
{
Q_OBJECT
public:
bool nativeEvent(const QByteArray &eventType, void *message, long *res);
LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
};
#endif // JULIWINDOW2_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment