Working with Windows Touch API

I’m trying to work with Windows Touch API directly. I understand there was a post earlier on this.

I’m including winuser.h (and windows.h)

However, there is a problem because Unreal has set WINVER 0x0600 (windows vista). However, I want to set it as WINVER 0x0603 (Windows 8.1 which is what I’m running). I tried #define but did not work. I tried defining the macro in Properties → NMake → Preprocessor Definitions. However, when I run Unreal Engine and output the value of WINVER is always 0x600.

How do I correct this so I can compile my code correctly? Note that Touch will not work if version is less than 0x0601.

UE4 hasx it’s own build system, rendering VS practically to text editor (UBT need VS compiler, but you can run UBT without VS openned). All UBT confiuration is done via xml file (i forget where it is :p) and more importently build scripts (C# files in module source directory, your project includes that).

I you want to change defines in *.Target.cs in your project, you add this to that function (if you dont have thatr function add it):

public override void SetupGlobalEnvironment(
	TargetInfo Target,
	ref LinkEnvironmentConfiguration OutLinkEnvironmentConfiguration,
	ref CPPEnvironmentConfiguration OutCPPEnvironmentConfiguration
	)
{
		OutCPPEnvironmentConfiguration.Definitions.Add("WINVER=0x0603");
}

Odd, I added that function to all my *.Target.cs files in my project and it’s still not changing the value of WINVER, even after I recreated my visual studio files and rebuilt the project.

Is there a way to call UBT directly to make sure that it’s using the *.Target.cs files?

SetupGlobalEnvironment does not work at all?

Adding that code to the *.Target.cs files didn’t seem to change the WINVER value, it stayed at 0x0600.

I found a workaround by changing Engine.h to include the Macro and that seems to have done the trick, but that involves changing Unreal Engine’s Source itself, would be nice to have to avoid modifying the engine’s source.

//C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\Engine\Public\Engine.h

#pragma once

#define _WIN32_WINNT 0x0603
#define WINVER 0x0603

//Rest of Engine.h...

I was able to initialize a touch window, hopefully this could evolve to become a multi-touch plugin for Unreal Windows 8 in the future. Thanks for the help!

There was also this question from earlier which was very similar.

Hmmm then then define overrides everything, well this can’t be helped. Don’t worry too much about need of modifying engine (or else you plan to do plugin), you got access to source exacly to give you ability to modify it. Not to mention what you changing is compile-time code only

I found the solution, define your macros in the constructor of MyProject.Build.cs ,like this:

public class MyProj : ModuleRules  
{  
    public MyProj(TargetInfo Target)  
    {  
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Slate", "SlateCore" });  
        PrivateDependencyModuleNames.AddRange(new string[] {  });  
  
  
        Definitions.Add("_CRT_SECURE_NO_WARNINGS");  
    }  
}  

also can see example here:

https://github.com/monsieurgustav/UE4-OSC/blob/master/OSC/Source/OSC/OSC.Build.cs