Read Windows Forms login fields and associate their labels
This commit is contained in:
1 parent
d7ea005a1f
commit
25e38907d3
9 files changed
+149
-25
No files matched your search
+32
-4
@@ -1,6 +1,21 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef WINE_ACCESS_WINFORMS_FIXTURE
|
||||
static const WCHAR *editClass = L"WindowsForms10.EDIT.app.0.fixture_r7_ad1";
|
||||
static const WCHAR *staticClass = L"WindowsForms10.STATIC.app.0.fixture_r7_ad1";
|
||||
static void register_control(HINSTANCE instance, const WCHAR *nativeName, const WCHAR *managedName) {
|
||||
WNDCLASSEXW cls = {0};
|
||||
cls.cbSize = sizeof(cls);
|
||||
if (!GetClassInfoExW(NULL, nativeName, &cls)) ExitProcess(3);
|
||||
cls.hInstance = instance;
|
||||
cls.lpszClassName = managedName;
|
||||
if (!RegisterClassExW(&cls)) ExitProcess(4);
|
||||
}
|
||||
#else
|
||||
static const WCHAR *editClass = L"Edit";
|
||||
#endif
|
||||
|
||||
static HWND editor, password;
|
||||
static int step;
|
||||
|
||||
@@ -115,17 +130,30 @@ static LRESULT CALLBACK window_proc(HWND window, UINT message, WPARAM wp, LPARAM
|
||||
|
||||
int WINAPI WinMain(HINSTANCE instance, HINSTANCE previous, LPSTR args, int show) {
|
||||
(void)previous; (void)args; (void)show;
|
||||
#ifdef WINE_ACCESS_WINFORMS_FIXTURE
|
||||
register_control(instance, L"Edit", editClass);
|
||||
register_control(instance, L"Static", staticClass);
|
||||
#endif
|
||||
WNDCLASSW cls = {0};
|
||||
cls.hInstance = instance; cls.lpszClassName = L"WineAccessEditFixture";
|
||||
cls.lpfnWndProc = window_proc; RegisterClassW(&cls);
|
||||
HWND window = CreateWindowW(cls.lpszClassName, L"Wine editor fixture", WS_OVERLAPPEDWINDOW,
|
||||
120, 120, 500, 300, NULL, NULL, instance, NULL);
|
||||
editor = CreateWindowW(L"Edit", L"alpha beta\r\nsecond line",
|
||||
editor = CreateWindowW(editClass, L"alpha beta\r\nsecond line",
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL,
|
||||
10, 10, 450, 150, window, NULL, instance, NULL);
|
||||
password = CreateWindowW(L"Edit", L"private-password-fixture",
|
||||
WS_CHILD | WS_VISIBLE | ES_PASSWORD, 10, 180, 300, 30,
|
||||
100, 10, 350, 150, window, NULL, instance, NULL);
|
||||
password = CreateWindowW(editClass, L"private-password-fixture",
|
||||
WS_CHILD | WS_VISIBLE | ES_PASSWORD, 100, 180, 300, 30,
|
||||
window, NULL, instance, NULL);
|
||||
#ifdef WINE_ACCESS_WINFORMS_FIXTURE
|
||||
// Labels are created after the fields, like the observed BARD login.
|
||||
CreateWindowW(staticClass, L"Password:", WS_CHILD | WS_VISIBLE, 10, 183, 85, 20,
|
||||
window, NULL, instance, NULL);
|
||||
CreateWindowW(staticClass, L"Email:", WS_CHILD | WS_VISIBLE, 10, 13, 60, 20,
|
||||
window, NULL, instance, NULL);
|
||||
CreateWindowW(staticClass, L"Unrelated:", WS_CHILD | WS_VISIBLE, 10, 220, 80, 20,
|
||||
window, NULL, instance, NULL);
|
||||
#endif
|
||||
HMENU menu = CreateMenu();
|
||||
AppendMenuW(menu, MF_STRING, 1, L"Test menu");
|
||||
SetMenu(window, menu);
|
||||
|
||||
Reference in new issue
Block a user