#include "alfpriv.h" TCHAR *_alf_spacerClass = NULL; void ALF_RegisterSpacerClass(void) { WNDCLASS cls; ZeroMemory(&cls, sizeof(cls)); TCHAR classNameBuf[256]; ALF_BuildUniqueName(classNameBuf, TEXT("ALFSpacer."), (ULONG_PTR)&_alf_spacerClass); cls.hInstance = ALF_HINSTANCE; cls.hCursor = LoadCursor(NULL, (LPTSTR)IDC_ARROW); if (LOBYTE(LOWORD(GetVersion())) >= 4) { cls.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1); } else { // NT 3.x has white dialog backgrounds cls.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); } cls.lpszClassName = classNameBuf; cls.cbWndExtra = sizeof(void*); cls.lpfnWndProc = DefWindowProc; ATOM classatom = RegisterClass(&cls); if (!classatom) MessageBox(NULL, TEXT("FATAL: Could not register spacer class"), NULL, MB_OK); _alf_spacerClass = MAKEINTATOM(classatom); } HWND ALF_AddSpacer(HWND parent, WORD id, UINT x, UINT y, UINT cptWidth, UINT cptHeight, DWORD layoutFlags) { HWND hwndSpacer = CreateWindowEx(0, _alf_spacerClass, TEXT(""), WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, 0, 0, 0, 0, parent, (HMENU)(int)id, ALF_HINSTANCE, NULL); ALFWidgetLayoutParams p; ZeroMemory(&p, sizeof(p)); p.hwnd = hwndSpacer; p.x = x; p.y = y; p.width = cptWidth; p.height = cptHeight; p.flags = layoutFlags; ALF_AddWidgetEx(parent, &p); return hwndSpacer; }