Click here to Skip to main content
16,004,887 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: native c++ database Pin
Leah_Garrett28-Nov-06 15:14
Leah_Garrett28-Nov-06 15:14 
QuestionError while reading a file. Pin
Lord Kixdemp23-Nov-06 11:06
Lord Kixdemp23-Nov-06 11:06 
QuestionRe: Error while reading a file. Pin
CPallini23-Nov-06 11:15
mveCPallini23-Nov-06 11:15 
AnswerRe: Error while reading a file. Pin
User 58385223-Nov-06 11:21
User 58385223-Nov-06 11:21 
GeneralRe: Error while reading a file. Pin
Lord Kixdemp23-Nov-06 12:07
Lord Kixdemp23-Nov-06 12:07 
GeneralRe: Error while reading a file. Pin
User 58385223-Nov-06 12:10
User 58385223-Nov-06 12:10 
GeneralRe: Error while reading a file. Pin
Lord Kixdemp23-Nov-06 14:23
Lord Kixdemp23-Nov-06 14:23 
QuestionHow to invert image thro 180 degree Pin
Kshitij Pande23-Nov-06 4:30
Kshitij Pande23-Nov-06 4:30 
Please suggest me any correction for this code.
This code is saving image in inverted format.
Smile | :)



//This is for getting data from clipboard in CBitmap's object.
OpenClipboard();
Glb=EnumClipboardFormats(0);
HANDLE hBitMap = GetClipboardData(Glb); //getting from clipboard

if(hBitMap == NULL)
{
AfxMessageBox("Error in Capturing Image");
return;
}
//CBitmap * bmp = CBitmap::FromHandle(hBitMap);


CBitmap bmp;


if(!bmp.Attach((HBITMAP)hBitMap))
{
AfxMessageBox( "Error in Loading Image" );

}

BITMAP bitmap ;
bmp.GetBitmap(&bitmap);

int size = ((bitmap.bmWidth)*(bitmap.bmHeight)*(bitmap.bmBitsPixel))/8;
BYTE *lpBits = new BYTE[size];

::GetBitmapBits((HBITMAP)hBitMap,size,lpBits);


WriteBmp("C\\Patient.bmp",&bitmap,(int*)lpBits);

CloseClipboard();



}



For writing ang saving .bmp file.......


void WriteBmp(char* name,BITMAP *bmp,int* data)
{
BITMAPINFO Bmi;
memset(&Bmi,0,sizeof(BITMAPINFO));
Bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
Bmi.bmiHeader.biWidth = (bmp->bmWidth);
Bmi.bmiHeader.biHeight = (bmp->bmHeight);
Bmi.bmiHeader.biPlanes = 1;
Bmi.bmiHeader.biBitCount = bmp->bmBitsPixel;
Bmi.bmiHeader.biCompression = BI_RGB;
Bmi.bmiHeader.biSizeImage = bmp->bmHeight*bmp->bmWidth*bmp->bmBitsPixel/8;

FILE* image = fopen (name,"wb");
if(image==0)
return;
int h = abs(Bmi.bmiHeader.biHeight);
int w = abs(Bmi.bmiHeader.biWidth);

Bmi.bmiHeader.biHeight=h;
Bmi.bmiHeader.biWidth=w;


int sz = Bmi.bmiHeader.biSizeImage;

BITMAPFILEHEADER bfh;
bfh.bfType=('M'<<8)+('B');

bfh.bfOffBits=sizeof(BITMAPFILEHEADER)+ sizeof(BITMAPINFOHEADER);
bfh.bfSize=sz+bfh.bfOffBits;
bfh.bfReserved1=0;
bfh.bfReserved2=0;

fwrite(&bfh,sizeof(bfh),1,image);
fwrite(&Bmi.bmiHeader,sizeof(BITMAPINFOHEADER),1,image);
fwrite(data,sz,1,image);
fclose(image);
}
Answer[OT] &lt;pre&gt; Pin
toxcct23-Nov-06 4:36
toxcct23-Nov-06 4:36 
AnswerRe: How to invert image thro 180 degree Pin
CPallini23-Nov-06 4:41
mveCPallini23-Nov-06 4:41 
QuestionDesign time issue with a /clr projects Pin
dreamz648023-Nov-06 3:47
dreamz648023-Nov-06 3:47 
AnswerRe: Design time issue with a /clr projects Pin
toxcct23-Nov-06 4:11
toxcct23-Nov-06 4:11 
QuestionIssue using CTreeCtrl with Checkboxes and SetCheck() Pin
flippydeflippydebop23-Nov-06 2:52
flippydeflippydebop23-Nov-06 2:52 
AnswerRe: Issue using CTreeCtrl with Checkboxes and SetCheck() Pin
flippydeflippydebop23-Nov-06 3:00
flippydeflippydebop23-Nov-06 3:00 
QuestionChecking URL is Valid or Not through MFC Pin
kiranin23-Nov-06 1:17
kiranin23-Nov-06 1:17 
AnswerRe: Checking URL is Valid or Not through MFC Pin
Anilkumar K V23-Nov-06 1:34
Anilkumar K V23-Nov-06 1:34 
GeneralRe: Checking URL is Valid or Not through MFC Pin
kiranin23-Nov-06 1:39
kiranin23-Nov-06 1:39 
GeneralRe: Checking URL is Valid or Not through MFC Pin
Waldermort23-Nov-06 1:50
Waldermort23-Nov-06 1:50 
QuestionConversion from CString to Char * ?? Pin
narayanagvs23-Nov-06 0:48
narayanagvs23-Nov-06 0:48 
AnswerRe: Conversion from CString to Char * ?? Pin
Rajesh R Subramanian23-Nov-06 0:50
professionalRajesh R Subramanian23-Nov-06 0:50 
AnswerRe: Conversion from CString to Char * ?? Pin
Viorel.23-Nov-06 1:12
Viorel.23-Nov-06 1:12 
QuestionFunction Signature Pin
Anilkumar K V23-Nov-06 0:45
Anilkumar K V23-Nov-06 0:45 
AnswerRe: Function Signature Pin
Cedric Moonen23-Nov-06 1:00
Cedric Moonen23-Nov-06 1:00 
QuestionHow to change font of menu to Marathi . Pin
Atul2322-Nov-06 23:30
Atul2322-Nov-06 23:30 
QuestionRe: How to change font of menu to Marathi . Pin
Rajesh R Subramanian22-Nov-06 23:36
professionalRajesh R Subramanian22-Nov-06 23:36 

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.