https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fd6701751220e9365eef0f84673d98f482d2ad3d

commit fd6701751220e9365eef0f84673d98f482d2ad3d
Author:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
AuthorDate: Thu Aug 8 13:36:03 2024 +0200
Commit:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
CommitDate: Wed Aug 28 22:03:05 2024 +0200

    [SETUP:REACTOS] Add some SetWindowRes* helper functions
---
 base/setup/reactos/reactos.c | 41 +++++++++++++++++++++++++++++++++++++++++
 base/setup/reactos/reactos.h | 21 +++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/base/setup/reactos/reactos.c b/base/setup/reactos/reactos.c
index fe08e2f428c..3dd9eae4e35 100644
--- a/base/setup/reactos/reactos.c
+++ b/base/setup/reactos/reactos.c
@@ -246,6 +246,47 @@ DisplayError(
     return iRes;
 }
 
+VOID
+SetWindowResTextW(
+    _In_ HWND hWnd,
+    _In_opt_ HINSTANCE hInstance,
+    _In_ UINT uID)
+{
+    WCHAR szText[256];
+    LoadStringW(hInstance, uID, szText, _countof(szText));
+    SetWindowTextW(hWnd, szText);
+}
+
+VOID
+SetWindowResPrintfVW(
+    _In_ HWND hWnd,
+    _In_opt_ HINSTANCE hInstance,
+    _In_ UINT uID,
+    _In_ va_list args)
+{
+    WCHAR ResBuffer[256];
+    WCHAR szText[256];
+
+    LoadStringW(hInstance, uID, ResBuffer, _countof(ResBuffer));
+    StringCchVPrintfW(szText, _countof(szText), ResBuffer, args);
+    SetWindowTextW(hWnd, szText);
+}
+
+VOID
+__cdecl
+SetWindowResPrintfW(
+    _In_ HWND hWnd,
+    _In_opt_ HINSTANCE hInstance,
+    _In_ UINT uID,
+    ...)
+{
+    va_list args;
+
+    va_start(args, uID);
+    SetWindowResPrintfVW(hWnd, hInstance, uID, args);
+    va_end(args);
+}
+
 static INT_PTR CALLBACK
 StartDlgProc(
     IN HWND hwndDlg,
diff --git a/base/setup/reactos/reactos.h b/base/setup/reactos/reactos.h
index a2c86c155f0..8beffc4c86a 100644
--- a/base/setup/reactos/reactos.h
+++ b/base/setup/reactos/reactos.h
@@ -255,6 +255,27 @@ DisplayError(
     _In_ UINT uIDMessage,
     ...);
 
+VOID
+SetWindowResTextW(
+    _In_ HWND hWnd,
+    _In_opt_ HINSTANCE hInstance,
+    _In_ UINT uID);
+
+VOID
+SetWindowResPrintfVW(
+    _In_ HWND hWnd,
+    _In_opt_ HINSTANCE hInstance,
+    _In_ UINT uID,
+    _In_ va_list args);
+
+VOID
+__cdecl
+SetWindowResPrintfW(
+    _In_ HWND hWnd,
+    _In_opt_ HINSTANCE hInstance,
+    _In_ UINT uID,
+    ...);
+
 #endif /* _REACTOS_PCH_ */
 
 /* EOF */

Reply via email to