Click here to Skip to main content
15,880,608 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have some C code for a Win32 DLL that I'm trying to modify, but I'm having to guess at the build settings, because it is just code. I've got it building in VS2010, and it seems to be mostly working (despite some dodgy coding!)

However, calls to ChooseFont don't seem to want to work - just keeps giving me DERR_DIALOGFAILURE errors. I even tried adding in my own very simple instance - but same result. Are there any build settings related to Common Dialog stuff in Win32 apps that I may have overlooked? Any other reasons why it might refuse to show the font dialog?

What I have tried:

Getting the error code - it isn't very helpful!
Posted
Updated 27-Oct-23 4:59am
v2
Comments
Rick York 26-Oct-23 23:03pm    
Here's the prototype for it : BOOL WINAPI ChooseFont( _Inout_ PCHOOSEFONT pcf ); The question is what does your CHOOSEFONT structure look like? That determines how it works.

You must do something wrong in the call like not provided enought data with null pointers. Read the documentation and the example code from Microsoft to learn it.
 
Share this answer
 
A hint from 'the documentation[^]':
CDERR_DIALOGFAILURE
0xFFFF
The dialog box could not be created. The common dialog box function's call to the DialogBox function failed. For example, this error occurs if the common dialog box call specifies an invalid window handle.
 
Share this answer
 
Comments
Kyudos 29-Oct-23 18:01pm    
I have (I hope it goes without saying!) read the documentation, and checked everything I can about the structure. Bear in mind this is code for a commercial product that we purchased along with the DLL it supposedly represents. It obviously works as intended in the DLL - but not in my rebuilt version. Hence my first assumption is that the problem relates to how I've reconstructed the build project, rather than the the code itself. As I said, I've copied in other ChooseFont example code which similarly fails. Other common dialog stuff (printer, open, save etc.) all seems fine....I just seem to have an issue with the fonts...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900