Easy Win 32
Combo Box Class –
cEasyComboBox
cEasyComboBox Public Members:
HWND combobox;
cEasyComboBox Functions:
Functions to modify and/or setup the Combo Box (HWND
combobox):
int ChangeComboBoxInstance(HINSTANCE)
int ChangeComboBoxParent(HWND)
int ChangeComboBoxMenu(HMENU)
int ChangeComboBoxPos(int x, int y, int width, int height)
int ChangeComboBoxStyles(DWORD dwstyle,DWORD dwexstyle)
int ChangeComboBoxName(LPCTSTR)
As a general rule
this functions return 1 on success, 0 on error.
After created functions (They
help to handle the Combo Box):
DWORD GetSelectedItem()
Returns the
Zero-Based User Selected Item, if any.
int SetSelectedItem(DWORD index)
UINT NumberofItems()
Returns the Number of Items of the Combo Box.
DWORD GetItemData(DWORD index)
Returns
the Data associated with the Item in the Combo Box (Index is Zero-Based).
INT SetItemData(DWORD index,DWORD data)
INT FindItem(LPCTSTR name)
Returns the Index of the Item that matches the name.
void ResetContent()
Deletes all the Items of the Combo Box.
int AddItem(LPCTSTR name,DWORD data)
Adds an item
to the Combo Box and associates the variable data to it.
int
DeleteItem(LPCTSTR name)
Deletes the
Item that Matches that name.
As a general rule,
functions that use Set (Example: SetItemData), return 1 on success, 0 on error.
Other Functions:
void InitComboBox()
Initializes the Combo
Box Class with these values:
lpWindowName="ComboBox";
dwStyle=0;
x=10;
y=10;
nWidth=300;
nHeight=300;
hWndParent=NULL;
hMenu=NULL;
hInst1=programInstance;
_combocreated_=FALSE;
HWND
Create_ComboBox(HWND AuxiliarWindow)
On success it returns the
handle of the ComboBox (you don’t have to store it, it
is already stored in the public class member “combobox”).
On error it return NULL.
int Destroy_ComboBox()
Destroys the ComboBox. On
error returns 0, else non-zero.
LONG
GetComboBoxId()
HWND
GetComboBoxParent()
DWORD
GetComboBoxExStyle()
DWORD
GetComboBoxStyle()
HINSTANCE
GetComboBoxInstance()
Returns a Combo
Box Property according to the name of the function.
BOOL
Is_Enabled()
void Disable_ComboBox()
void
Enable_ComboBox()
cEasyComboBox Private Members:
DWORD dwExStyle; // extended window style
LPCTSTR lpWindowName; // pointer to window name
DWORD dwStyle; // window style
int
x; // horizontal position of window
int
y; // vertical position of window
int
nWidth; // window width
int
nHeight; // window height
HWND hWndParent; // handle to parent or owner window
HMENU hMenu; // handle to menu or child-window
identifier
HANDLE hInst1; // handle to application instance
BOOL _combocreated_;