Click here to Skip to main content
15,900,906 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMarquee Progess Bar Pin
JM22518-Apr-10 3:40
JM22518-Apr-10 3:40 
AnswerRe: Marquee Progess Bar Pin
Nuri Ismail8-Apr-10 4:05
Nuri Ismail8-Apr-10 4:05 
AnswerRe: Marquee Progess Bar Pin
Cool_Dev8-Apr-10 4:20
Cool_Dev8-Apr-10 4:20 
GeneralRe: Marquee Progess Bar Pin
JM22518-Apr-10 20:31
JM22518-Apr-10 20:31 
GeneralRe: Marquee Progess Bar Pin
Emilio Garavaglia8-Apr-10 21:48
Emilio Garavaglia8-Apr-10 21:48 
GeneralRe: Marquee Progess Bar Pin
Cool_Dev8-Apr-10 22:26
Cool_Dev8-Apr-10 22:26 
GeneralRe: Marquee Progess Bar Pin
Emilio Garavaglia9-Apr-10 3:04
Emilio Garavaglia9-Apr-10 3:04 
GeneralRe: Marquee Progess Bar Pin
Cool_Dev9-Apr-10 3:42
Cool_Dev9-Apr-10 3:42 
QuestionHow to assign Drive Letter to a volume? Pin
Madan Chauhan8-Apr-10 2:21
Madan Chauhan8-Apr-10 2:21 
AnswerRe: How to assign Drive Letter to a volume? Pin
Adam Roderick J8-Apr-10 2:31
Adam Roderick J8-Apr-10 2:31 
AnswerRe: How to assign Drive Letter to a volume? Pin
KarstenK8-Apr-10 3:08
mveKarstenK8-Apr-10 3:08 
QuestionHow could I run one of my class member Functions in a new thread: Pin
m_code8-Apr-10 2:09
m_code8-Apr-10 2:09 
AnswerRe: How could I run one of my class member Functions in a new thread: Pin
Adam Roderick J8-Apr-10 2:20
Adam Roderick J8-Apr-10 2:20 
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 

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.