Skip to content

Instantly share code, notes, and snippets.

@garethlewin
Created January 8, 2013 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garethlewin/4488235 to your computer and use it in GitHub Desktop.
Save garethlewin/4488235 to your computer and use it in GitHub Desktop.
switch (message)
{
case WM_CREATE:
hChannelMembers = CreateWindow(_T("LISTBOX"), _T(""),
WS_CHILD | WS_VISIBLE | LBS_STANDARD,
0, 0, 0,0, hWnd, IDC_MEMBERS, hInst, NULL);
hMessages = CreateWindow(_T("LISTBOX"), _T(""),
WS_CHILD | WS_VISIBLE | LBS_STANDARD,
0, 0, 0,0, hWnd, IDC_MESSAGES, hInst, NULL);
hInputBox = CreateWindow(_T("EDIT"), _T(""),
WS_CHILD | WS_VISIBLE | WS_BORDER,
0, 0, 0,0, hWnd, NULL, hInst, NULL);
hSendButton = CreateWindow(_T("BUTTON"), _T("&Send"),
WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
0, 0, 0,0, hWnd, IDC_SEND, hInst, NULL);
break;
case WM_SIZE:
{
int nWidth = LOWORD(lParam);
int nHeight = HIWORD(lParam);
const int nMembersWidth = 200;
const int nEditBoxHeight = 23; // http://msdn.microsoft.com/en-us/library/aa511279.aspx#sizingspacing
const int buttonWidth = 40;
SetWindowPos(hChannelMembers, NULL, 0, 0, nMembersWidth, nHeight, SWP_NOZORDER);
SetWindowPos(hMessages, NULL, nMembersWidth, 0, nWidth-nMembersWidth, nHeight-nEditBoxHeight, SWP_NOZORDER);
SetWindowPos(hInputBox, NULL, nMembersWidth, nHeight-nEditBoxHeight, nWidth-nMembersWidth - buttonWidth, nHeight, SWP_NOZORDER);
SetWindowPos(hSendButton, NULL,
nWidth - buttonWidth,
nHeight-nEditBoxHeight,
buttonWidth,
nHeight, SWP_NOZORDER);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment