在WM客户端GUI上创建另一个窗口 [英] Create another Window on WM client GUI
本文介绍了在WM客户端GUI上创建另一个窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在用C ++在WM客户端上创建即时消息传递的GUI.到目前为止,我已经为用户列表创建了一个窗口(ListView).我想在屏幕顶部创建另一个窗口,一个较小的常量窗口(以供参考).如何将屏幕分成两个不同的部分?
I''m creating a GUI of instant messaging on WM client, in C++. So far, I''ve created a window (ListView) for the list of users. I want to create another window, a smaller constant one, at the top of the screen (for my info). How do I split the screen into two different sections?
推荐答案
如果使用的是MFC,则可以使用 ^ ].如果使用纯Win32,则在文章"部分中搜索有关创建分割器窗口的一些示例.
If you are using MFC then you can use a CSplitterWnd
[^]. If using pure Win32 then search the articles section for some samples on making splitter windows.
总之,您不需要.
我认为您是从错误的角度看待这个问题.
每个窗口(桌面除外)都有一个父窗口.您可以将这些窗口放置在其父对象clientRect范围内的任何位置.
在继续向其添加控件之前,通常会为您的应用程序创建一个窗口.您可能希望下载 ResEdit [ ^ ],因为它使您可以在所见即所得模式下绘制gui,允许您另存为.RC文件或预览创建gui所需的C代码.
假设parentHwnd是保存控件的窗口的HWND,并且IDC_LIST_USERS + IDC_STATIC_INFO都已使用int进行了#defined定义,以表示在发生某些情况时传递给WindowProcedure的控件ID:
In short, you don''t.
I think you''re looking at this from the wrong perspective.
Each window (except the desktop) has a parent. You can position these windows anywhere you like within the bounds of it''s parent''s clientRect.
You would typically create a window for your app, before going on to add the controls to it. You may wish to download ResEdit[^] as it lets you draw the gui in wysiwyg mode, allowing you to save as a .RC file or to preview the C code need to create the gui.
Assuming parentHwnd is the HWND of the window that holds your controls and both IDC_LIST_USERS + IDC_STATIC_INFO have been #defined with ints to represent the control ID that is passed to the WindowProcedure when something happens :
HWND userListCtrl = CreateWindowEx(0, WC_LISTVIEW, 0, WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_ICON, 21, 46, 123, 156, hwndParent, (HMENU)IDC_LIST_USERS, hInst, 0);
HWND infoWndCtrl = CreateWindowEx(0, WC_STATIC, (""), WS_VISIBLE | WS_CHILD | WS_GROUP | SS_LEFT, 21, 16, 239, 13, hwndParent, (HMENU)IDC_STATIC_INFO, hInst, 0);
这篇关于在WM客户端GUI上创建另一个窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文