Re: simple Bitmap Bkgd Class ?
Is this the correct way to write the LoadImage( ) statement and the entire
function?
HRGN BmpBkgdRegion::AccessBmp()
{
HBITMAP hbm = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDB_BACKGROUND), IMAGE_BITMAP, 0, 0,
LR_DEFAULTSIZE);
bmpBkgd.Attach(hbm);
DeleteObject(hbm);
ProcessBmp();
return hRgn;
}
And I am getting an error message for the return handle in BOOL
CBmpBkgdBmpButtonDlg::OnInitDialog() -
error C2065: 'hRgn' : undeclared identifier
For this line - SetWindowRgn(hRgn,true);
"cdg" <anyone@anywhere.com> wrote in message
news:D%Ani.332260$p47.105197@bgtnsc04-news.ops.worldnet.att.net...
I have written some code to process a bitmap (with transparent areas)
to
determine the region for a dialog. And I wanted to put this processing
code
in a class. But there are a few simple procedures that I haven't had much
practice using.
One question - how is the "LoadImage" statement correctly written.. I
have
been using LoadBitmap, but it seems to change the color slightly. But I
have
never used LoadImage. (code below)
Next question - how is the HRGN handle returned from a member function
in
this bitmap processing class to the main dialog class.
Here is the code -
====
BOOL CBmpBkgdDlg::OnInitDialog()
{
"auto-code here"
BmpBkgdRegion BkgdRgn; //class declaration
BkgdRgn.AccessBmp(); //call to member function
SetWindowRgn(hRgn,true); //set window region from hRgn
}
====
class BmpBkgdRegion
{
public:
HRGN AccessBmp();
BmpBkgdRegion();
virtual ~BmpBkgdRegion();
HRGN hRgn;
protected:
void ProcessBmp();
CBitmap bmpBkgd;
};
====
HRGN BmpBkgdRegion::AccessBmp()
{
bmpBkgd.LoadBitmap(IDB_BACKGROUND); //change to LoadImage***
ProcessBmp();
return hRgn; //how is this returned***
}
void BmpBkgdRegion::ProcessBmp()
{
//processing code results with hRgn
}
====