Click here to Skip to main content
15,892,161 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: RS232 communication in VC++ 6.0 Pin
Iain Clarke, Warrior Programmer15-Sep-09 22:52
Iain Clarke, Warrior Programmer15-Sep-09 22:52 
QuestionHow to use order by clause in insert into statement Pin
jadhavjitendrar15-Sep-09 19:23
jadhavjitendrar15-Sep-09 19:23 
AnswerRe: How to use order by clause in insert into statement Pin
«_Superman_»15-Sep-09 19:31
professional«_Superman_»15-Sep-09 19:31 
AnswerRe: How to use order by clause in insert into statement Pin
CPallini15-Sep-09 21:08
mveCPallini15-Sep-09 21:08 
QuestionCompiler Design in C Pin
DarkSorrow3815-Sep-09 19:05
DarkSorrow3815-Sep-09 19:05 
AnswerRe: Compiler Design in C Pin
«_Superman_»15-Sep-09 19:28
professional«_Superman_»15-Sep-09 19:28 
QuestionEXECUTE_OFFLINE_DIAGS example Pin
Abinash Mohanty15-Sep-09 18:48
Abinash Mohanty15-Sep-09 18:48 
QuestionDrawing lines, shapes on bitmaps Pin
Game-point15-Sep-09 18:22
Game-point15-Sep-09 18:22 
AnswerRe: Drawing lines, shapes on bitmaps Pin
Naveen15-Sep-09 18:36
Naveen15-Sep-09 18:36 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Game-point15-Sep-09 19:02
Game-point15-Sep-09 19:02 
GeneralRe: Drawing lines, shapes on bitmaps Pin
«_Superman_»15-Sep-09 19:34
professional«_Superman_»15-Sep-09 19:34 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Game-point15-Sep-09 19:54
Game-point15-Sep-09 19:54 
GeneralRe: Drawing lines, shapes on bitmaps Pin
«_Superman_»15-Sep-09 19:59
professional«_Superman_»15-Sep-09 19:59 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Game-point15-Sep-09 20:05
Game-point15-Sep-09 20:05 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Naveen15-Sep-09 20:16
Naveen15-Sep-09 20:16 
you said you want to draw some lines and shapes. But the above code is not doing any of that.


rajugis wrote:
HDC dcBmp=CreateCompatibleDC(TmpDC); HGDIOBJ TmpObj2 = SelectObject(dcBmp,(HGDIOBJ)_image); BitBlt(TmpDC,0,0,width,height,dcBmp,0,0,SRCCOPY);


What the above code does is copy the image in dcBmp to TmpDC. The dcBmp has your image, but the target dc TmpDC doesnt have any bitmap selected into it. So basically that BitBlt function does nothing. To have a valid image in the TempDC, you have to select one bitmap to that dc. Check the below code(especially the one in the bold ). The hBmp conatins the final image.


HDC dcBmp=CreateCompatibleDC(pDC);
HBITMAP hBmp = CreateCompatibleBitmap(pDC, 20,20);
HGDIOBJ OldBmp = SelectObject(TmpDC,(HGDIOBJ)hBmp);

HGDIOBJ TmpObj2 = SelectObject(dcBmp,(HGDIOBJ)_image);
BitBlt(TmpDC,0,0,width,height,dcBmp,0,0,SRCCOPY);
SelectObject(dcBmp,TmpObj2);
SelectObject(TmpDC,OldBmp);


GeneralRe: Drawing lines, shapes on bitmaps Pin
Game-point15-Sep-09 20:36
Game-point15-Sep-09 20:36 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Naveen15-Sep-09 20:39
Naveen15-Sep-09 20:39 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Game-point15-Sep-09 20:42
Game-point15-Sep-09 20:42 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Naveen15-Sep-09 21:00
Naveen15-Sep-09 21:00 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Game-point15-Sep-09 21:33
Game-point15-Sep-09 21:33 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Naveen15-Sep-09 21:35
Naveen15-Sep-09 21:35 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Game-point15-Sep-09 21:51
Game-point15-Sep-09 21:51 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Naveen15-Sep-09 21:52
Naveen15-Sep-09 21:52 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Game-point15-Sep-09 21:58
Game-point15-Sep-09 21:58 
GeneralRe: Drawing lines, shapes on bitmaps Pin
Naveen15-Sep-09 22:07
Naveen15-Sep-09 22:07 

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.