Click here to Skip to main content
15,884,472 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How could I run one of my class member Functions in a new thread: Pin
Cool_Dev8-Apr-10 2:24
Cool_Dev8-Apr-10 2:24 
GeneralRe: How could I run one of my class member Functions in a new thread: Pin
m_code8-Apr-10 3:03
m_code8-Apr-10 3:03 
GeneralMessage Removed Pin
8-Apr-10 3:28
Eugen Podsypalnikov8-Apr-10 3:28 
GeneralRe: How could I run one of my class member Functions in a new thread: Pin
m_code8-Apr-10 3:44
m_code8-Apr-10 3:44 
AnswerRe: How could I run one of my class member Functions in a new thread: Pin
KarstenK8-Apr-10 3:41
mveKarstenK8-Apr-10 3:41 
GeneralRe: How could I run one of my class member Functions in a new thread: Pin
m_code8-Apr-10 3:50
m_code8-Apr-10 3:50 
GeneralRe: How could I run one of my class member Functions in a new thread: Pin
KarstenK8-Apr-10 4:09
mveKarstenK8-Apr-10 4:09 
QuestionCreateBitmapIndirect() doesnt create bitmap Pin
globus0008-Apr-10 2:08
globus0008-Apr-10 2:08 
Hello
I've got the following problem with CreateBitmapIndirect(). I've got bitmap data - width, height, bits-per-pixel and array of bits. I'm trying to create HBITMAP by calling CreateBitmapIndirect, but when it's created the biBits of the BITMAP object is NULL. Here is the cpde"
int size = 0, width = 0, height = 0, planes = 0, bpp = 0, r = 0, g = 0, b = 0;
unsigned char* pBits = NULL;
CComVariant data;
hr = pIShellBmp->GetData( &width, &height, &planes, &bpp, &data ); //my interface which returns serialized bitmap
hr = pIShellBmp->GetColors( &r, &g, &b );
            if( SUCCEEDED(hr) )
            {

                CComSafeArray<BYTE> bits( data.parray );
                pBits = new unsigned char[ bits.GetCount() ]; // this is array of bits in bitmap - it's content of other BITMAP::biBits which I store in IShellBmp interface in COM server (local service)
                for( int i = 0; i < bits.GetCount(); ++i )
                {
                    pBits[i] = bits.GetAt( i );
                }

                BITMAP bmp;

                bmp.bmType = 0;
                bmp.bmBitsPixel = bpp;
                bmp.bmHeight = height;
                bmp.bmPlanes = planes;
                bmp.bmWidth = width;
                bmp.bmWidthBytes = width * bpp / 8 + (width * bpp / 8)%2;
                bmp.bmBits = pBits;


                HBITMAP hBitmap = CreateBitmapIndirect( &bmp ); // THIS IS OK - bitmap created


                BITMAPINFO bmi;
                bmi.bmiHeader.biSize = sizeof(BITMAPINFO);
                bmi.bmiHeader.biBitCount = bpp;
                bmi.bmiHeader.biClrImportant = 0;
                bmi.bmiHeader.biClrUsed = 0;
                bmi.bmiHeader.biCompression = BI_RGB;
                bmi.bmiHeader.biHeight = height;
                bmi.bmiHeader.biPlanes = planes;
                bmi.bmiHeader.biSizeImage = 0;
                bmi.bmiHeader.biWidth = width;


                if( hBitmap == NULL )
                {
                    DWORD err = GetLastError();
                    hr = E_FAIL;
                }//if
                else
                {
                    DWORD err = SetDIBits( CreateCompatibleDC(NULL), hBitmap, 0, bmp.bmHeight, pBits, &bmi, DIB_RGB_COLORS );  // This line returns 0 - ???
                    err = GetLastError(); // error code is 0
                    GetObject( hBitmap, sizeof(BITMAP), &bmp ); // bmp.bibits contains NULL - why??
                    WriteBMPFile( hBitmap, _T("c:\\received.bmp"), CreateCompatibleDC( NULL ) );
                }//else
            }//if

For some reasons the lines in bold fail and there is no error code. Can you please help me - where I'm wrong?
AnswerRe: CreateBitmapIndirect() doesnt create bitmap Pin
KarstenK8-Apr-10 3:23
mveKarstenK8-Apr-10 3:23 
AnswerRe: CreateBitmapIndirect() doesnt create bitmap Pin
Jonathan Davies8-Apr-10 5:23
Jonathan Davies8-Apr-10 5:23 
QuestionWidest Character and Height of the character Pin
shiv@nand8-Apr-10 1:13
shiv@nand8-Apr-10 1:13 
AnswerRe: Widest Character and Height of the character Pin
Eugen Podsypalnikov8-Apr-10 1:37
Eugen Podsypalnikov8-Apr-10 1:37 
GeneralRe: Widest Character and Height of the character Pin
Adam Roderick J8-Apr-10 1:41
Adam Roderick J8-Apr-10 1:41 
GeneralRe: Widest Character and Height of the character Pin
shiv@nand8-Apr-10 1:49
shiv@nand8-Apr-10 1:49 
GeneralRe: Widest Character and Height of the character Pin
Eugen Podsypalnikov8-Apr-10 2:01
Eugen Podsypalnikov8-Apr-10 2:01 
GeneralRe: Widest Character and Height of the character Pin
shiv@nand8-Apr-10 2:17
shiv@nand8-Apr-10 2:17 
AnswerRe: Widest Character and Height of the character Pin
Michel Godfroid8-Apr-10 6:47
Michel Godfroid8-Apr-10 6:47 
JokeRe: Widest Character and Height of the character Pin
Eugen Podsypalnikov8-Apr-10 9:07
Eugen Podsypalnikov8-Apr-10 9:07 
GeneralRe: Widest Character and Height of the character Pin
Michel Godfroid8-Apr-10 9:21
Michel Godfroid8-Apr-10 9:21 
GeneralRe: Widest Character and Height of the character Pin
shiv@nand8-Apr-10 17:46
shiv@nand8-Apr-10 17:46 
QuestionEncrypt Pin
MsmVc8-Apr-10 0:41
MsmVc8-Apr-10 0:41 
AnswerRe: Encrypt PinPopular
_AnsHUMAN_ 8-Apr-10 0:44
_AnsHUMAN_ 8-Apr-10 0:44 
GeneralRe: Encrypt Pin
MsmVc8-Apr-10 0:47
MsmVc8-Apr-10 0:47 
GeneralMessage Removed Pin
8-Apr-10 2:02
MsmVc8-Apr-10 2:02 
GeneralRe: Encrypt Pin
KarstenK8-Apr-10 3:25
mveKarstenK8-Apr-10 3:25 

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.