Skip to content

Commit 168ace8

Browse files
committed
[Windows] fix UI
1 parent a64af3d commit 168ace8

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

Sources/OpenKey/win32/OpenKey/OpenKey/MainControlDialog.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ void MainControlDialog::initDialog() {
6464
TabCtrl_InsertItem(hTab, 2, &tci);
6565
tci.pszText = (LPWSTR)_T("Thông tin");
6666
TabCtrl_InsertItem(hTab, 3, &tci);
67-
TabCtrl_SetItemSize(hTab, 200, 50);
67+
RECT r;
68+
TabCtrl_GetItemRect(hTab, 0, &r);
69+
TabCtrl_SetItemSize(hTab, r.right - r.left, (r.bottom - r.top) * 1.428f);
70+
6871
//create tab page
6972
hTabPage1 = CreateDialogParam(hIns, MAKEINTRESOURCE(IDD_DIALOG_TAB_GENERAL), hDlg, tabPageEventProc, (LPARAM)this);
7073
hTabPage2 = CreateDialogParam(hIns, MAKEINTRESOURCE(IDD_DIALOG_TAB_MACRO), hDlg, tabPageEventProc, (LPARAM)this);
@@ -75,7 +78,7 @@ void MainControlDialog::initDialog() {
7578
POINT offset = { 0 };
7679
ScreenToClient(hDlg, &offset);
7780
OffsetRect(&rc, offset.x, offset.y); //convert to client coordinates
78-
rc.top += 50;
81+
rc.top += (LONG)((r.bottom - r.top) * 1.428f);
7982
SetWindowPos(hTabPage1, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_HIDEWINDOW);
8083
SetWindowPos(hTabPage2, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_HIDEWINDOW);
8184
SetWindowPos(hTabPage3, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_HIDEWINDOW);

Sources/OpenKey/win32/OpenKey/OpenKey/OpenKey.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void OpenKeyInit() {
152152
//init hook
153153
HINSTANCE hInstance = GetModuleHandle(NULL);
154154
hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, keyboardHookProcess, hInstance, 0);
155-
//hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, mouseHookProcess, hInstance, 0);
155+
hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, mouseHookProcess, hInstance, 0);
156156
hSystemEvent = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, NULL, winEventProcCallback, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);
157157
}
158158

@@ -253,11 +253,14 @@ static void SendKeyCode(Uint32 data) {
253253
}
254254
}
255255
}
256+
257+
if (vSupportMetroApp && OpenKeyHelper::getLastAppExecuteName().compare("ApplicationFrameHost.exe") == 0) //Metro App
258+
Sleep(5);
256259
}
257260

258261
static void SendBackspace() {
259262
SendInput(2, backspaceEvent, sizeof(INPUT));
260-
if (OpenKeyHelper::getLastAppExecuteName().compare("ApplicationFrameHost.exe") == 0) //Metro App
263+
if (vSupportMetroApp && OpenKeyHelper::getLastAppExecuteName().compare("ApplicationFrameHost.exe") == 0) //Metro App
261264
Sleep(5);
262265
if (IS_DOUBLE_CODE(vCodeTable)) { //VNI or Unicode Compound
263266
if (_syncKey.back() > 1) {
@@ -279,6 +282,9 @@ static void SendEmptyCharacter() {
279282
prepareUnicodeEvent(keyEvent[0], _newChar, true);
280283
prepareUnicodeEvent(keyEvent[1], _newChar, false);
281284
SendInput(2, keyEvent, sizeof(INPUT));
285+
286+
if (vSupportMetroApp && OpenKeyHelper::getLastAppExecuteName().compare("ApplicationFrameHost.exe") == 0) //Metro App
287+
Sleep(5);
282288
}
283289

284290
static void SendNewCharString(const bool& dataFromMacro = false) {

Sources/OpenKey/win32/OpenKey/OpenKey/OpenKeyHelper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,4 +322,4 @@ wstring OpenKeyHelper::getContentOfUrl(LPCTSTR url){
322322

323323
}
324324
return L"";
325-
}
325+
}

Sources/OpenKey/win32/OpenKey/OpenKey/OpenKeyHelper.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,5 @@ class OpenKeyHelper {
4646
static wstring getVersionString();
4747

4848
static wstring getContentOfUrl(LPCTSTR url);
49-
50-
5149
};
5250

0 commit comments

Comments
 (0)