How get text value from a text field and pass to title of a form window?
The code below shows that I am confused with how var lptStringValue: [*:0]u16 works. Explanation from a Java Developer's perspective (with a few knowledge on pointers) would be greatly appreciated. And I also don't know how to print the lpStringValue for debugging.
var lpStringValue: [*:0]u16 = undefined;
_ = win32.GetWindowTextW(txtMessage, @ptrCast(&lpStringValue), 10);
// std.debug.print("{s}", .{lpStringValue});
_ = win32.SetWindowTextW(hwnd, lpStringValue);
// _ = win32.MessageBoxW(hwnd, lpStringValue, L("Message It"), win32.MB_OK);
Signatures:
// TODO: this type is limited to platform 'windows5.0'
pub extern "user32" fn GetWindowTextW(
hWnd: ?HWND,
lpString: [*:0]u16,
nMaxCount: i32,
) callconv(@import("std").os.windows.WINAPI) i32;
...
// TODO: this type is limited to platform 'windows5.0'
pub extern "user32" fn SetWindowTextW(
hWnd: ?HWND,
lpString: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) BOOL;