Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
LRESULT CSpyDlg::OnDrawItem(UINT uMsg, WPARAM wParam,
LPARAM lParam, BOOL& bHandled)
{
// LPARAM is a DRAWITEMSTRUCT, initilize a variable for it.
LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam;
// Set up listbox colors.
COLORREF blue = (COLORREF)RGB(0, 0, 255);
COLORREF red = (COLORREF)RGB(255, 0, 0);
COLORREF wndcolor = (COLORREF)GetSysColor(COLOR_WINDOW);
COLORREF hilite = (COLORREF)GetSysColor(COLOR_HIGHLIGHT);
COLORREF hitext = (COLORREF)GetSysColor(COLOR_HIGHLIGHTTEXT);
// Create variable to hold the URL.
char buffer[HUGE_URL] = {0};
// Brush for focus rect.
HBRUSH hbr;
// Put URL into buffer variable.
::SendMessage(m_hwndSpyLst, LB_GETTEXT,
(WPARAM)pdis->itemID, (LPARAM)&buffer );
// Colors depend on violation status.
if (m_pParent->CheckURL(buffer) == URL_VIOLATION)
{
if (pdis->itemState & ODS_SELECTED)
{
hbr = CreateSolidBrush( hitext );
SetBkColor( pdis->hDC, hitext );
SetTextColor( pdis->hDC, hilite );
}
else
{
hbr = CreateSolidBrush(wndcolor);
SetBkColor(pdis->hDC, wndcolor);
SetTextColor( pdis->hDC, red );
}
}
else
{
if (pdis->itemState & ODS_SELECTED)
{
hbr = CreateSolidBrush(hilite);
SetBkColor(pdis->hDC, hilite);
SetTextColor( pdis->hDC, hitext );
}
else
{
hbr = CreateSolidBrush(wndcolor);
SetBkColor(pdis->hDC, wndcolor);
SetTextColor( pdis->hDC, blue );
}
}
FillRect(pdis->hDC, (LPRECT)&pdis->rcItem, hbr);
// Output the string.
TextOut(pdis->hDC, pdis->rcItem.left, pdis->rcItem.top,
buffer, strlen (buffer) );
// Forward the DRAWITEM message to Windows.
::SendMessage(pdis->hwndItem, WM_DRAWITEM,
(WPARAM)pdis->CtlID,(LPARAM)pdis);
return true;
}