如何使用Win32 API制作多个窗口 [英] How to make multiple windows using Win32 API

查看:103
本文介绍了如何使用Win32 API制作多个窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到许多教程和文章向我展示了如何制作一个简单的Windows程序,这是伟大的,但没有一个告诉我如何使多个窗口。

I see plenty of tutorials and articles showing me how to make a simple windows program, which is great but none of them show me how to make multiple windows.

现在我有工作代码创建和绘制分层窗口,我可以使用GDI来绘制任何东西,绘制任何我想要的东西,拖动它,甚至使它透明等。

Right now I have working code that creates and draws a layered window and I can blit stuff using GDI to draw anything I want on it, drag it around, even make it transparent, etc.

但我想要一个第二个矩形区域,我可以绘制,拖动等。换句话说,第二个窗口。可能想要它是一个孩子的窗口。

But I wanted a second rectangular area that I can draw to, drag around, etc. In other words, a second window. Probably want it to be a child window. Question is, how do I make it?

此外,如果任何人知道任何好的资源(在线优先),如Windows API中窗口管理的文章或教程,请分享。

Also, if anybody knows any good resources (online preferably) like articles or tutorials for window management in the Windows API, please share.

推荐答案

如果你想的话,你可以多次点击CreateWindow()。 WinMain中的消息循环将事件传递给WinMain创建的所有窗口。您甚至可以创建两个重叠的窗口,并将第二个的父窗口设置为第一个的句柄。

You can hit CreateWindow() more than once if you want. The message loop in your WinMain will pass events to all the windows that WinMain creates. You can even create two overlapped windows and set the parent window of the 2nd one to be the handle of the 1st one if you want.

这篇关于如何使用Win32 API制作多个窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆