Click here to Skip to main content
15,904,416 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to use LoadResString in VC++ to load string table Pin
Atul2322-Nov-06 19:39
Atul2322-Nov-06 19:39 
AnswerRe: How to use LoadResString in VC++ to load string table Pin
Rajesh R Subramanian22-Nov-06 20:25
professionalRajesh R Subramanian22-Nov-06 20:25 
QuestionShared Memory and XML File ? [modified] Pin
Sakthiu22-Nov-06 18:47
Sakthiu22-Nov-06 18:47 
AnswerRe: Shared Memory and XML File ? Pin
Viorel.22-Nov-06 20:16
Viorel.22-Nov-06 20:16 
QuestionRotating image Pin
Kshitij Pande22-Nov-06 18:37
Kshitij Pande22-Nov-06 18:37 
AnswerRe: Rotating image Pin
Waldermort22-Nov-06 19:59
Waldermort22-Nov-06 19:59 
GeneralRe: Rotating image Pin
Kshitij Pande22-Nov-06 21:25
Kshitij Pande22-Nov-06 21:25 
GeneralRe: Rotating image Pin
Kshitij Pande23-Nov-06 4:27
Kshitij Pande23-Nov-06 4:27 
Thanks for reply!!!!!!!!!!!
I used this code please tell me any correction....


//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);
}
Smile | :)
QuestionCatch file close event Pin
Sudhir Mangla22-Nov-06 18:36
professionalSudhir Mangla22-Nov-06 18:36 
AnswerRe: Catch file close event Pin
Galatei23-Nov-06 2:21
Galatei23-Nov-06 2:21 
QuestionDetect if a folder is locked Pin
Sudhir Mangla22-Nov-06 18:22
professionalSudhir Mangla22-Nov-06 18:22 
AnswerRe: Detect if a folder is locked Pin
Rajesh R Subramanian22-Nov-06 23:50
professionalRajesh R Subramanian22-Nov-06 23:50 
AnswerRe: Detect if a folder is locked Pin
Galatei23-Nov-06 2:34
Galatei23-Nov-06 2:34 
QuestionToolTip not working Pin
Parthi_Appu22-Nov-06 18:20
Parthi_Appu22-Nov-06 18:20 
AnswerRe: ToolTip not working Pin
Galatei23-Nov-06 2:40
Galatei23-Nov-06 2:40 
QuestionAdding functons to Interface Pin
Suresh H22-Nov-06 18:19
Suresh H22-Nov-06 18:19 
Questionproblem with free() Pin
cy163@hotmail.com22-Nov-06 17:25
cy163@hotmail.com22-Nov-06 17:25 
AnswerRe: problem with free() Pin
Waldermort22-Nov-06 18:02
Waldermort22-Nov-06 18:02 
AnswerRe: problem with free() Pin
CPallini22-Nov-06 20:14
mveCPallini22-Nov-06 20:14 
QuestionTo hide the tab control Pin
see me22-Nov-06 17:08
see me22-Nov-06 17:08 
AnswerRe: To hide the tab control Pin
see me22-Nov-06 19:32
see me22-Nov-06 19:32 
QuestionHow to set the short file name? Pin
gydong2222-Nov-06 15:58
gydong2222-Nov-06 15:58 
AnswerRe: How to set the short file name? Pin
Christian Graus22-Nov-06 16:18
protectorChristian Graus22-Nov-06 16:18 
AnswerRe: How to set the short file name? Pin
CPallini22-Nov-06 20:02
mveCPallini22-Nov-06 20:02 
AnswerRe: How to set the short file name? Pin
Michael Dunn23-Nov-06 0:35
sitebuilderMichael Dunn23-Nov-06 0:35 

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.