Skip to content

Commit

Permalink
Github Issue #75: Added an abstract class and a concrete class to cal…
Browse files Browse the repository at this point in the history
…l Windows api to register windows event hook for low level keyboard events, which will be used to hide/show Remini using just keyboard shortcuts
  • Loading branch information
AngryFender committed Feb 22, 2024
1 parent 854a8d8 commit 48020ea
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ set(PROJECT_SOURCES
settingsdialog.h
settingsdialog.cpp
settingsdialog.ui
iwindowapi.h
windowapi.h
windowapi.cpp
)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
Expand Down
22 changes: 22 additions & 0 deletions iwindowapi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef IWINDOWAPI_H
#define IWINDOWAPI_H


class IWindowApi{
public:
using HHOOK = void*;
using HOOKPROC = long long (*)(int, unsigned long, long);
using HINSTANCE = void*;
using DWORD = unsigned long;

public:
IWindowApi(){};
virtual ~IWindowApi()=default;
virtual void SetWindowsHookExInvoke(int idHook,
HOOKPROC lpfn,
HINSTANCE hmod,
DWORD dwThreadId)=0;

};

#endif // IWINDOWAPI_H
17 changes: 17 additions & 0 deletions windowapi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "windowapi.h"

WindowApi::WindowApi()
{

}

WindowApi::~WindowApi()
{

}

void WindowApi::SetWindowsHookExInvoke(int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId)
{
// keyboardEventHook= SetWindowsHookEx(idHook, lpfn, hmod, dwThreadId);
}

18 changes: 18 additions & 0 deletions windowapi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef WINDOWAPI_H
#define WINDOWAPI_H

#include "iwindowapi.h"
#include "Windows.h"

class WindowApi : public IWindowApi
{
public:
WindowApi();
~WindowApi();

// IWindowApi interface
public:
void SetWindowsHookExInvoke(int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId) override;
};

#endif // WINDOWAPI_H

0 comments on commit 48020ea

Please sign in to comment.