Resize a Window (On Windows OS) while Rendering - windows

All I want is to make a simple application that you can resize while rendering.
(IE resize while never once seeing the buffer out the edge of the screen)
Most commercial, professional, and major open source programs seem to be capable of this, while most all personal or hobbyist programs never seem to be capable of this. (I have no idea why)
I want to make a professional looking program like that.
A few examples of what I'm talking about:
https://gamedev.stackexchange.com/questions/127691/how-to-stop-sdl-from-freezing-the-rendering-while-resizing-the-window
https://www.gamedev.net/forums/topic/488074-win32-message-pump-and-opengl---rendering-pauses-while-draggingresizing/
https://en.sfml-dev.org/forums/index.php?topic=19388.5
What I have used in the past for windowing are:
SDL (Currently)
SFML
GLFW +OpenGL
And this problem applies to all 3 from what I can recall.
I would like to know the following:
If this is a problem that is solvable, please tell me why or why not
I've never once looked that low-level (OS APIs nor Graphics back-ends) so I just want to know why.
What's the way to solve this? Is it within my means?
Is the solution -really- a perfect solution? I've seen many people suggest solutions that have various problems
(IE minimizing the buffer but not getting rid of it entirely OR you got rid of it but there's a ton of flickering (I forgot why but it doesn't matter))
My current understanding is that this a Win32 API/Windows API related bug related to blocking.
I don't have any deeper understanding or knowledge on how to create my own solution easily, but if I must learn then I will.

Related

What mechanism Firefox uses to render it's Chrome and webpages?

I'm interested in implementation details of Firefox's rendering engine on Windows, in particular (however would be interesting to know how it differs from Linux, too). I couldn't find any source code online in a brisk search, it seems there is no other way but to download it all locally. And, sadly, I don't even have that much time to dive into it and figure this out, so I'm asking here maybe someone can make a brief explanation?
I tested Firefox window with WinSpy, and its obvious that it's not using GDI or any other native Windows API, as it has no child windows, only single monolithic one. Is it using DirectX\OpenGL and renders text and everything on 2 polygons glued into rectangle?

Screenshot of Hidden Window

I need to take a screenshot of a currently hidden window without giving focus to that window. I saw a post on this, here: Window screenshot using WinAPI
I've never used this method, so any advice is greatly appreciated.
I would like to be able to do this either in Windows or OS X, is it possible to do in OS X? It doesn't necessarily need to be in the same language or be cross platform, but of course, that's a plus :).
I would investigate the possibility of asking the window to draw itself into a bitmap, rather than trying to take its picture with a screenshot. That might be a way of making it irrelevant that the window is minimized. Something like the WM_PRINT or WM_PRINTCLIENT message. I suspect that's actually what the person was trying to do who asked the original question that you linked to. The biggest pitfall is if the window doesn't handle that message appropriately. Not all apps are so well-behaved. Also, I don't think it works for windows that are truly hidden, but I can't tell from your question and the flurry of articles you link to whether or not that's a real concern.
Unfortunately, I also know nothing about programming OS X; I'm just a user on that platform. You might try diving into the Qt sources to see how they're doing it cross-platform, if that's really important to you.
It's hard to imagine that you could have one solution that would work on Windows and OS X. The windowing frameworks are completely different. It would be harder to try to come up with one solution that to write two.
On Windows at least, I'm not convinced you'll have much luck taking a screenshot of a hidden or obscured window. When you search for this on the web, there are a gazillion hits for people asking that very question. None of them appear to have succeeded. If you factor in DWM and Aero glass then I think your chances of success are limited.

How create custom user interface for Windows?

There are many applications for Windows these days that don't use native windows controls, don't have standard window frames and generally look different. What are some recommended techniques for creating such interfaces?
There are good reasons not to. Like that you will most likely not do a better job than Windows does. (Maybe it will look better (in your opinion), but will it behave?). Or that it's not what most users expect. Or that it will look like s**** on Windows 2011.
That said, it's not hard. You simply handle the WM_NC* events like WM_NCPAINT or WM_NCHITTEST. NC stands for Non Client (window area). And of course, there is a trick on Vista/Win7 (you have to announce it to the DWM).
From an implementation aspect, you could employ WPF (Windows Presentation Foundation) assuming you code for .NET :) It has pretty bunch of skinnable controls, that may look like native and may not.
From a design aspect, if your interface isn't going to follow documented standards (like the Windows UI guidelines), it has to be intuitive. I think the new generation of Windows applications will go through a growing phase in a manner similar to the early days of the Web. After a time, some standards or common themes will evolve.
Can you give us some sample applications? Some apps that don't use native windows controls use cross-platform GUI libraries, like Qt for C++ or Tkinker. These maintain the same look across different platforms.
I wouldn't really recommend making your user interface different deliberately. You don't stand to gain much. Your controls are almost always going to be buggier than native controls, and you are requiring the user to learn something new. Now, if you're controls add a large enough value to be worth the users' time it can be okay. But making them get used to different looking buttons is rarely worth it.
I`m not sure if this answer your question.
You can use third party skinning controls like from Infragistics, or SkinSoft for example.
But like Bubba said I`d recommend going for WPF.
Model-View-Controller! It's as valuable here as in web apps or anywhere else. Be sure to keep the part of your program that generates the custom UI separate from the part of your program that flashes the BIOS.
I know this question is 10 years old but none of the answers mention using an option in visual studio, dont know if it existed at the time.
Theres an option to remove the border of the window in visual studio (called borderStyle). Thats the easiest way to do it, using C#. After removing the border, all you have to do is create a new interface. If you're looking to do it in C++, i think you need to use DWM. I will let an example i found here.
https://github.com/melak47/BorderlessWindow
Another example (maybe without DWM? didnt test):
https://social.msdn.microsoft.com/Forums/vstudio/en-US/b98c4c06-9581-44d3-8e5a-4adb2316e653/win32-about-styles-how-can-i-do-a-borderless-window?forum=vclanguage
There is a lot of people disencouraging to do it in this thread but there's no reason to not do it, if you know what you're doing your application can look great.

Programmatically enable multitouch support?

I am running windows7 on my laptop, and all is well, but I am jealous of the multitouch on macs. I don't really know how all of this "works", but i'm imagining that it couldn't be that hard to write a program to patch into windows that allows this.
Currently, if I put two fingers on the pad and drag around, it sortv half-heartedly tries to follow both. Or something. It's pitiful. After extended experimentation, I don't think it can really track both points at once. But perhaps I could detect the fumbling that occurs when I put my second finger down mathematically, and then "release" tracking on one of them.
Basically, I'm not trying for true multitouch (like stretching images), but I feel like I ought to be able to get something together that detects a double press as a right click. That's a step in the right direction.
What would I need to write that in? How would I install it?
If you're going to say it's impossible, then ignore that and take it from another direction. What if I wanted to enable a triple tap as a right click? (please no pre-built 3rd party solutions, I want to write this myself) That's certainly got to be possible.
How do I tap in to the resources I need?
This might be a hardware and or driver limitation. Not all touch surfaces (like trackpads) support multitouch.
You might want to check out Raw Input on msdn which supports alternative input methods.
Edit:
Note that the Raw Input API only provides access to multitouch if its supported by your hardware.
This is not possible, this is discussed on the www.insanelymac.com forum, where people create hackintosh pcs (basically pcs running mac osx). Several attempts have been made, but DUE to the construction and METHOD with which MANY touchpads collect sensory data it is impossible. Best of luck...

is it worth keeping the OS look and feel?

Is it worth to try to keep your GUI within the system looks ?
Every major program have their own anyways...
(visual studio, iexplorer, firefox, symantec utilities, adobe ...)
Or just the frame and dialogs should be left in the system look 'n feel range ?
update:
One easy exemple, if you want to add a close button to your tab, usually you make it against your current desktop theme. But if the user has a different theme, your close button is out of place, it doesn't fit the system look anymore.
I played with the uxtheme api, but there is nothing much you can do, and some themes i've seen are incomplete sets.
So to address this issue, the best way i see, is to do like visual studio/firefox/chrome roolup your own tab control with your theme...
I think, that unless your program becomes a very major part of the users life, you should strive to minimize "surprises" and maximimze recognizability (is that even a word?).
So, if you are making something that is used by 1.000 people for 10 minutes a day, go with system looks, and mechanisms.
If, on the other hand, you are making something that 100 people are using for 6 hours a day, I would start exploring what UI improvements and shortcuts I could cram in to make those 6 hours easier to deal with.
Notice however, that UI fixes must not come at the expense of performance. This is almost always the case in the beginning when someone thinks that simply overriding the OnPaint event in .Net will be sufficient.
Before you know it you are once again intercepting NC_PAINT and NC_BACKGROUNDERASE and all those little tricks to make it go as fast as the built-in controls.
I tend to agree with others here- especially Soraz and Smaci.
One thing I'll add, though. If you do feel that the OS L&F is too constraining, and you have good grounds for going beyond it, I'd strive to follow the priciple of "Pacing and leading" (which I'm borrowing here from an NLP context).
The idea is that you still want to capitalise as much as possible on your intended audidences familiarity with the host OS (there will be rare exceptions to this, as Smaci has already covered). So you use as much as possible of the "standard" controls and behaviours (this is the "pacing") - but extend it where necessary in ways that still "fit in" as much as possible (leading).
You've already mentioned some good examples of this principle at work - Visual Studio, even Office to some extend (Office is "special" as new UI styles that cut their teeth here often find their way back into future OS versions - or de-facto standards).
I'm bringing this up to contrast the type of apps that just "do it their way" - usually because they've been ported from another platform, or have been written to be cross-platform in GUI as well as core. Java apps often fall into this category, but they're not the only ones. It's not as bad as it used to be, but even today most pro audio apps have mongrel UIs, showing their lineage as they have been ported from one platform to another through the years. While there might be good business reasons for these examples, it remains that their UIs tend to suck and going this route should be avoided if in any way possible!
The overriding principle is still to follow the path of least surprise, and take account of your user's familiarity with the OS, and ratio of their time using your app to others on the OS.
Yes, if only because it enables the OS to use any accessability features that are built in like text-to-speech. There is nothing more annoying for someone who needs accessability features to have yet another UI that breaks all the tools they are used to.
I'd say it depends on the users, the application and the platform. The interface should be intuitive to the users, which is only the same as following system UI standards if they are appropriate for those users. For example, in the past I have been involved in developing hand held systems for dairy and bread delivery on Windows CE hand helds. The users in this case typically were not computer literate, and had a weak educational backround. The user interface focussed on ease of use through simple language and was modelled on a pre-existing paper form system. It made no attempt to follow the Windows look and feel as this would not have been appropriate.
Currently, I develop very graphical software for a user group that is typically 3rd level educated and very computer literate. The expectation here is that the software will adhere to and extend the Windows look and feel.
Software should be easy and intuitive where possible, and how to achieve this is entirely context dependent.
I'd like to reply with another question (Not really Stackoverflow protocol, but I think that, in this case, it's justified)
The question is 'Is it worth breaking the OS look and feel?'
In other words,
Do you have justification for doing so? (In order to present data in some way that's not possible within normal L&F)
What do you gain from doing so? (Improvinging usability?)
What do you lose from doing so? (Intuitiveness & familiarity?)
Don't simply do it 'To be different'
It depends on how wide you would define system look'n feel... But in general, you should keep it.
Do not surprise the user with differentiating from what he is used to. That's one of the reasons why we call him user ;-)
Firefox and Adobe products usually don't because they are targeting several plattforms which all have their own L&F. But Visual Studio keeps the typical Windows L&F. And, as long as you are developing only for Windows, so should you.
Apart from the fact that there is no well-defined look-n-feel on Windows, you should always try to follow the host platform native L&F. Note however that look-n-feel is just as much about how a program behaves as how it looks. Programs which behave in a counter-intuitive way is just as annoying as programs sporting their own ugly widgets.
Fraps is a good example (IMHO) of a program which is actually very useful, but breaks several user interface guidelines and looks really ugly.
If you're developing for Apple's Mac OS X or Microsoft Windows, the vendors supply interface guidelines which should be followed for any application to be "native".
See Are there any standards to follow in determining where to place menu items? for more information.
If you are on (or develop for) a Mac, then definitely YES!
And this should be true for Windows also.
In general, yes. But there's the occassional program that does well despite being not formatted for all the OSes it runs on. For example, emacs runs pretty much contrary to every interface guideline on OS X or Windows (and probably even gnome/KDE) and it's not going away any time soon.
I strongly recommend making your application look native.
A common mistake that developers who are porting an application to a new platform seem to make is that the new application should look-and-feel like it does on the old platform.
No, the new application should look-and-feel like all the other application that the user is used to on the new platform.
Otherwise, you get abominations like iTunes on Windows. The same UI design may be exactly right on one platform and very wrong on the next.
You will find that your users may not be able to pin-point why they dislike your application, but they just feel it hard to use.
Yes, there are valid exceptions, but they are rare (and sure enough, they tend to be the major applications like Office and Firefox, rather than the little ones). If you are unsure enough to have to ask on StackOverflow, your application isn't one of them.

Resources