OWL NExt - Knowledge Base

[ Home | Contents | Search | Next | Previous | Up ]

Background image in the ListWindow

Date: 15 Jun 2000
Time: 07:17:37
Remote Name: 149.115.241.243

Here the code that places a background image in the ListWindow for Borland 5.02. Of course, I added definitions of all LVBKIF_xxx and LVBKIMAGE structure to my header file, because there are no such in Borland 5.02.
Here's a code snippet:

ListWindowEx::ListWindowEx(TWindow* parent, int id, int x, int y, int w, int h )
:
  TListWindow( parent, id, x, y, w, h )
{
  // ...

  // Needed for setting background image
  ::CoInitialize( NULL );
}

ListWindowEx::~ListWindowEx()
{
  ::CoUninitialize();
}

bool ListWindowEx::SetBkImage( LPSTR szImageName )
{
  LVBKIMAGE lv;
  memset( &lv, 0, sizeof( LVBKIMAGE ) );
  lv.ulFlags  = LVBKIF_SOURCE_URL | LVBKIF_STYLE_TILE;
  lv.pszImage = szImageName;

  if( SendMessage( LVM_SETBKIMAGE, 0, (LPARAM)(LPLVBKIMAGE)&lv ) ) {
    // Set none text background color
    SendMessage( LVM_SETTEXTBKCOLOR, 0, CLR_NONE );
    return true;
  }
  return false;
}
 

Arkady Palarya

Last changed: July 14, 2001