void\r
startRecording()\r
{\r
- MessageBoxA(NULL, "Start", "Start Start", MB_OK);\r
+ ws::sendRequest("StartRecord");\r
}\r
\r
void\r
stopRecording()\r
{\r
- MessageBoxA(NULL, "Stop", "Stop Stop", MB_OK);\r
+ ws::sendRequest("StopRecord");\r
}\r
\r
bool\r
}\r
\r
bool\r
-checkNotepadWindow()\r
+checkForegroundProcess(std::string exeName)\r
{\r
HWND fgHwnd = GetForegroundWindow();\r
HANDLE fgHandle = getHwndProcess(fgHwnd);\r
\r
char filename[1024];\r
int len = GetModuleFileNameExA(fgHandle, NULL, filename, 1024);\r
+ PathStripPathA(filename);\r
\r
- return strcmp(filename, "C:\\Windows\\System32\\notepad.exe") == 0;\r
+ return strcmp(filename, exeName.c_str()) == 0;\r
}\r
\r
+bool recording = false;\r
+HANDLE process = NULL;\r
\r
int WINAPI\r
WinMain(HINSTANCE hInstance,\r
LPSTR lpCmdLine,\r
int nCmdShow)\r
{\r
- bool recording = false;\r
- HANDLE process = NULL;\r
\r
HWND window = win::Window("Title", "MyWindowClass", hInstance);\r
\r
lay_set_size_xy(&win::_::ctx, row2, 0, 0);\r
lay_set_behave(&win::_::ctx, row2, LAY_FILL);\r
lay_set_contain(&win::_::ctx, row2, LAY_ROW);\r
+ lay_set_margins_ltrb(&win::_::ctx, row2, 5, 5, 5, 5);\r
lay_id col1 = lay_item(&win::_::ctx);\r
lay_set_size_xy(&win::_::ctx, col1, 80, 0);\r
lay_set_behave(&win::_::ctx, col1, LAY_VCENTER);\r
win::Callback(btnConnect, BN_CLICKED, [&]() {\r
ws::connect("ws://127.0.0.1:4444");\r
});\r
- \r
- HWND btnIdentify = win::Button(window, "Identify", row1, 100, 25, 0, 0);\r
- win::Callback(btnIdentify, BN_CLICKED, [&]() {\r
- ws::identify();\r
- });\r
\r
win::Callback(cbWindowTitle, BN_CLICKED, [&]() {\r
SendMessageA(cbWindowTitle, BM_SETCHECK, SendMessageA(cbWindowTitle, BM_GETCHECK, 0, 0) ? BST_UNCHECKED : BST_CHECKED, 0);\r
SendMessageA(cbFullscreenWindow, BM_SETCHECK, SendMessageA(cbFullscreenWindow, BM_GETCHECK, 0, 0) ? BST_UNCHECKED : BST_CHECKED, 0);\r
});\r
\r
- HWND lstActiveProcesses = win::ListBox(window, row2, 0, 0, 0, LAY_FILL);\r
+ HWND lstActiveProcesses = win::ListView(window, row2, 0, 0, 0, LAY_FILL);\r
lay_insert(&win::_::ctx, row2, col1);\r
HWND lstMonitoredProcesses = win::ListBox(window, row2, 0, 0, 0, LAY_FILL);\r
win::AddStyle(lstActiveProcesses, WS_VSCROLL);\r
win::ListRemove(lstMonitoredProcesses, sel);\r
});\r
\r
-\r
- win::ShowNotificationIcon(hInstance, window);\r
-\r
win::ShowWindow(window);\r
\r
ws::init();\r
\r
- while (win::UpdateWindow(window)) {\r
- ws::update();\r
-\r
+ SetTimer(window, 10123, 100, [](HWND, UINT, UINT_PTR, DWORD) {\r
if (!recording) {\r
- if (checkNotepadWindow()) {\r
+ if (checkForegroundProcess("League of Legends.exe")) {\r
+ recording = true;\r
process = getHwndProcess(GetForegroundWindow());\r
startRecording();\r
- recording = true;\r
}\r
} else {\r
if (!checkProcessRunning(process)) {\r
+ recording = false;\r
process = NULL;\r
stopRecording();\r
- recording = false;\r
}\r
}\r
+ });\r
+\r
+ while (win::UpdateWindow(window)) {\r
+ ws::update();\r
}\r
}\r