ShowWindow vs SWP_SHOWWINDOW vs WS_VISIBLE [英] ShowWindow vs SWP_SHOWWINDOW vs WS_VISIBLE
本文介绍了ShowWindow vs SWP_SHOWWINDOW vs WS_VISIBLE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下显示窗口的方法有什么区别:
What is the difference between the following methods of showing a window:
ShowWindow
函数.- 带有
SWP_SHOWWINDOW
标志的SetWindowPos
函数. SetWindowLong
函数和WS_VISIBLE
添加到GWL_STYLE
.
还有其他方法吗?
推荐答案
我认为它们大致相同,但每个都有额外的功能:
I think that they are mostly the same, but with additional capabilities for each one:
SetWindowLong
将WS_VISIBLE
添加到GWL_STYLE
可能是最不有趣的:如果有一个函数可以完全执行什么操作,为什么还要搞乱样式位你需要.SetWindowPos
和SWP_SHOWWINDOW
可以让你在显示窗口的同时设置它的位置和大小,用一个原子操作,让没人-程序或用户 - 可能会看到可见-未移动或移动-不可见的窗口.ShowWindow
函数涉及很多魔法,尤其是在程序中第一次调用时.此外,它具有SW_SHOWDEFAULT
标志,该标志很少使用,但不适用于任何其他方法,AFAIK.
SetWindowLong
withWS_VISIBLE
added toGWL_STYLE
is proably the least interesting: why mess with style bits if there is a function that does exactly what you need.SetWindowPos
withSWP_SHOWWINDOW
allows you to show the window and set its location and size at the same time, with a single atomic operation, so that no-one - program or user - may see the visible-unmoved or moved-invisible window.- The
ShowWindow
function has a lot of magic involved, particularly the very first time it is called in a program. Additionaly, it has theSW_SHOWDEFAULT
flag that is little used but not available to any other method, AFAIK.
还有其他方法可以使窗口可见.在我的脑海中:
There are other ways to make a window visible. From the top of my mind:
- 使用
WS_VISIBLE
标志集创建它. DeferWindowPos
与SetWindowPos
具有相同的标志.
- Create it with the
WS_VISIBLE
flag set. DeferWindowPos
has the same flags thanSetWindowPos
.
这篇关于ShowWindow vs SWP_SHOWWINDOW vs WS_VISIBLE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文