Making buttons & edit/list boxes
Hello all.
I have read several tutorials about Windows API but I can't find out how to make simple edit boxes, buttons and list boxes.
In general I want to do something very similar to this:
http://planet.nana.co.il/lala74/API.JPG
I have seen functions like SetDlgItemText() and GetDlgItem() but in all of this I can't find how to define new edit boxes or buttons.
Also, I was wondering If it's possible to disabble the "connect" button shown on the .jpg after pressing it once.
It will be awesome if you will refer me to some tutorials explaining how to make an edit box for example, let the user input text to it and then read this text; make an list box for all the chat messages to be added there and buttons for processing the data.
Lots of thanks.
Re: Making buttons & edit/list boxes
Whether a window is user sizable or not is controlled by the window styles used when you create the window, etc. It sounds like you do not want a resizing border, and want to disable the maximize box so that the window is not resizable at all (by the user). Use the appriopriate window styles when you create the window and your window will not be user sizable.
i.e.
WS_CAPTION | WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX
As for scrolling the ListBox, you can send the WM_VSCROLL message to the ListBox window to scroll it manually.
i.e. (scroll ListBox to Bottom)
Code:
// where hwnd is HWND of the parent window of the ListBox,
// and IDC_LIST is the control id of the ListBox
SendDlgItemMessage(hwnd, IDC_LIST, WM_VSCROLL, (WPARAM)SB_BOTTOM, NULL);
See the documentation for the WM_VSCROLL message for more info.