-
Oct 2nd, 2018, 05:20 PM
#1
Thread Starter
Addicted Member
[RESOLVED] How to force screen rotation?
I'll start off with "I have no code for this" as I don't know where to even start (or if it can be done).
The target device is a W10 SP tablet. Auto-Rotate would be disabled by default.
What I would like to do is have a way of "forcing" Windows to flip the display (the whole screen, not the app) 180deg (as if auto-rotate was on and it had just been tilted upside-down, but without doing it). Can this be done and if so how?
-
Oct 2nd, 2018, 06:23 PM
#2
Re: How to force screen rotation?
This is old so I don't know if it is still directly applicable:
https://msdn.microsoft.com/en-us/library/ms812499.aspx
There may be a newer API available but I just found that by searching for ".net windows 10 rotate screen programmatically". That's where you should start: with logical keywords in a web search.
-
Oct 2nd, 2018, 06:23 PM
#3
Re: How to force screen rotation?
First thing that comes to my mind is SendKeys ctrl+alt+down cursor
maybe a bit ghetto, and may not even work at all.
-
Oct 2nd, 2018, 06:24 PM
#4
Re: How to force screen rotation?
That's where you should start: with logical keywords in a web search.
Do you mean like.... google??
-
Oct 2nd, 2018, 06:25 PM
#5
Thread Starter
Addicted Member
Re: How to force screen rotation?
I did see that page already, but wasn't willing to even test it given how old it is. I didn't want to risk screwing up W10.
-
Oct 2nd, 2018, 06:39 PM
#6
Re: How to force screen rotation?
So did you search the web specifically for information regarding Windows 10 and that API? It seems that you really did know where to start after all but thought it would be a good idea to mislead us and withhold relevant information for some reason.
-
Oct 2nd, 2018, 06:41 PM
#7
Thread Starter
Addicted Member
Re: How to force screen rotation?
No, I just didn't see a that a page/solution meant for Windows XP to be worth bringing up when dealing with Windows 10. Sorry.
-
Oct 2nd, 2018, 06:45 PM
#8
Re: How to force screen rotation?
So you know for a fact that that API doesn't work in Windows 10?
-
Oct 2nd, 2018, 06:51 PM
#9
Thread Starter
Addicted Member
Re: How to force screen rotation?
okay, lets try this another way.
I started my search on google and found that article. Given that W XP and W10 (to my limited understanding) are completely different OS's, I closed the page and kept looking. No I have not tried that solution, as I had no reasonable expectation (in my mind anyway) that a) it would work and b) it wouldn't break something. I'm more than willing to test random code when it comes to forms, but when it comes to the OS if I don't know it will work (or at least be safe) I'm not going to touch it.
I thought I was being semi-smart about it. But I gather from your response that you don't agree.
-
Oct 2nd, 2018, 06:56 PM
#10
Re: How to force screen rotation?
Originally Posted by CWITT
Given that W XP and W10 (to my limited understanding) are completely different OS's
They aren't. Every new version of Windows brings new features and functionality but there's still huge swathes of code that makes the trip to a new version intact. Even if there are new APIs to do certain things, it doesn't mean that old ones don't work any more. I don't know for sure either way with that info but, if there's a new managed API for this, it's likely UWP-specific anyway.
-
Oct 2nd, 2018, 07:00 PM
#11
Thread Starter
Addicted Member
Re: How to force screen rotation?
Again, this is my limited knowledge speaking.. but isn't UWP apps that run "in" windows (like Forms of old)? If that is true, then how would a UWP tool have anything to do with altering the core windows display?
(not trying to be difficult, fyi)
-
Oct 2nd, 2018, 07:53 PM
#12
Re: How to force screen rotation?
If you want to affect Windows from your application then you have basically two choices:
1. You can invoke the Windows API directly.
2. You can invoke an API that someone (you, Microsoft or a third party) has written that will invoke the Windows API.
Microsoft have created managed APIs that are accessible only to UWP that can do things on Windows 10, which is the only Windows version that supports UWP, that other technologies (WinForms, WPF, etc) cannot do without invoking an older API. Basically, a lot of the dirty work is built into UWP but you need to get your hands dirty when using older technologies. The same is true of Windows Forms in comparison to VB6, where you're forced to resort to direct Windows API calls even more.
-
Oct 3rd, 2018, 10:39 AM
#13
Thread Starter
Addicted Member
Re: How to force screen rotation?
ah, that's the best explanation I've ever seen about the differences. thank you.
I guess it's time I start looking into UWP in general.
-
Oct 3rd, 2018, 10:50 AM
#14
Re: How to force screen rotation?
Using UWP means developing a Store app, which may or may not be desirable.
-
Oct 3rd, 2018, 10:56 AM
#15
Thread Starter
Addicted Member
Re: How to force screen rotation?
it does? oh.
ok, so slight topic shift. Ignoring UWP, what is the better format WPF or Windows Forms? Thus far everything I've done is in Windows Forms....
-
Oct 3rd, 2018, 02:54 PM
#16
Re: How to force screen rotation?
Originally Posted by CWITT
it does? oh.
ok, so slight topic shift. Ignoring UWP, what is the better format WPF or Windows Forms? Thus far everything I've done is in Windows Forms....
One question per thread so this thread would require its own. How ever that question is something that would of been asked countless of times and answered already over the internet.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|