ATLBUTTON: Demonstrates a Button with Bitmaps for Different States

Click to open or copy the ATLBUTTON project files.

This sample creates a button that displays itself with one of three different bitmaps, depending on its state. The button has a bitmap for: the unpushed state; the hover state (when the mouse moves over the button); and the pushed state. Default bitmaps are included with the sample, but you can override these properties to use your own bitmaps.

This sample uses the following keywords:

Apartment; ATLTRACE; AtlWaitWithMessageLoop; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComControl::FireViewChange; CComControl::InPlaceActivate; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; CloseHandle; CoGetInterfaceAndReleaseStream; CoInitialize; COleControl::OnClick; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL_IID; CoMarshalInterThreadInterfaceInStream; CONNECTION_POINT_ENTRY; CProxy_ATLButton; CreateDIBPalette; CreatePalette; CreateThread; CTimer; DECLARE_HANDLE; DECLARE_REGISTRY_RESOURCEID; DIBNumColors; DisableThreadLibraryCalls; DLL_PROCESS_DETACH; END_COM_MAP; END_CONNECTION_POINT_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; GetCursorPos; GetFileSize; GetWindow; GlobalAlloc; GlobalFree; GlobalLock; GlobalSize; GlobalUnlock; IConnectionPointContainerImpl; IConnectionPointImpl; IDispatchImpl; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleInPlaceObjectWindowlessImpl::InPlaceDeactivate; IOleObjectImpl; IPersistPropertyBagImpl; IPersistStreamInitImpl; IProvideClassInfo2Impl; IViewObjectExImpl; LPLOGPALETTE; MESSAGE_HANDLER; OBJECT_ENTRY; PaintDIB; PaletteSize; PROP_ENTRY; PtInRect; PutImage; ReadDIBFile; ReadFile; RealizePalette; ScreenToClient; SelectPalette; SetDIBitsToDevice; SetStretchBltMode; Sleep; StretchDIBits; TimerOff; TimerOn; Unlock; USES_CONVERSION