bool recording = false;\r
HANDLE process = NULL;\r
\r
-int WINAPI\r
-WinMain(HINSTANCE hInstance,\r
- HINSTANCE hPrevInstance,\r
- LPSTR lpCmdLine,\r
- int nCmdShow)\r
+// int WINAPI\r
+// WinMain(HINSTANCE hInstance,\r
+// HINSTANCE hPrevInstance,\r
+// LPSTR lpCmdLine,\r
+// int nCmdShow)\r
+int main(int argc, char **argv)\r
{\r
\r
- HWND window = win::Window("Title", "MyWindowClass", hInstance);\r
-\r
- lay_id row1 = lay_item(&win::_::ctx);\r
- lay_insert(&win::_::ctx, win::_::root, row1);\r
- lay_set_size_xy(&win::_::ctx, row1, 0, 25);\r
- lay_set_behave(&win::_::ctx, row1, LAY_LEFT);\r
- lay_set_contain(&win::_::ctx, row1, LAY_ROW);\r
- lay_set_margins_ltrb(&win::_::ctx, row1, 5, 5, 5, 5);\r
- lay_id row2 = lay_item(&win::_::ctx);\r
- lay_insert(&win::_::ctx, win::_::root, row2);\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
- lay_set_contain(&win::_::ctx, col1, LAY_COLUMN);\r
- lay_set_margins_ltrb(&win::_::ctx, col1, 5, 0, 5, 0);\r
-\r
- HWND cbWindowTitle = win::CheckBox(window, "Window Title", row1, 100, 25, 0, 0);\r
- HWND cbFullscreenWindow = win::CheckBox(window, "Any Fullscreen Application", row1, 200, 25, 0, 0);\r
-\r
- HWND btnConnect = win::Button(window, "Connect", row1, 100, 25, 0, 0);\r
- win::Callback(btnConnect, BN_CLICKED, [&]() {\r
- ws::connect("ws://127.0.0.1:4444");\r
- });\r
+ //win::Window window("Title", "MyWindowClass", hInstance);\r
+ win::Window window("Title", "MyWindowClass", GetModuleHandle(0));\r
\r
- win::Callback(cbWindowTitle, BN_CLICKED, [&]() {\r
- SendMessageA(cbWindowTitle, BM_SETCHECK, SendMessageA(cbWindowTitle, BM_GETCHECK, 0, 0) ? BST_UNCHECKED : BST_CHECKED, 0);\r
- });\r
- win::Callback(cbFullscreenWindow, BN_CLICKED, [&]() {\r
- SendMessageA(cbFullscreenWindow, BM_SETCHECK, SendMessageA(cbFullscreenWindow, BM_GETCHECK, 0, 0) ? BST_UNCHECKED : BST_CHECKED, 0);\r
+ lay_context *ctx = &window.ctx;\r
+ lay_id root = window.lId;\r
+\r
+ win::Hwnd row1(&window, &window, 0, 0, 0, 25, LAY_ROW, LAY_LEFT);\r
+ lay_set_margins_ltrb(ctx, row1.lId, 5, 5, 5, 5);\r
+ win::Hwnd row2(&window, &window, 0, 0, 0, 0, LAY_ROW, LAY_FILL);\r
+ lay_set_margins_ltrb(ctx, row2.lId, 5, 5, 5, 5);\r
+\r
+ win::CheckBox cbWindowTitle(&window, &row1, "Window Title", 100, 25, 0, 0);\r
+ win::CheckBox cbFullscreenWindow(&window, &row1, "Any Fullscreen Application", 200, 25, 0, 0);\r
+\r
+ win::Button btnConnect(&window, &row1, "Connect", 100, 25, 0, 0);\r
+ btnConnect.onClick([&]() {\r
+ ws::connect("ws://127.0.0.1:4444");\r
});\r
\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::AddStyle(lstMonitoredProcesses, WS_VSCROLL);\r
-\r
- HWND btnUpdateWindows = win::Button(window, "Update", col1, 85, 25, 0, 0);\r
- HWND btnStartMonitoringName = win::Button(window, "Exe name >>", col1, 85, 25, 0, 0);\r
- HWND btnStartMonitoringPath = win::Button(window, "Full path >>", col1, 85, 25, 0, 0);\r
- HWND btnStopMonitoring = win::Button(window, "Remove", col1, 85, 25, 0, 0);\r
- win::Callback(btnUpdateWindows, BN_CLICKED, [&]() {\r
- win::ListClear(lstActiveProcesses);\r
+ win::ListBox lstActiveProcesses(&window, &row2, 0, 0, 0, LAY_FILL);\r
+ \r
+ win::Hwnd col1(&window, &row2, 0, 0, 80, 0, LAY_COLUMN, LAY_VCENTER);\r
+ lay_set_margins_ltrb(ctx, col1.lId, 5, 0, 5, 0);\r
+\r
+ win::ListBox lstMonitoredProcesses(&window, &row2, 0, 0, 0, LAY_FILL);\r
+ lstActiveProcesses.addStyle(WS_VSCROLL);\r
+ lstMonitoredProcesses.addStyle(WS_VSCROLL);\r
+\r
+ win::Button btnUpdateWindows(&window, &col1, "Update", 85, 25, 0, 0);\r
+ win::Button btnStartMonitoringName(&window, &col1, "Exe name >>", 85, 25, 0, 0);\r
+ win::Button btnStartMonitoringPath(&window, &col1, "Full path >>", 85, 25, 0, 0);\r
+ win::Button btnStopMonitoring(&window, &col1, "Remove", 85, 25, 0, 0);\r
+ btnUpdateWindows.onClick([&]() {\r
+ lstActiveProcesses.clear();\r
for (HWND hwnd = GetTopWindow(NULL); hwnd != nullptr;\r
hwnd = GetNextWindow(hwnd, GW_HWNDNEXT)) {\r
if (!IsWindowVisible(hwnd))\r
\r
char str[1024];\r
if (GetModuleFileNameExA(getHwndProcess(hwnd), 0, str, 1024) != 0 &&\r
- win::ListFindString(lstActiveProcesses, str) == LB_ERR) {\r
- win::ListAddString(lstActiveProcesses, str);\r
+ lstActiveProcesses.findString(str) == LB_ERR) {\r
+ lstActiveProcesses.addString(str);\r
}\r
}\r
});\r
- win::Callback(btnStartMonitoringName, BN_CLICKED, [&]() {\r
- int sel = win::ListGetSelectedIndex(lstActiveProcesses);\r
+ btnStartMonitoringName.onClick([&]() {\r
+ int sel = lstActiveProcesses.getSelectedIndex();\r
if (sel < 0) return;\r
\r
- std::string selStr = win::ListGetText(lstActiveProcesses, sel);\r
+ std::string selStr = lstActiveProcesses.getText(sel);\r
\r
char *filename = new char[selStr.size()];\r
std::memcpy(filename, selStr.c_str(), selStr.size());\r
PathStripPathA(filename);\r
\r
- if (win::ListFindString(lstMonitoredProcesses, std::string(filename)) == LB_ERR)\r
- win::ListAddString(lstMonitoredProcesses, std::string(filename));\r
+ if (lstMonitoredProcesses.findString(std::string(filename)) == LB_ERR)\r
+ lstMonitoredProcesses.addString(std::string(filename));\r
\r
delete[] filename;\r
});\r
- win::Callback(btnStartMonitoringPath, BN_CLICKED, [&]() {\r
- int sel = win::ListGetSelectedIndex(lstActiveProcesses);\r
+ btnStartMonitoringPath.onClick([&]() {\r
+ int sel = lstActiveProcesses.getSelectedIndex();\r
if (sel < 0) return;\r
- std::string selStr = win::ListGetText(lstActiveProcesses, sel);\r
- if (win::ListFindString(lstMonitoredProcesses, selStr) == LB_ERR)\r
- win::ListAddString(lstMonitoredProcesses, selStr);\r
+ std::string selStr = lstActiveProcesses.getText(sel);\r
+ if (lstMonitoredProcesses.findString(selStr) == LB_ERR)\r
+ lstMonitoredProcesses.addString(selStr);\r
});\r
- win::Callback(btnStopMonitoring, BN_CLICKED, [&]() {\r
- int sel = win::ListGetSelectedIndex(lstMonitoredProcesses);\r
+ btnStopMonitoring.onClick([&]() {\r
+ int sel = lstMonitoredProcesses.getSelectedIndex();\r
if (sel < 0) return;\r
- win::ListRemove(lstMonitoredProcesses, sel);\r
+ lstMonitoredProcesses.remove(sel);\r
});\r
\r
- win::ShowWindow(window);\r
+ window.show();\r
\r
ws::init();\r
\r
- SetTimer(window, 10123, 100, [](HWND, UINT, UINT_PTR, DWORD) {\r
+ SetTimer(window.hwnd, 10123, 100, [](HWND, UINT, UINT_PTR, DWORD) {\r
if (!recording) {\r
if (checkForegroundProcess("League of Legends.exe")) {\r
recording = true;\r
}\r
});\r
\r
- while (win::UpdateWindow(window)) {\r
+ while (window.update()) {\r
ws::update();\r
}\r
}\r