xsharp.eu • VK_* constants in resources
Page 1 of 1

VK_* constants in resources

Posted: Wed May 06, 2020 2:25 pm
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.

VK_* constants in resources

Posted: Wed May 06, 2020 2:38 pm
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.

VK_* constants in resources

Posted: Wed May 06, 2020 3:10 pm
by Serggio
Got it! Thank you!