Results 1 to 3 of 3

Thread: a tiny problem...

  1. #1

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    Question a tiny problem...

    Code:
    void DoMenuStuff(LPDRAWITEMSTRUCT ds)
    {
    	HBRUSH use_brush;	HBRUSH old_brush;		
    	HPEN use_pen;		HPEN old_pen;
    	HFONT use_font;		HFONT old_font;
    	LOGFONT lf;
    	RECT use_rect;		RECT top_rect;
    	COLORREF color;
    
    	switch(ds->itemID)
    	{
    	case ID_FIRST:
    		{
    			color = RGB(00,00,00);
    			use_brush = CreateSolidBrush(color);
    		}
    	case ID_SECOND:
    		{
    			color = RGB(22,00,00);
    			use_brush = CreateSolidBrush(color);
    		}
    	default:
    		use_brush = CreateSolidBrush(GetSysColor(COLOR_MENU));
    	}
    }
    This is just one function from the program(it is not finished)
    I need to fill the selected area with using the brush created in teh switch(). I tried using:
    Code:
    FillRect(ds->hDC, ds->rcItem, use_brush);
    but it gives me this error:
    Code:
    C:\My Documents\VC++ Projects\WinProg\odmenu_practice1\odmenus_practice1.cpp(179) : error C2664: 'FillRect' : cannot convert parameter 2 from 'struct tagRECT' to 'const struct tagRECT *'
            No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
    What could I do to avoid getting this error?(everything else works fine, just this part)
    Thanks
    Amon Ra
    The Power of Learning.

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409

    Re: a tiny problem...

    The function needs the address of the variable.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    Arrow so...

    so, it should be like this:
    Code:
    FillRect(ds->hDC, &ds->rcItem, use_brush);
    Thanks Vlatko
    Amon Ra
    The Power of Learning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width