Click here to Skip to main content
15,905,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?
Posted

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.
 
Share this answer
 
Comments
enhzflep 17-Jun-12 19:24pm    
+5, Good answer.
I didn't consider splitter windows on account of the text "a smaller constant one" Could be just what the doctor ordered!
Richard MacCutchan 18-Jun-12 4:15am    
Well, I guess you could do it with two separate windows, but that does not follow the Windows design principles.
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 :


C++
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);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900