Click here to Skip to main content
15,885,366 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to store BLOB images into Oracle Database using ADO Pin
S Douglas3-Oct-05 0:27
professionalS Douglas3-Oct-05 0:27 
QuestionDoubt about which message handler to use Pin
Ravi Sankar S2-Oct-05 20:45
Ravi Sankar S2-Oct-05 20:45 
AnswerRe: Doubt about which message handler to use Pin
Lane Yu2-Oct-05 22:01
Lane Yu2-Oct-05 22:01 
AnswerRe: Doubt about which message handler to use Pin
Intertherain3-Oct-05 2:49
Intertherain3-Oct-05 2:49 
QuestionRe: Doubt about which message handler to use Pin
David Crow3-Oct-05 2:54
David Crow3-Oct-05 2:54 
AnswerRe: Doubt about which message handler to use Pin
Ravi Sankar S3-Oct-05 3:27
Ravi Sankar S3-Oct-05 3:27 
QuestionOwner draw ClistCtrl Pin
Jagadeesh VN2-Oct-05 20:30
Jagadeesh VN2-Oct-05 20:30 
QuestionPrinting a Captured Bitmap Pin
karnal2-Oct-05 20:27
karnal2-Oct-05 20:27 
I am karnal and nowadys learning Vc.
I have a problem

"I have a Dialog based MFC program via i captured Bitmap, now i want to print this captured bitmap on default network printer,

The code for capturing bitmap is as follows
-------------------------------
void WriteBmp(char* filename,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 (filename,"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);
}


void CFullscreenDlg::OnShowWindow()
{


HANDLE hBitMap =(HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
m_bmp.m_str,IMAGE_BITMAP,0,0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION); // put here the handle of the window you would like to caputre
CBitmap bmp;
bmp.Attach((HBITMAP)hBitMap);

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:\\test.bmp",&bitmap,(int*)lpBits);
delete []lpBits;
}
-----------------------------------------------

so plz help me to solved out my printing problem.


Thanking u all
Karnal








karnal
QuestionJPG file Pin
aasstt2-Oct-05 20:05
aasstt2-Oct-05 20:05 
AnswerRe: JPG file Pin
Stlan2-Oct-05 23:47
Stlan2-Oct-05 23:47 
QuestionEnable/Disable pop-up Menu items Pin
lavate malllik2-Oct-05 20:00
lavate malllik2-Oct-05 20:00 
AnswerRe: Enable/Disable pop-up Menu items Pin
lavate malllik2-Oct-05 21:00
lavate malllik2-Oct-05 21:00 
AnswerRe: Enable/Disable pop-up Menu items Pin
Lane Yu2-Oct-05 21:11
Lane Yu2-Oct-05 21:11 
QuestionPreTranslateMessage Pin
Nishad S2-Oct-05 17:47
Nishad S2-Oct-05 17:47 
AnswerRe: PreTranslateMessage Pin
Mircea Puiu2-Oct-05 20:37
Mircea Puiu2-Oct-05 20:37 
GeneralRe: PreTranslateMessage Pin
Nishad S2-Oct-05 22:08
Nishad S2-Oct-05 22:08 
GeneralRe: PreTranslateMessage Pin
Mircea Puiu3-Oct-05 0:53
Mircea Puiu3-Oct-05 0:53 
GeneralRe: PreTranslateMessage Pin
Nishad S3-Oct-05 1:44
Nishad S3-Oct-05 1:44 
QuestionCmenu Pin
act_x2-Oct-05 15:58
act_x2-Oct-05 15:58 
Questionsimulate a hardware interrupt? Pin
hypnotikalthoughts2-Oct-05 14:26
hypnotikalthoughts2-Oct-05 14:26 
AnswerRe: simulate a hardware interrupt? Pin
Jose Lamas Rios2-Oct-05 16:19
Jose Lamas Rios2-Oct-05 16:19 
Questionnetwork inquiries Pin
benjnp2-Oct-05 14:10
benjnp2-Oct-05 14:10 
AnswerRe: network inquiries Pin
Calc202-Oct-05 20:55
Calc202-Oct-05 20:55 
AnswerRe: network inquiries Pin
vikas amin2-Oct-05 20:58
vikas amin2-Oct-05 20:58 
AnswerRe: network inquiries Pin
S Douglas2-Oct-05 23:26
professionalS Douglas2-Oct-05 23:26 

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.