diff --git a/CMakeLists.txt b/CMakeLists.txt index e63ae52..62d360d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,3 +36,4 @@ add_subdirectory(GUI) add_subdirectory(GUI/host) add_subdirectory(texthook) add_subdirectory(extensions) +add_subdirectory(testbed) diff --git a/testbed/CMakeLists.txt b/testbed/CMakeLists.txt new file mode 100644 index 0000000..66c9427 --- /dev/null +++ b/testbed/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(Testbed WIN32 main.cpp resource.rc) diff --git a/testbed/main.cpp b/testbed/main.cpp new file mode 100644 index 0000000..dabe57e --- /dev/null +++ b/testbed/main.cpp @@ -0,0 +1,49 @@ +#include "common.h" +#include "defs.h" +#include "resource.h" + +wchar_t buffer[1000] = {}; +std::array vars = {}; + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) +{ + LoadLibraryW(ITH_DLL); + + ShowWindow(CreateDialogParamW(hInstance, MAKEINTRESOURCEW(IDD_DIALOG1), NULL, [](HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -> INT_PTR + { + switch (uMsg) + { + case WM_CLOSE: + { + DestroyWindow(hWnd); + } + return TRUE; + case WM_DESTROY: + { + PostQuitMessage(0); + } + return TRUE; + case WM_COMMAND: + { + if (HIWORD(wParam) == EN_CHANGE) + { + GetWindowTextW((HWND)lParam, buffer, std::size(buffer)); + try { vars.at(LOWORD(wParam) - IDC_EDIT1) = std::stoi(buffer); } + catch (...) {} + } + } + break; + } + return FALSE; + }, 0), SW_SHOW); + + std::thread([] { while (true) lstrlenW(L"こんにちは"); }).detach(); + + MSG msg; + while (GetMessageW(&msg, NULL, 0, 0) > 0) + { + TranslateMessage(&msg); + DispatchMessageW(&msg); + } + return 0; +} diff --git a/testbed/resource.h b/testbed/resource.h new file mode 100644 index 0000000..707fe42 --- /dev/null +++ b/testbed/resource.h @@ -0,0 +1,27 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by testractor.rc +// +#define IDD_DIALOG1 101 +#define IDC_EDIT1 1000 +#define IDC_EDIT2 1001 +#define IDC_EDIT3 1002 +#define IDC_EDIT4 1003 +#define IDC_EDIT5 1004 +#define IDC_EDIT6 1005 +#define IDC_EDIT7 1006 +#define IDC_EDIT8 1007 +#define IDC_EDIT9 1008 +#define IDC_EDIT10 1009 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1011 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/testbed/resource.rc b/testbed/resource.rc new file mode 100644 index 0000000..64dd59d Binary files /dev/null and b/testbed/resource.rc differ