# C++ for a blueprint user - Calling (fDisplayMetrics) to Specify execute on non-primary monitor

**URL:** <https://forums.unrealengine.com/t/c-for-a-blueprint-user-calling-fdisplaymetrics-to-specify-execute-on-non-primary-monitor/376170>\
**Category:** Blueprint\
**Tags:** Struct, multiple-monitors, monitor, unreal-engine, question, Blueprint, CPP\
**Created:** [November 13, 2016, 12:47pm UTC](https://forums.unrealengine.com/t/c-for-a-blueprint-user-calling-fdisplaymetrics-to-specify-execute-on-non-primary-monitor/376170 "2016-11-13T12:47:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![superbjenks](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@superbjenks](https://forums.unrealengine.com/u/superbjenks)\
**Post date:** [November 13, 2016, 12:47pm UTC](https://forums.unrealengine.com/t/c-for-a-blueprint-user-calling-fdisplaymetrics-to-specify-execute-on-non-primary-monitor/376170/1 "2016-11-13T12:47:49Z")

</div>

Uncharted Territory for me, I have an actual C++ script I need to run before or when the game runs that detects how many monitors the system has and then start it on the second monitor. I have the code available from;

> **[Is it possible to choose the default screen in a multi monitor configuration?](https://forums.unrealengine.com/questions/294650/is-it-possible-to-choose-the-default-screen-in-a-m.html)**
>
> Hi all! I’m working on a project that requires a fullscreen window to appear in a specific monitor. My question is: Is it possible (via C++ or Blueprint) to detect how many monitors are being used and set a default monitor in which the program will...

But, I have only worked in blueprints up until now. I have Visual studio up with a blank face wondering what to do now.

Big questions that I don’t know,  
a. Where to I put the script?  
b. How do I make sure the game call the script?  
c. I assume It (the .cpp file) doesn’t have to be named anything specific, right?  
d. Can this be done in Blueprint?  
e. What’s the easiest way to buy you a coffee/beer?

I’m eternally grateful for anyone taking the time to get me pointed in the right direction.

Edit01: I found the FDisplayMetrics from;

[https://docs.unrealengine.com/latest/INT/API/Runtime/Core/GenericPlatform/FDisplayMetrics/index.html](https://docs.unrealengine.com/latest/INT/API/Runtime/Core/GenericPlatform/FDisplayMetrics/index.html)

Though I have been trying, I’m having no luck calling to it. I was thinking that I could cast to it and then break open the information like monitor info to just be able to dig deeper - nadda. I see that it say’s Struct so I tried to find and assign the struct to break that apart - nadda. It might be painfully obvious that I’m completely lost, because I am. I’ve been digging in the doc’s, fingers crossed.

---

<div class="post-metadata">

**Author:** ![FrederickD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FrederickD](https://forums.unrealengine.com/u/FrederickD)\
**Post date:** [March 15, 2017, 1:33pm UTC](https://forums.unrealengine.com/t/c-for-a-blueprint-user-calling-fdisplaymetrics-to-specify-execute-on-non-primary-monitor/376170/2 "2017-03-15T13:33:26Z")

</div>

I’m wondering about this too. It would be nice if Epic could include a console command to set the monitor used.

---

<div class="post-metadata">

**Author:** ![hverger](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@hverger](https://forums.unrealengine.com/u/hverger)\
**Post date:** [July 5, 2018, 3:45pm UTC](https://forums.unrealengine.com/t/c-for-a-blueprint-user-calling-fdisplaymetrics-to-specify-execute-on-non-primary-monitor/376170/3 "2018-07-05T15:45:59Z")

</div>

Did you ever find a solution ? It’s crazy that something this basic is not available in blueprints.

---

<div class="post-metadata">

**Author:** ![superbjenks](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@superbjenks](https://forums.unrealengine.com/u/superbjenks)\
**Post date:** [July 5, 2018, 5:38pm UTC](https://forums.unrealengine.com/t/c-for-a-blueprint-user-calling-fdisplaymetrics-to-specify-execute-on-non-primary-monitor/376170/4 "2018-07-05T17:38:48Z")

</div>

I had to ask a dedicated programmer to write some code and inject it into the engine to expose to blueprint functionality that is already available to C++ writers. I believe it was a pretty simple fix for someone who is already familiar with working with C++ within UE4. I’ve been away from that project for a couple years now so I don’t remember much more than that.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [July 5, 2018, 6:25pm UTC](https://forums.unrealengine.com/t/c-for-a-blueprint-user-calling-fdisplaymetrics-to-specify-execute-on-non-primary-monitor/376170/5 "2018-07-05T18:25:14Z")

</div>

You need to call this function to get info

> **[FDisplayMetrics::GetDisplayMetrics](https://docs.unrealengine.com/5.1/en-US/API/Runtime/ApplicationCore/GenericPlatform/FDisplayMetrics/GetDisplayMetrics/)**

Create FDisplayMetrics struct then put it as argument of that function and it will be filled with information.

You don’t need to “inject” any code to engine to expose functionality to blueprint as long as APIs are exposed to other modules. Just make blueprint function that calls that C++ function.

---

<div class="post-metadata">

**Author:** ![HashemShepard](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/hashemshepard/32/1201564_2.png) [@HashemShepard](https://forums.unrealengine.com/u/HashemShepard)\
**Post date:** [June 28, 2026, 11:01am UTC](https://forums.unrealengine.com/t/c-for-a-blueprint-user-calling-fdisplaymetrics-to-specify-execute-on-non-primary-monitor/376170/6 "2026-06-28T11:01:21Z")

</div>

this is much easier to use : [Multi-Monitor Display Controller | Fab](https://www.fab.com/listings/8cc2b168-3642-4e24-9aa8-750c0bc49771)
