Use MSFTEDIT_CLASS for Rich Edit control when available.

This commit is contained in:
Sean Hall 2021-04-28 19:31:37 -05:00
Родитель fa8aaa0fbc
Коммит 0e7fa93306
3 изменённых файлов: 18 добавлений и 6 удалений

Просмотреть файл

@ -1,6 +1,6 @@
{ {
"msbuild-sdks": { "msbuild-sdks": {
"WixToolset.Sdk": "4.0.0-build-0211" "WixToolset.Sdk": "4.0.0-build-0213"
}, },
"sdk": { "sdk": {
"allowPrerelease": false "allowPrerelease": false

Просмотреть файл

@ -32,6 +32,7 @@ static void ShowErrorMessage(__in HRESULT hr);
//Global variables //Global variables
PRINTDLGEXW* vpPrintDlg = NULL; //Parameters for print (needed on both sides of WndProc callbacks) PRINTDLGEXW* vpPrintDlg = NULL; //Parameters for print (needed on both sides of WndProc callbacks)
LPSTR vpszEulaText = NULL; LPSTR vpszEulaText = NULL;
LPCWSTR vwzRichEditClass = NULL;
HRESULT vhr = S_OK; //Global hr, used by the functions called from WndProc to set errorcode HRESULT vhr = S_OK; //Global hr, used by the functions called from WndProc to set errorcode
@ -72,8 +73,18 @@ extern "C" UINT __stdcall PrintEula(MSIHANDLE hInstall)
ExitOnFailure(hr, "failed to read Eula text from MSI database"); ExitOnFailure(hr, "failed to read Eula text from MSI database");
// Have to load Rich Edit since we'll be creating a Rich Edit control in the window // Have to load Rich Edit since we'll be creating a Rich Edit control in the window
hr = LoadSystemLibrary(L"Riched20.dll", &hRichEdit); hr = LoadSystemLibrary(L"Msftedit.dll", &hRichEdit);
ExitOnFailure(hr, "failed to load rich edit 2.0 library"); if (SUCCEEDED(hr))
{
vwzRichEditClass = MSFTEDIT_CLASS;
}
else
{
hr = LoadSystemLibrary(L"Riched20.dll", &hRichEdit);
ExitOnFailure(hr, "failed to load rich edit 2.0 library");
vwzRichEditClass = RICHEDIT_CLASSW;
}
hr = CreateRichTextWindow(&hWndMain, &fRegisteredClass); hr = CreateRichTextWindow(&hWndMain, &fRegisteredClass);
ExitOnFailure(hr, "failed to create rich text window for printing"); ExitOnFailure(hr, "failed to create rich text window for printing");
@ -113,6 +124,7 @@ LExit:
::UnregisterClassW(WINDOW_CLASS, NULL); ::UnregisterClassW(WINDOW_CLASS, NULL);
} }
vwzRichEditClass = NULL;
if (NULL != hRichEdit) if (NULL != hRichEdit)
{ {
::FreeLibrary(hRichEdit); ::FreeLibrary(hRichEdit);
@ -242,7 +254,7 @@ LRESULT CALLBACK WndProc(
switch (message) switch (message)
{ {
case WM_CREATE: case WM_CREATE:
hWndRichEdit = ::CreateWindowExW(WS_EX_CLIENTEDGE, RICHEDIT_CLASSW, L"", ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_VSCROLL, CONTROL_X_COORDINATE, CONTROL_Y_COORDINATE, CONTROL_WIDTH, CONTROL_HEIGHT, hWnd, NULL, NULL, NULL); hWndRichEdit = ::CreateWindowExW(WS_EX_CLIENTEDGE, vwzRichEditClass, L"", ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_VSCROLL, CONTROL_X_COORDINATE, CONTROL_Y_COORDINATE, CONTROL_WIDTH, CONTROL_HEIGHT, hWnd, NULL, NULL, NULL);
break; break;
case WM_COMMAND: case WM_COMMAND:
wmId = LOWORD(wParam); wmId = LOWORD(wParam);

Просмотреть файл

@ -48,8 +48,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="WixToolset.Dutil" Version="4.0.65" /> <PackageReference Include="WixToolset.Dutil" Version="4.0.72" />
<PackageReference Include="WixToolset.WcaUtil" Version="4.0.18" /> <PackageReference Include="WixToolset.WcaUtil" Version="4.0.19" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" /> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" /> <PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" />
</ItemGroup> </ItemGroup>