Click here to Skip to main content
15,902,836 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDrag and Drop from Outlook Pin
Steve Thresher21-Jan-04 5:47
Steve Thresher21-Jan-04 5:47 
GeneralShellOpen Pin
Gary Kirkham21-Jan-04 5:45
Gary Kirkham21-Jan-04 5:45 
GeneralRe: ShellOpen Pin
Antti Keskinen21-Jan-04 5:55
Antti Keskinen21-Jan-04 5:55 
GeneralRe: ShellOpen Pin
Gary Kirkham21-Jan-04 5:59
Gary Kirkham21-Jan-04 5:59 
QuestionHow to threshold an image? Pin
uus9921-Jan-04 5:41
uus9921-Jan-04 5:41 
AnswerRe: How to threshold an image? Pin
J. Eric Vaughan21-Jan-04 6:24
J. Eric Vaughan21-Jan-04 6:24 
GeneralRe: How to threshold an image? Pin
uus9921-Jan-04 23:25
uus9921-Jan-04 23:25 
GeneralRe: How to threshold an image? Pin
J. Eric Vaughan22-Jan-04 6:01
J. Eric Vaughan22-Jan-04 6:01 
This is copied from a test app I wrote (real quick, so don't be too critical - it works).

CPaintDC dc(this);
CRect cRect; GetClientRect( cRect );
int nWidth = cRect.Width();
int nHeight = cRect.Height();
CBitmap cBitmap;

cBitmap.LoadBitmap( IDB_BITMAP1 );

DWORD* pBuffer = new DWORD[ nWidth * nHeight ];


DWORD dwSize = cBitmap.GetBitmapBits( nWidth * nHeight,
                                    pBuffer );
for ( int y = 0 ; y < nHeight ; y++ )
{
    for ( int x = 0; x < nWidth ; x++ )
    {
        if ( *(pBuffer+x+nWidth*y) < RGB( 64, 128 , 256 ) )
        {
            *(pBuffer+x+nWidth*y) = 0; //black
        }
        else
        {
            *(pBuffer+x+nWidth*y) = 0x00FFFFFF; //white
        }
    }
}

cBitmap.SetBitmapBits( nWidth * nHeight ,
                       pBuffer );

CDC cMemDC;
cMemDC.CreateCompatibleDC( &dc );

cMemDC.SelectObject( &cBitmap );

dc.BitBlt( 0,
           0,
           nWidth,
           nHeight,
           &cMemDC,
           0,
           0,
           SRCCOPY );


delete [] pBuffer;

GeneralRe: How to threshold an image? Pin
uus9922-Jan-04 8:42
uus9922-Jan-04 8:42 
GeneralRe: How to threshold an image? Pin
J. Eric Vaughan22-Jan-04 10:58
J. Eric Vaughan22-Jan-04 10:58 
GeneralRe: How to threshold an image? Pin
uus9922-Jan-04 18:12
uus9922-Jan-04 18:12 
GeneralRe: How to threshold an image? Pin
J. Eric Vaughan23-Jan-04 3:59
J. Eric Vaughan23-Jan-04 3:59 
GeneralRe: How to threshold an image? Pin
uus9923-Jan-04 23:00
uus9923-Jan-04 23:00 
AnswerRe: How to threshold an image? Pin
John M. Drescher21-Jan-04 9:51
John M. Drescher21-Jan-04 9:51 
AnswerRe: How to threshold an image? Pin
cmk21-Jan-04 9:51
cmk21-Jan-04 9:51 
AnswerRe: How to threshold an image? Pin
uus9921-Jan-04 16:30
uus9921-Jan-04 16:30 
AnswerRe: How to threshold an image? Pin
Ryan Binns21-Jan-04 17:28
Ryan Binns21-Jan-04 17:28 
Questionthe system protect in 2k and xp ?? Pin
Anonymous21-Jan-04 4:47
Anonymous21-Jan-04 4:47 
AnswerRe: the system protect in 2k and xp ?? Pin
Matt Newman21-Jan-04 5:40
Matt Newman21-Jan-04 5:40 
AnswerRe: the system protect in 2k and xp ?? Pin
Antti Keskinen21-Jan-04 5:42
Antti Keskinen21-Jan-04 5:42 
GeneralBest way to display a text file as a resource Pin
doctorpi21-Jan-04 4:06
doctorpi21-Jan-04 4:06 
GeneralRe: Best way to display a text file as a resource Pin
Roger Allen21-Jan-04 4:42
Roger Allen21-Jan-04 4:42 
Generalcustom class wizard Pin
red2k421-Jan-04 3:50
sussred2k421-Jan-04 3:50 
GeneralRe: custom class wizard Pin
Antti Keskinen21-Jan-04 5:49
Antti Keskinen21-Jan-04 5:49 
GeneralNon-blocking Socket getting block on WSASend Pin
Member 73613721-Jan-04 3:20
Member 73613721-Jan-04 3:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.