VK_* constants in resources

We encourage new members to introduce themselves here. Get to know one another and share your interests.
Post Reply
Serggio
Posts: 46
Joined: Sun May 14, 2017 5:03 pm
Location: Ukraine

VK_* constants in resources

Post by Serggio »

The compiler doesn't see VK_* constants in rc-files.
For instance, in such a code VK_DELETE gives error "RC2104 undefined keyword or key name: VK_DELETE"

Code: Select all

CLIPPERKEYS ACCELERATORS
BEGIN
    46, VK_DELETE, VIRTKEY
END
The reference to VOWin32APILibrary is set and those VK_* constants are visible from prg-files but not from resources.
User avatar
Chris
Posts: 4599
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

VK_* constants in resources

Post by Chris »

Hi Serggio,

The VOXporter automatically replaces those define constants with their actual values. If you have ported your app without using the tool, then you will need to include those defines manually in the .rc file, like in

Code: Select all

#define VK_DELETE 0x2E
CLIPPERKEYS ACCELERATORS
BEGIN
    46, VK_DELETE, VIRTKEY
END
or you can create a separate file that holds all of the commonly used defines, name it for example ResourceDefines.xh and then just add on top of all of your .rc files this:

Code: Select all

#include "ResourceDefines.xh"

Also the VO compatible Window and Menu editors do the same thing, they write the defines in the .rc files when you save a Window or Menu instance.

Just to clarify this a bit, it is not the X# compiler that needs this, the resource compilation is done by the MS resource compiler (rc.exe). When this tool succeeds, then the X# compiler uses its output and embeds it in your X# exe or dll.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Serggio
Posts: 46
Joined: Sun May 14, 2017 5:03 pm
Location: Ukraine

VK_* constants in resources

Post by Serggio »

Got it! Thank you!
Post Reply