首页 > DUI > DUI-控制窗口最大最小化屏幕区域
2012一月6

DUI-控制窗口最大最小化屏幕区域

在Windows中,无论什么时候以何种方式改变窗口的尺寸或大小,是拖拽窗口边缘也好,或是在代码中调用改变窗口尺寸的函数也好,总之不管你用什么方法,Windows都会首先发送WM_GETMINMAXINFO消息。大多数应用程序都不用显式处理这个WM_GETMINMAXINFO消息(也就是说让DefWindowProc窗口过程进行缺省处理),而Windows在进行缺省处理时是不会让一个窗口视图比屏幕还大的,所以我们会碰上前面讲的那个问题。

WM_GETMINMAXINFO

    WPARAM wParam//This parameter is not used.
    LPARAM lParam;//MINMAXINFOstructure that contains the default maximized position and dimensions, and the 
                    default minimum and maximum tracking sizes. An application can override the 
                    defaults by setting the members of this structure.

解决的方法是:不要让Windows对WM_GETMINMAXINFO消息进行缺省处理,而是由我们自己处理,方法如下:主要是控制窗口显示时的大小(ptMaxSize),最大化时的位置(ptMaxPosition),鼠标控制窗口大小的最大(ptMaxTrackSize)、最小(ptMinTrackSize)位置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
case WM_GETMINMAXINFO:
	 MINMAXINFO *mminfo;
		 mminfo=(PMINMAXINFO)lParam;
 
	 mminfo->ptMinTrackSize.x=200;
	 mminfo->ptMinTrackSize.y=200;
 
	 mminfo->ptMaxSize.x=300;
	 mminfo->ptMaxSize.y=300;
 
	 mminfo->ptMaxPosition.x=0;
	 mminfo->ptMaxPosition.y=0;
 
	 mminfo->ptMaxTrackSize.x=300;
	 mminfo->ptMaxTrackSize.y=300;
 
	 break;

利用以上的代码就可以控制窗口的大小(300,300),最大化后会出现在(0,0)位置处,鼠标拖动改变窗口大小时,最大为(300,300),最小为(200,200)。其中的单位都是像素。








文章作者:hgy413
本文地址:http://hgy413.com/1870.html
版权所有 © 转载时必须以链接形式注明作者和原始出处!

26 Responses to “DUI-控制窗口最大最小化屏幕区域”

  1. #1 minecraft 回复 | 引用 Post:2018-10-06 21:21

    Thank you a lot for sharing this with all of us you really know what you are talking about!

    Bookmarked. Please additionally consult with my website =).

    We may have a link change agreement among us

  2. Helpful info. Fortunate me I discovered your website by accident, and I am surprised why
    this coincidence didn’t came about earlier! I bookmarked it.

  3. Wow! After all I got a web site from where I know how to truly get valuable facts concerning my study and
    knowledge.

  4. I must thank you for the efforts you’ve put in writing this blog.
    I’m hoping to check out the same high-grade content by you later on as
    well. In fact, your creative writing abilities has inspired me to get my
    own site now 😉

  5. #5 tinder dating site 回复 | 引用 Post:2018-10-17 13:54

    Hi I am so delighted I found your blog page, I really found you
    by accident, while I was browsing on Google for something else,
    Regardless I am here now and would just like to say kudos for a marvelous post and a all round entertaining blog
    (I also love the theme/design), I don’t have time to browse it all at the moment but I have saved
    it and also added in your RSS feeds, so when I have time
    I will be back to read much more, Please do keep up the awesome work.

  6. We are a gaggle of volunteers and starting a brand new scheme in our community.
    Your site provided us with useful information to
    work on. You’ve done an impressive task and our whole community shall be grateful to
    you.

  7. #7 Coconut Oil 回复 | 引用 Post:2018-10-22 22:26

    I’m impressed, I have to admit. Seldom do I come across a blog that’s both equally educative and interesting, and
    without a doubt, you have hit the nail on the head.
    The problem is something which not enough men and women are
    speaking intelligently about. Now i’m very happy I
    came across this during my hunt for something
    regarding this.

  8. #8 Benefits of Coconut Oil 回复 | 引用 Post:2018-10-24 10:52

    Do you have a spam problem on this blog; I also am a blogger, and I was curious
    about your situation; many of us have developed some nice
    procedures and we are looking to exchange strategies with other folks, why not
    shoot me an e-mail if interested.

  9. #9 Coconut Oil 回复 | 引用 Post:2018-10-24 14:51

    Hello, Neat post. There is a problem along with your web site in internet explorer, would check this?

    IE nonetheless is the market leader and a huge component of people will pass over your magnificent writing because of this problem.

  10. #10 Coconut Oil Benefits 回复 | 引用 Post:2018-10-25 10:45

    If you want to improve your knowledge only keep
    visiting this site and be updated with the hottest information posted here.

  11. #11 quest bars cheap 回复 | 引用 Post:2018-11-03 11:44

    Hello, i think that i noticed you visited my site thus i came to
    go back the want?.I am trying to in finding issues
    to enhance my web site!I assume its adequate to use a few of
    your ideas!!

  12. It’s an amazing post in favor of all the internet users; they will obtain benefit
    from it I am sure.

  13. magnificent submit, very informative. I’m wondering why the other specialists of this sector don’t notice this.
    You should continue your writing. I am sure, you have a huge readers’ base already!

  14. Greetings! I know this is kinda off topic but I
    was wondering which blog platform are you using for this website?
    I’m getting fed up of WordPress because I’ve had problems with hackers and I’m looking at options
    for another platform. I would be great if you could point me in the direction of a good platform.

  15. I do not even know how I ended up here, but I thought this post was good.
    I don’t know who you are but certainly you are going to a famous blogger if you aren’t already 😉 Cheers!

  16. Its not my first time to pay a visit this web site, i
    am browsing this site dailly and get pleasant facts from here every
    day.

  17. #17 Sling TV 回复 | 引用 Post:2018-12-05 09:06

    Hi, Neat post. There’s an issue together with your website in internet explorer, may check this?
    IE still is the marketplace chief and a large component of people will pass over
    your excellent writing due to this problem.

  18. It’s remarkable designed for me to have a web site, which is good for my experience.
    thanks admin

  19. What’s up to every body, it’s my first go to see of this blog; this web site consists of remarkable and
    actually fine data in support of readers.

  20. #20 descargar facebook 回复 | 引用 Post:2019-08-19 09:55

    I love what you guys tend to be up too. This kind of clever
    work and reporting! Keep up the awesome works guys I’ve incorporated you guys to my blogroll.

  21. #21 descargar facebook 回复 | 引用 Post:2019-08-19 10:18

    Way cool! Some extremely valid points! I appreciate you penning this article plus the rest of the website is extremely good.

  22. #22 minecraft games 回复 | 引用 Post:2019-09-01 00:55

    We are a bunch of volunteers and starting a new scheme in our community.
    Your web site offered us with useful information to work on. You’ve performed a formidable job and our whole group will probably be grateful to you.

  23. #23 quest bars cheap 回复 | 引用 Post:2019-09-06 02:29

    Hello, yes this article is actually pleasant and I have learned
    lot of things from it about blogging. thanks.

  24. #24 ETIAS Visa 回复 | 引用 Post:2019-09-07 06:19

    Hey! I know this is kinda off topic however ,
    I’d figured I’d ask. Would you be interested in trading links or maybe guest
    authoring a blog post or vice-versa? My blog discusses a lot of the same subjects
    as yours and I feel we could greatly benefit from each other.
    If you’re interested feel free to shoot me an email.

    I look forward to hearing from you! Terrific blog by the way!

  25. #25 quest bars cheap 回复 | 引用 Post:2019-09-07 15:56

    hey there and thank you for your info – I have definitely picked up anything new from right here.
    I did however expertise several technical points using this site,
    as I experienced to reload the site lots of times previous to I
    could get it to load properly. I had been wondering if your web host is OK?
    Not that I’m complaining, but slow loading instances times will often affect your placement
    in google and could damage your high-quality
    score if ads and marketing with Adwords. Well I’m adding this
    RSS to my e-mail and can look out for a lot more of
    your respective intriguing content. Make sure you update this again very soon.

  26. #26 chair builder 回复 | 引用 Post:2019-09-16 13:13

    It’s very trouble-free to find out any matter on net as compared to books, as
    I found this piece of writing at this web site.

发表评论