From: Neo on
I am developing SDI application in vc using vs2k5. my *view* class
(CTestView) inherited from CListView. I want to place background Image
in list view. I wrote following code in
"CTestView::OnInitialUpdate()" function, list view control name is
l_Ctrl(List View Control), and working fine with Tile Style in both
operating system Win2K and WinXP.

if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
LVBKIF_SOURCE_NONE ) )
{
l_Ctrl.SetBkImage( TEXT( "E:\\watermark.bmp" ), TRUE );
}

I want to show image as Water Mark in view area, following code (uses
SetBkImage function by passing LVBKIMAGE structure) which is working
fine (in case of loading image from file) only in Win2K but its not
working in WinXP.

[CASE-I]

LVBKIMAGE bkImage;
if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
LVBKIF_SOURCE_NONE ) )
{
bkImage.pszImage = TEXT( "E:\\ watermark.bmp" );
bkImage.ulFlags = LVBKIF_SOURCE_URL |
LVBKIF_TYPE_WATERMARK;

bkImage.cchImageMax = sizeof( bkImage.hbm );
bkImage.xOffsetPercent = 100;
bkImage.yOffsetPercent = 100;

if( l_Ctrl.SetBkImage( &bkImage ) )
l_Ctrl.GetBkImage( &bkImage );
}

the following code is not working in nieither Win2K nor WinXP,
IDB_WATERMARK is Bitmap Resource which has been added in Project. But
the following code works fine in WinXP only if "bkImage.ulFlags =
LVBKIF_SOURCE_HBITMAP".

[CASE-II]

LVBKIMAGE bkImage;
if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
LVBKIF_SOURCE_NONE ) )
{
HBITMAP hBitmap;
hBitmap = (HBITMAP)::LoadImage( AfxGetInstanceHandle( ),
MAKEINTRESOURCE( IDB_WATERMARK ),
IMAGE_BITMAP,
0, 0,
LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS
);

bkImage.hbm = hBitmap;
bkImage.ulFlags = LVBKIF_SOURCE_HBITMAP |
LVBKIF_TYPE_WATERMARK;

bkImage.cchImageMax = sizeof( bkImage.hbm );
bkImage.xOffsetPercent = 100;
bkImage.yOffsetPercent = 100;

if( ! l_Ctrl.SetBkImage( &bkImage ) )
{
::MessageBox( this->m_hWnd, TEXT("HBITMAP is Not Loaded"),
TEXT("Load Error"), MB_OK );
}
}

please tell me mistakes in my code for displaying image as water mark
in List View, and tell me corrections for making it work on Win2k and
WinXP. Please explain, why Case-I works in Win2k but not in WinXP? And
why case-II with changes works in WinXP but not in Win2k?

regards,

-aims

From: AliR (VC++ MVP) on
Did you call AfxOleInit in your apps InitInstance?

AliR.

"Neo" <momer114(a)gmail.com> wrote in message
news:1162573158.692137.261190(a)b28g2000cwb.googlegroups.com...
> I am developing SDI application in vc using vs2k5. my *view* class
> (CTestView) inherited from CListView. I want to place background Image
> in list view. I wrote following code in
> "CTestView::OnInitialUpdate()" function, list view control name is
> l_Ctrl(List View Control), and working fine with Tile Style in both
> operating system Win2K and WinXP.
>
> if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
> LVBKIF_SOURCE_NONE ) )
> {
> l_Ctrl.SetBkImage( TEXT( "E:\\watermark.bmp" ), TRUE );
> }
>
> I want to show image as Water Mark in view area, following code (uses
> SetBkImage function by passing LVBKIMAGE structure) which is working
> fine (in case of loading image from file) only in Win2K but its not
> working in WinXP.
>
> [CASE-I]
>
> LVBKIMAGE bkImage;
> if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
> LVBKIF_SOURCE_NONE ) )
> {
> bkImage.pszImage = TEXT( "E:\\ watermark.bmp" );
> bkImage.ulFlags = LVBKIF_SOURCE_URL |
> LVBKIF_TYPE_WATERMARK;
>
> bkImage.cchImageMax = sizeof( bkImage.hbm );
> bkImage.xOffsetPercent = 100;
> bkImage.yOffsetPercent = 100;
>
> if( l_Ctrl.SetBkImage( &bkImage ) )
> l_Ctrl.GetBkImage( &bkImage );
> }
>
> the following code is not working in nieither Win2K nor WinXP,
> IDB_WATERMARK is Bitmap Resource which has been added in Project. But
> the following code works fine in WinXP only if "bkImage.ulFlags =
> LVBKIF_SOURCE_HBITMAP".
>
> [CASE-II]
>
> LVBKIMAGE bkImage;
> if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
> LVBKIF_SOURCE_NONE ) )
> {
> HBITMAP hBitmap;
> hBitmap = (HBITMAP)::LoadImage( AfxGetInstanceHandle( ),
> MAKEINTRESOURCE( IDB_WATERMARK ),
> IMAGE_BITMAP,
> 0, 0,
> LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS
> );
>
> bkImage.hbm = hBitmap;
> bkImage.ulFlags = LVBKIF_SOURCE_HBITMAP |
> LVBKIF_TYPE_WATERMARK;
>
> bkImage.cchImageMax = sizeof( bkImage.hbm );
> bkImage.xOffsetPercent = 100;
> bkImage.yOffsetPercent = 100;
>
> if( ! l_Ctrl.SetBkImage( &bkImage ) )
> {
> ::MessageBox( this->m_hWnd, TEXT("HBITMAP is Not Loaded"),
> TEXT("Load Error"), MB_OK );
> }
> }
>
> please tell me mistakes in my code for displaying image as water mark
> in List View, and tell me corrections for making it work on Win2k and
> WinXP. Please explain, why Case-I works in Win2k but not in WinXP? And
> why case-II with changes works in WinXP but not in Win2k?
>
> regards,
>
> -aims
>


From: Mohammad Omer on
I tried it, but it's not working.

Regards,
-aims


On Nov 3, 10:18 pm, "AliR \(VC++ MVP\)" <A...(a)online.nospam> wrote:
> Did you call AfxOleInit in your apps InitInstance?
>
> AliR.
>
> "Neo" <momer...(a)gmail.com> wrote in messagenews:1162573158.692137.261190(a)b28g2000cwb.googlegroups.com...
>
> > I am developing SDI application in vc using vs2k5. my *view* class
> > (CTestView) inherited from CListView. I want to place background Image
> > in list view. I wrote following code in
> > "CTestView::OnInitialUpdate()" function, list view control name is
> > l_Ctrl(List View Control), and working fine with Tile Style in both
> > operating system Win2K and WinXP.
>
> > if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
> > LVBKIF_SOURCE_NONE ) )
> > {
> > l_Ctrl.SetBkImage( TEXT( "E:\\watermark.bmp" ), TRUE );
> > }
>
> > I want to show image as Water Mark in view area, following code (uses
> > SetBkImage function by passing LVBKIMAGE structure) which is working
> > fine (in case of loading image from file) only in Win2K but its not
> > working in WinXP.
>
> > [CASE-I]
>
> > LVBKIMAGE bkImage;
> > if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
> > LVBKIF_SOURCE_NONE ) )
> > {
> > bkImage.pszImage = TEXT( "E:\\ watermark.bmp" );
> > bkImage.ulFlags = LVBKIF_SOURCE_URL |
> > LVBKIF_TYPE_WATERMARK;
>
> > bkImage.cchImageMax = sizeof( bkImage.hbm );
> > bkImage.xOffsetPercent = 100;
> > bkImage.yOffsetPercent = 100;
>
> > if( l_Ctrl.SetBkImage( &bkImage ) )
> > l_Ctrl.GetBkImage( &bkImage );
> > }
>
> > the following code is not working in nieither Win2K nor WinXP,
> > IDB_WATERMARK is Bitmap Resource which has been added in Project. But
> > the following code works fine in WinXP only if "bkImage.ulFlags =
> > LVBKIF_SOURCE_HBITMAP".
>
> > [CASE-II]
>
> > LVBKIMAGE bkImage;
> > if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
> > LVBKIF_SOURCE_NONE ) )
> > {
> > HBITMAP hBitmap;
> > hBitmap = (HBITMAP)::LoadImage( AfxGetInstanceHandle( ),
> > MAKEINTRESOURCE( IDB_WATERMARK ),
> > IMAGE_BITMAP,
> > 0, 0,
> > LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS
> > );
>
> > bkImage.hbm = hBitmap;
> > bkImage.ulFlags = LVBKIF_SOURCE_HBITMAP |
> > LVBKIF_TYPE_WATERMARK;
>
> > bkImage.cchImageMax = sizeof( bkImage.hbm );
> > bkImage.xOffsetPercent = 100;
> > bkImage.yOffsetPercent = 100;
>
> > if( ! l_Ctrl.SetBkImage( &bkImage ) )
> > {
> > ::MessageBox( this->m_hWnd, TEXT("HBITMAP is Not Loaded"),
> > TEXT("Load Error"), MB_OK );
> > }
> > }
>
> > please tell me mistakes in my code for displaying image as water mark
> > in List View, and tell me corrections for making it work on Win2k and
> > WinXP. Please explain, why Case-I works in Win2k but not in WinXP? And
> > why case-II with changes works in WinXP but not in Win2k?
>
> > regards,
>
> > -aims

From: AliR (VC++ MVP) on
Is it still returning 0 or is it returning 1 and you can't see the image?

AliR.

"Mohammad Omer" <momer114(a)gmail.com> wrote in message
news:1162636783.133100.277340(a)b28g2000cwb.googlegroups.com...
> I tried it, but it's not working.
>
> Regards,
> -aims
>
>
> On Nov 3, 10:18 pm, "AliR \(VC++ MVP\)" <A...(a)online.nospam> wrote:
> > Did you call AfxOleInit in your apps InitInstance?
> >
> > AliR.
> >
> > "Neo" <momer...(a)gmail.com> wrote in
messagenews:1162573158.692137.261190(a)b28g2000cwb.googlegroups.com...
> >
> > > I am developing SDI application in vc using vs2k5. my *view* class
> > > (CTestView) inherited from CListView. I want to place background Image
> > > in list view. I wrote following code in
> > > "CTestView::OnInitialUpdate()" function, list view control name is
> > > l_Ctrl(List View Control), and working fine with Tile Style in both
> > > operating system Win2K and WinXP.
> >
> > > if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
> > > LVBKIF_SOURCE_NONE ) )
> > > {
> > > l_Ctrl.SetBkImage( TEXT( "E:\\watermark.bmp" ), TRUE );
> > > }
> >
> > > I want to show image as Water Mark in view area, following code (uses
> > > SetBkImage function by passing LVBKIMAGE structure) which is working
> > > fine (in case of loading image from file) only in Win2K but its not
> > > working in WinXP.
> >
> > > [CASE-I]
> >
> > > LVBKIMAGE bkImage;
> > > if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
> > > LVBKIF_SOURCE_NONE ) )
> > > {
> > > bkImage.pszImage = TEXT( "E:\\ watermark.bmp" );
> > > bkImage.ulFlags = LVBKIF_SOURCE_URL |
> > > LVBKIF_TYPE_WATERMARK;
> >
> > > bkImage.cchImageMax = sizeof( bkImage.hbm );
> > > bkImage.xOffsetPercent = 100;
> > > bkImage.yOffsetPercent = 100;
> >
> > > if( l_Ctrl.SetBkImage( &bkImage ) )
> > > l_Ctrl.GetBkImage( &bkImage );
> > > }
> >
> > > the following code is not working in nieither Win2K nor WinXP,
> > > IDB_WATERMARK is Bitmap Resource which has been added in Project. But
> > > the following code works fine in WinXP only if "bkImage.ulFlags =
> > > LVBKIF_SOURCE_HBITMAP".
> >
> > > [CASE-II]
> >
> > > LVBKIMAGE bkImage;
> > > if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
> > > LVBKIF_SOURCE_NONE ) )
> > > {
> > > HBITMAP hBitmap;
> > > hBitmap = (HBITMAP)::LoadImage( AfxGetInstanceHandle( ),
> > > MAKEINTRESOURCE( IDB_WATERMARK ),
> > > IMAGE_BITMAP,
> > > 0, 0,
> > > LR_CREATEDIBSECTION |
LR_LOADMAP3DCOLORS
> > > );
> >
> > > bkImage.hbm = hBitmap;
> > > bkImage.ulFlags = LVBKIF_SOURCE_HBITMAP |
> > > LVBKIF_TYPE_WATERMARK;
> >
> > > bkImage.cchImageMax = sizeof( bkImage.hbm );
> > > bkImage.xOffsetPercent = 100;
> > > bkImage.yOffsetPercent = 100;
> >
> > > if( ! l_Ctrl.SetBkImage( &bkImage ) )
> > > {
> > > ::MessageBox( this->m_hWnd, TEXT("HBITMAP is Not Loaded"),
> > > TEXT("Load Error"), MB_OK );
> > > }
> > > }
> >
> > > please tell me mistakes in my code for displaying image as water mark
> > > in List View, and tell me corrections for making it work on Win2k and
> > > WinXP. Please explain, why Case-I works in Win2k but not in WinXP? And
> > > why case-II with changes works in WinXP but not in Win2k?
> >
> > > regards,
> >
> > > -aims
>


From: AliR (VC++ MVP) on
Make sure you have the calls to set the bkcolor and textbkcolor to
transparent

m_cList.SetBkColor(CLR_NONE);

m_cList.SetTextBkColor(CLR_NONE);

m_cList.SetBkImage("c:\\gto.bmp",TRUE);



AliR.

"AliR (VC++ MVP)" <AliR(a)online.nospam> wrote in message
news:454fa8b6$0$2970$a8266bb1(a)reader.corenews.com...
> Is it still returning 0 or is it returning 1 and you can't see the image?
>
> AliR.
>
> "Mohammad Omer" <momer114(a)gmail.com> wrote in message
> news:1162636783.133100.277340(a)b28g2000cwb.googlegroups.com...
> > I tried it, but it's not working.
> >
> > Regards,
> > -aims
> >
> >
> > On Nov 3, 10:18 pm, "AliR \(VC++ MVP\)" <A...(a)online.nospam> wrote:
> > > Did you call AfxOleInit in your apps InitInstance?
> > >
> > > AliR.
> > >
> > > "Neo" <momer...(a)gmail.com> wrote in
> messagenews:1162573158.692137.261190(a)b28g2000cwb.googlegroups.com...
> > >
> > > > I am developing SDI application in vc using vs2k5. my *view* class
> > > > (CTestView) inherited from CListView. I want to place background
Image
> > > > in list view. I wrote following code in
> > > > "CTestView::OnInitialUpdate()" function, list view control name is
> > > > l_Ctrl(List View Control), and working fine with Tile Style in both
> > > > operating system Win2K and WinXP.
> > >
> > > > if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
> > > > LVBKIF_SOURCE_NONE ) )
> > > > {
> > > > l_Ctrl.SetBkImage( TEXT( "E:\\watermark.bmp" ), TRUE );
> > > > }
> > >
> > > > I want to show image as Water Mark in view area, following code
(uses
> > > > SetBkImage function by passing LVBKIMAGE structure) which is working
> > > > fine (in case of loading image from file) only in Win2K but its not
> > > > working in WinXP.
> > >
> > > > [CASE-I]
> > >
> > > > LVBKIMAGE bkImage;
> > > > if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
> > > > LVBKIF_SOURCE_NONE ) )
> > > > {
> > > > bkImage.pszImage = TEXT( "E:\\ watermark.bmp" );
> > > > bkImage.ulFlags = LVBKIF_SOURCE_URL |
> > > > LVBKIF_TYPE_WATERMARK;
> > >
> > > > bkImage.cchImageMax = sizeof( bkImage.hbm );
> > > > bkImage.xOffsetPercent = 100;
> > > > bkImage.yOffsetPercent = 100;
> > >
> > > > if( l_Ctrl.SetBkImage( &bkImage ) )
> > > > l_Ctrl.GetBkImage( &bkImage );
> > > > }
> > >
> > > > the following code is not working in nieither Win2K nor WinXP,
> > > > IDB_WATERMARK is Bitmap Resource which has been added in Project.
But
> > > > the following code works fine in WinXP only if "bkImage.ulFlags =
> > > > LVBKIF_SOURCE_HBITMAP".
> > >
> > > > [CASE-II]
> > >
> > > > LVBKIMAGE bkImage;
> > > > if( l_Ctrl.GetBkImage( &bkImage ) && (bkImage.ulFlags ==
> > > > LVBKIF_SOURCE_NONE ) )
> > > > {
> > > > HBITMAP hBitmap;
> > > > hBitmap = (HBITMAP)::LoadImage( AfxGetInstanceHandle( ),
> > > > MAKEINTRESOURCE( IDB_WATERMARK ),
> > > > IMAGE_BITMAP,
> > > > 0, 0,
> > > > LR_CREATEDIBSECTION |
> LR_LOADMAP3DCOLORS
> > > > );
> > >
> > > > bkImage.hbm = hBitmap;
> > > > bkImage.ulFlags = LVBKIF_SOURCE_HBITMAP |
> > > > LVBKIF_TYPE_WATERMARK;
> > >
> > > > bkImage.cchImageMax = sizeof( bkImage.hbm );
> > > > bkImage.xOffsetPercent = 100;
> > > > bkImage.yOffsetPercent = 100;
> > >
> > > > if( ! l_Ctrl.SetBkImage( &bkImage ) )
> > > > {
> > > > ::MessageBox( this->m_hWnd, TEXT("HBITMAP is Not Loaded"),
> > > > TEXT("Load Error"), MB_OK );
> > > > }
> > > > }
> > >
> > > > please tell me mistakes in my code for displaying image as water
mark
> > > > in List View, and tell me corrections for making it work on Win2k
and
> > > > WinXP. Please explain, why Case-I works in Win2k but not in WinXP?
And
> > > > why case-II with changes works in WinXP but not in Win2k?
> > >
> > > > regards,
> > >
> > > > -aims
> >
>
>


 |  Next  |  Last
Pages: 1 2
Prev: VC6 online help (MSDN)
Next: CDHTLMDialog troubles