Application Security Testing: An Integral Part of DevOps
There are 13 internal hot images, each is shown by calling a corresponding method.
Application defined bitmapsmay also be used. They must be provided as a bitmap containing a series of image pairs of two equally sized halves, the left being the active bitmap, the right being the inactive bitmap. For example, a series of one pair would look like this:
The method CHotButton::SetAppBmp(UINT nBitmapID, int cx, COLORREF crMask) installs the application defined bitmap. The parameters are: nBitmapID - the resource ID of the bitmap, cx - the width of a single image (the active or inactive part), and crMask, the transparency color, purple in this case being RGB(255,0,255).
The app may select which application defined pair to use via UseAppBitmap(int iBitmap), where iBitmap is the zero based index of the image pair to use.A Tooltip may be set for the hotspot via a call to SetTooltipText(LPCSTR szText, BOOL bActivate = TRUE), where szText is the text to display when "hot", and bActivate is the initial activation state. The tooltip may be turned on/off via ActivateTooltip(BOOL bEnable = TRUE).
The hot area may be turned on/off via EnableHotSpot(BOOL bEnable = TRUE). When disabled, the inactive bitmap always displays, the tooltip does not show, and the normal BN_CLICKED notification is sent when pressing the button on the hotspot area. The hotspot image area may be hidden/shown via ShowBitmap(BOOL bShow = TRUE), the button looks like a normal button then the hotspot image is hidden.
There are several limitations to the button:
- - only the 3D frame border is supported
- - horizontal center/left/right text is supported, but vertical centering is not
- - multi-line text is not supported
- - the text does not gray out when the WS_DISABLED style is used (this is a TODO, somebody mail me some code!)
In the downloadable source project, HotButton.cpp and HotButton.h are the source code
files, res/HotInternal.bmp is the bitmap for the button's internal images, which should be
mapped to resource ID IDB_HOT_INTERNAL in your own project:
IDB_HOT_INTERNAL BITMAP DISCARDABLE "res\\HotInternal.bmp"