#19088: CommDlgExtendedError() returns 0xffff for a DLL GUI

16 views
Skip to first unread message

wxTrac

unread,
Mar 5, 2021, 7:01:26 PM3/5/21
to wx-...@googlegroups.com
#19088: CommDlgExtendedError() returns 0xffff for a DLL GUI
-------------------------------------+-------------------------
Reporter: sparhawk | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxMSW | Version: dev-latest
Keywords: CommonDialog fontpicker | Blocked By:
Blocking: | Patch: 0
-------------------------------------+-------------------------
I have a project which is loaded via a DLL from some non wxWidgets
application, using LoadLibrary() and GetProcaddress() to start the
application. I can open my MainFrame and use it, the only thing that is
not working is to use the wxFontPickerCtrl, or any other controls using
the CommonDialogs from Windows.

I have been using wxWidgets 3.1.4, built from source, as well, as running
the latest git version. I tested this with the DLL sample project, and
code reproduce the behavior there as well.

When I build the source using CMake, the DLL sample starts working, but
not when using the Visual Studion solution/project files. Consequently I
don't know what to set in my own project,as this is a normal Visual Studio
project.
I'm running Visual Studio 2019 Community Edition (latest version).
For a detailed discussion how to reproduce it I opened a thread on
https://forums.wxwidgets.org/viewtopic.php?f=1&t=48099

The window hierarchy looks like this (in the DLL):
wxFrame -> wxDialog(Modal) -> wxPanel -> wxFontPickerCtrl -> FontDlg



Steps to reproduce:

Extend wxWidgets/sample/my_dll.cpp with:
#include <wx/fontpicker.h>
And line 109:
sizer->Add
(
new wxFontPickerCtrl(p, wxID_ANY),
wxSizerFlags(0).Right().Border(wxALL, 10)
);


1. Downloaded the sources
2. Start VC 2019 Community, latest update.
3. Load solution from wxWidgets\build\msw\wx_vc16.sln
4. Build x64/Win32/Release/Debug
Exit VS 2019

5. Start VS 2019
6. Load Project file: wxWidgets\samples\dll\dll_vc9_my_dll.vcproj
6a. Apply above mentioned changes in my_dll.cpp.
7. Build x64/Debug
8. Load Project file: dll\dll_vc9_sdk_exe.vcproj
9. Build x64/Debug
10. Run it, doesn't work.
11. Load Project file: wxWidgets\samples\dll\dll_vc9_wx_exe.vcproj
12 Build x64/Debug
13. Run it. Works.

The same problem also shows in all build configurations, not just
x64/Debug.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19088>

wxTrac

unread,
Mar 5, 2021, 7:45:13 PM3/5/21
to wx-...@googlegroups.com
#19088: CommDlgExtendedError() returns 0xffff for a DLL GUI
-----------------------+-------------------------------------
Reporter: sparhawk | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxMSW | Version: dev-latest
Resolution: | Keywords: CommonDialog fontpicker
Blocked By: | Blocking:
Patch: 0 |
-----------------------+-------------------------------------

Comment (by MaartenB):

Seems indeed a manifest issue, as was mention on the forum.

Adding a manifest (for example
`wxdir/include/wx/msw/amd64_dpi_aware_pmv2.manifest`, or a none dpi-aware
one) seems to fix it.
Add it to Properties -> Manifest Tool -> Input and Output -> Additional
Manifest Files.
You should also see it in the CMake generated VS Project.

These vcproj files are all generated, and it was decided not to embed a
manifest in them since this can cause errors and warnings (see
[https://github.com/wxWidgets/wxWidgets/commit/5767a906eb95603e11d0c85d623aa09185830e76
this] commit). Other samples don't have this problem, because they include
a manifest via `sample.rc`.

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19088#comment:1>

wxTrac

unread,
Mar 6, 2021, 8:36:07 AM3/6/21
to wx-...@googlegroups.com
#19088: CommDlgExtendedError() returns 0xffff for a DLL GUI
-----------------------+-------------------------------------
Reporter: sparhawk | Owner:
Type: defect | Status: closed
Priority: normal | Milestone:
Component: wxMSW | Version: dev-latest
Resolution: fixed | Keywords: CommonDialog fontpicker
Blocked By: | Blocking:
Patch: 0 |
-----------------------+-------------------------------------
Changes (by sparhawk):

* cc: sparhawk@… (added)
* status: new => closed
* resolution: => fixed


Comment:

Oh! Man! Thanks! I read the comment in the thread, but I didn't realize
that this manifest has to be added to the executable. I tested it now with
my main target appliation, and this already had a manifest, so it works
now. Thanks!

Is this only required for 64bit builds or also Win32?

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19088#comment:2>

wxTrac

unread,
Mar 6, 2021, 12:40:40 PM3/6/21
to wx-...@googlegroups.com
#19088: CommDlgExtendedError() returns 0xffff for a DLL GUI
-----------------------+-------------------------------------
Reporter: sparhawk | Owner:
Type: defect | Status: closed
Priority: normal | Milestone:
Component: wxMSW | Version: dev-latest
Resolution: fixed | Keywords: CommonDialog fontpicker
Blocked By: | Blocking:
Patch: 0 |
-----------------------+-------------------------------------

Comment (by MaartenB):

I suspect Win32 requires it too.

Most likely the manifest should have the following section to work
correctly with windows common controls:
{{{
#!xml
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-
Controls" version="6.0.0.0" processorArchitecture="x86"
publicKeyToken="6595b64144ccf1df" language="*" />
</dependentAssembly>
</dependency>
}}}

(`processorArchitecture="amd64"` for 64-bit manifest)

--
Ticket URL: <https://trac.wxwidgets.org/ticket/19088#comment:3>
Reply all
Reply to author
Forward
0 new messages