CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2002
    Posts
    67

    SetDCBrushColor problem!

    I wrote a program use the pure sdk, but when I build the project, vc++ says, "warning C4013: 'SetDCBrushColor' undefined; assuming extern returning int", and when linked, there meets an "unresolved external symbol _SetDCBrushColor". I have checked the msdn, it says this funcion declare in wingdi.h, include windows.h, and link with gdi32.lib, all this files and included and the lib path is there(you know, just the default), what's the problem, so strange!
    I guess, but I think I am right.

  2. #2
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244
    This function requires Windows 2000.
    It is not supported on 95/98/NT.

    Add the following before all your includes.
    Code:
    #ifdef _WIN32_WINNT
    #undef _WIN32_WINNT
    #endif
    #define _WIN32_WINNT 0x0500
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  3. #3
    Join Date
    May 2002
    Posts
    67
    My OS is windows2000 professional!!!!
    I guess, but I think I am right.

  4. #4
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Lightbulb Try

    Or try the following:
    Code:
    typedef COLORREF (WINAPI* lpfnSetDCBrushColor)
                       ( HDC hdc, COLORREF crColor );
    // ..............
       HMODULE hGdi32 = LoadLibrary( "gdi32.dll" );
       if( NULL == hGdi32 )
       {
          // ... report library error ...
          return;
       }
       lpfnSetDCBrushColor lpfn = NULL;
       lpfn = (lpfnSetDCBrushColor)
                        GetProcAddress( hGdi32, "SetDCBrushColor" );
    
       if( NULL == lpfn )
       {
          // ... report function not found ...
          return;
       }
       COLORREF crOld = lpfn( hdc, RGB(0,0,255) );
    // ..............
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

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

Featured