Wp3Dev
Wp3Dev

Reputation: 2079

error RC2104: undefined keyword or key name: DS_SETFONT

I am starting to learn about the Windows API. So I opened up Microsoft Visual C++ and created a new project. I chose Win32 project and it started up. I then clicked build and run before typing anything and I came up with this error:

error RC2104: undefined keyword or key name: DS_SETFONT....

The error told me it was in the windows resource file that I cannot edit. I looked on-line and I couldn't find anything on this topic.

How would I go about fixing this?

Upvotes: 5

Views: 18258

Answers (3)

reckard roland
reckard roland

Reputation: 1

I edited the resource file that has the problem and found an extra " at the end of the previous line, even the file is generated automatically by the translation manager that comes with Delphi 10.4.2 !!

original text: System_JSONConsts_SInvalidJavascriptQuote, L"Invalid JavaScript string quote character. Valid quote characters are ' and ""

modified: System_JSONConsts_SInvalidJavascriptQuote, L"Invalid JavaScript string quote character. Valid quote characters are ' and "

Upvotes: 0

Paul_S
Paul_S

Reputation: 1

For others encountering this problem: my issue seems to have originated in that I was working on an old project where the resource files were not generated in Visual Studio and the normal Wizard setups had not been completed.

I was attempting to add/change controls to the MYAPP.RC files defining the menu etc but was getting an error "RC2104 undefined keyword or keyname: DS_SETFONT." This is because the Symbol Directives needed the header # include "windows.h"

I figured this out and added # include "windows.h" to the resource.h file. Trouble is both the MYAPP.RC and resource.h files are auto generated and any manually inserted # include "windows.h" gets dumped each time.

This Microsoft Help page put me straight and I went to the Resource View -> Resource Includes -> Read-only symbol directives window and inserted: # include "windows.h"

Can now edit Resources no problem.

Upvotes: 0

Wasim A.
Wasim A.

Reputation: 9890

When the solution is generated, it removes #include <windows.h>.

Simply adding #include <windows.h> will fix it.

In my case, I added it in the *.rc file.

Upvotes: 12

Related Questions