Jump to content
  • Advertisement
Sign in to follow this  
ArtemisOzimmer

Position, Resize, and Titlebar Control of Windows 8/10 Universal Application Apps

This topic is 1006 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Greetings, I'm trying to recreate my game engine, which I originally programmed in Win32, as a Universal Application. I'm not doing an 'App' for the purposes of selling it or anything, it's just portfolio work for my own purposes, I just like to use up to date tech.

 

Anyway, I followed the tutorials outlined here: http://www.directxtutorial.com/LessonList.aspx?listid=112

 

But hit upon a snag when I tried to do something pretty basic; I want to position the app to open at coordinates 0,0 at a specific size with controls set so the width and height of the window cannot be shrunk, but the window can be minimized and closed.

 

I've found code to set the load size of the window:

 

ApplicationView::PreferredLaunchViewSize = Size{ 1000,600 };
ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize;

 

However after it's loaded it can still be drag resized and so forth.

 

I cannot find the app comparison to the Win32 hWnd SetWindowPos functionality, as outlined below:

 

https://msdn.microsoft.com/en-us/library/windows/desktop/ms633545%28v=vs.85%29.aspx

 

The only thing you seem able to do is edit the launch size as outlined above and edit the title bar, although I've not bee able to do the latter either.

 

Does anyone have any clue about what I'm missing here? Is it even possible to set the window position and scaling functionality when working with apps rather than Win32?

 

Thanks.

Share this post


Link to post
Share on other sites
Advertisement

From here:

 

ApplicationView::GetForCurrentView()->TryResizeView(desiredSize);  

 

Keep in mind that it can fail and refuse to change your size.

 

 

EDIT:  (I think technically there are some really hacky ways to get at the underlying window handle to a UWP, and you could try doing things with it, and it might work as well.  I think FindWindowEx, will still work.  Though if you use this in your app, you won't be able to put it on the store.  Might be useful for writing automated tests though)

Edited by ferrous

Share this post


Link to post
Share on other sites
Universal apps cannot be locked down like that because they are designed to be run on a wide variety of resolutions and screen sizes. In fact, on several types of devices (phones, xbox, tablets) the window will be full screen anyway and can't be resized no matter the screen resolution.

SetWindowPos or something similar doesn't exist because a "window" makes no sense on those devices since your X and Y pos will always be 0 and your width and height will be the size of the screen (minus taskbar, if any).

In short - if you want to make a Universal App then you should play nicely with the API and intentions of the system and be as device-independent as possible.

Otherwise that's what normal desktop apps are for smile.png Edited by SmkViper

Share this post


Link to post
Share on other sites

@SmkViper Ya know, I thought that was going to be the case, otherwise I would've found the functions for it within the documentation. I think I'm going to switch back to Win32 and carrying on as is. Like I say, I don't care about making it UA, I'm building for desktop in any case. Thanks.

Share this post


Link to post
Share on other sites
If you want to work with "up to date tech" then you can kind of get close to universal applications using WPA and .NET. The workflow with XAML and such is reasonably close to the UWA system and, if you want to use C++, the C++/CLI syntax for interfacing C++ and .NET has similarities to C++/CX that UWA uses. (The main difference being that C++/CLI actually compiles to .NET managed code, whereas C++/CX is more of a fancy COM wrapper that compiles to native)

Maybe that will give you some nice things to experiment with without falling all the way back to raw Win32 to MFC code smile.png

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!