if(IDOK==MessageBox(NULL , "Question 1", "Do you like World Of Warcraft?", NULL | MB_YESNOCANCEL)) then { add you code here } else { add you code here } I LOVE VC
daojinliu
Posts
-
REQ : Question with message box. -
DIBitmapyes,the pData should be pData=new unsigned char[768*576*3],but after above update,I am fail to create the DIB bitmap again, I LOVE VC
-
DIBitmapI got a error that there was a ASSERT error in the line of "CreateDIBitmap()", I am fail to create a DIB bitmap and display it in the monitor. I LOVE VC
-
How to delete a class?you should also delete the cpp&h files in the "FILEVIEW" of workspace view(which containing three view,Class view,resource views,fileview),delete the cpp file in the "Soure Files",and delete the h file int the "Header files".Following above steps, you will not get the compilatin error. I LOVE VC -- modified at 21:58 Saturday 15th October, 2005
-
DIBitmapint the function OnDraw();I want to create a DIB bitmap using the array pData,and display it on the screen,but I am not fail to do it;Would please tell me how to correct the codes below. //the array containing color information unsigned char* pData=new unsigned char[768*576*3]; int y=0, x=0; for(;y<576;y++) for(;x<768;x++) { pData[x*3+y*768*3]=0; pData[x*3+1+y*768*3]=0; pData[x*3+2+y*768*3]=255; } //information header BITMAPINFOHEADER FrameBmi; FrameBmi.biSize=sizeof(BITMAPINFOHEADER); FrameBmi.biPlanes=1; FrameBmi.biCompression=BI_RGB; FrameBmi.biClrImportant=0; FrameBmi.biSizeImage=768*576*3; FrameBmi.biClrUsed=0; FrameBmi.biBitCount=24; FrameBmi.biWidth=768; FrameBmi.biHeight=576; FrameBmi.biXPelsPerMeter = 0; FrameBmi.biYPelsPerMeter =0; //file header BITMAPFILEHEADER pf; pf.bfType=0x4d42; //"BM" pf.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+sizeof(char[768*576]); pf.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); pf.bfReserved1=0; pf.bfReserved2=0; //BITMAPINFOHEADER LPBITMAPINFO lpbmi=(LPBITMAPINFO)GlobalAlloc(GMEM_FIXED,sizeof(BITMAPINFOHEADER)); ASSERT(lpbmi); lpbmi->bmiHeader.biSize=FrameBmi.biSize; lpbmi->bmiHeader.biPlanes=FrameBmi.biPlanes; lpbmi->bmiHeader.biCompression=FrameBmi.biCompression; lpbmi->bmiHeader.biClrImportant=FrameBmi.biClrImportant; lpbmi->bmiHeader.biSizeImage=FrameBmi.biSizeImage; lpbmi->bmiHeader.biClrUsed=FrameBmi.biClrUsed; lpbmi->bmiHeader.biBitCount=FrameBmi.biBitCount; lpbmi->bmiHeader.biWidth=FrameBmi.biWidth; lpbmi->bmiHeader.biHeight=FrameBmi.biHeight; lpbmi->bmiHeader.biXPelsPerMeter=FrameBmi.biXPelsPerMeter; lpbmi->bmiHeader.biYPelsPerMeter=FrameBmi.biYPelsPerMeter; lpbmi->bmiColors=NULL; //Create DIBitmap CBitmap *OldBitmap; HBITMAP bmp =::CreateDIBitmap((HDC)pDC,&FrameBmi,CBM_INIT,pData,lpbmi, DIB_RGB_COLORS); ASSERT(bmp); // CBitmap bitmap; bitmap.Attach(bmp); CDC dcComp; dcComp.CreateCompatibleDC(pDC); OldBitmap=dcComp.SelectObject(&bitmap); BITMAP bm; bitmap.GetObject(sizeof(BITMAP),&bm); // draw bitmap pDC->BitBlt(0,0,768,576,&dcComp,0,0,SRCCOPY); dcComp.SelectObject(OldBitmap); delete [] pData; GlobalFree(lpbmi); delteDC(dcComp); I LOVE VC -- modified at 6:43 Sunday 16th October, 2005
-
how to create a DIB bitmap with a arrayint the function OnDraw(),I want to create a DIB bitmap using the array pData,but I am not successful,Please help me. //the array containing color information unsigned char* pData=new unsigned char[768*576]; int y=0, x=0; for(;y<576;y++) for(;x<768;x++) { pData[x*3+y*768*3]=0; pData[x*3+1+y*768*3]=0; pData[x*3+2+y*768*3]=255; } //information header BITMAPINFOHEADER FrameBmi; FrameBmi.biSize=sizeof(BITMAPINFOHEADER); FrameBmi.biPlanes=1; FrameBmi.biCompression=BI_RGB; FrameBmi.biClrImportant=0; FrameBmi.biSizeImage=768*576*3; FrameBmi.biClrUsed=0; FrameBmi.biBitCount=24; FrameBmi.biWidth=768; FrameBmi.biHeight=576; FrameBmi.biXPelsPerMeter = 0; FrameBmi.biYPelsPerMeter =0; //file header BITMAPFILEHEADER pf; pf.bfType=0x4d42; //"BM" pf.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+sizeof(char[768*576]); pf.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); pf.bfReserved1=0; pf.bfReserved2=0; //BITMAPINFOHEADER LPBITMAPINFO lpbmi=(LPBITMAPINFO)GlobalAlloc(GMEM_FIXED,sizeof(BITMAPINFOHEADER)); ASSERT(lpbmi); lpbmi->bmiHeader.biSize=FrameBmi.biSize; lpbmi->bmiHeader.biPlanes=FrameBmi.biPlanes; lpbmi->bmiHeader.biCompression=FrameBmi.biCompression; lpbmi->bmiHeader.biClrImportant=FrameBmi.biClrImportant; lpbmi->bmiHeader.biSizeImage=FrameBmi.biSizeImage; lpbmi->bmiHeader.biClrUsed=FrameBmi.biClrUsed; lpbmi->bmiHeader.biBitCount=FrameBmi.biBitCount; lpbmi->bmiHeader.biWidth=FrameBmi.biWidth; lpbmi->bmiHeader.biHeight=FrameBmi.biHeight; lpbmi->bmiHeader.biXPelsPerMeter=FrameBmi.biXPelsPerMeter; lpbmi->bmiHeader.biYPelsPerMeter=FrameBmi.biYPelsPerMeter; lpbmi->bmiColors=NULL; //创建DIB位图 CBitmap *OldBitmap; HBITMAP bmp =::CreateDIBitmap((HDC)pDC,&FrameBmi,CBM_INIT,pData,lpbmi, DIB_RGB_COLORS); ASSERT(bmp); // CBitmap bitmap; bitmap.Attach(bmp); CDC dcComp; dcComp.CreateCompatibleDC(pDC); OldBitmap=dcComp.SelectObject(&bitmap); BITMAP bm; bitmap.GetObject(sizeof(BITMAP),&bm); // draw bitmap pDC->BitBlt(0,0,768,576,&dcComp,0,0,SRCCOPY); dcComp.SelectObject(OldBitmap); delete [] pData; GlobalFree(lpbmi); help me!