Click here to Skip to main content
15,898,036 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Run Powerpoint viewer in assigned screen location Pin
chetto7731-Mar-10 13:54
chetto7731-Mar-10 13:54 
GeneralRe: Run Powerpoint viewer in assigned screen location Pin
Iain Clarke, Warrior Programmer31-Mar-10 21:11
Iain Clarke, Warrior Programmer31-Mar-10 21:11 
Questionvisual studio 2008 form designer - where did all the controls go? Pin
Sauce!7-Dec-09 22:19
Sauce!7-Dec-09 22:19 
AnswerRe: visual studio 2008 form designer - where did all the controls go? Pin
Sauce!9-Dec-09 14:45
Sauce!9-Dec-09 14:45 
QuestionHow to Debug a DLL written in VC 6.0 in ASP.NET ( MSVS 2008 ) application? Pin
yudhisthira7-Dec-09 19:30
yudhisthira7-Dec-09 19:30 
AnswerRe: How to Debug a DLL written in VC 6.0 in ASP.NET ( MSVS 2008 ) application? Pin
Cedric Moonen7-Dec-09 21:36
Cedric Moonen7-Dec-09 21:36 
QuestionCan we open two Modal Dialogs at Same Time? Pin
002comp7-Dec-09 19:18
002comp7-Dec-09 19:18 
AnswerRe: Can we open two Modal Dialogs at Same Time? Pin
Cedric Moonen7-Dec-09 20:29
Cedric Moonen7-Dec-09 20:29 
AnswerRe: Can we open two Modal Dialogs at Same Time? Pin
Rajesh R Subramanian8-Dec-09 1:35
professionalRajesh R Subramanian8-Dec-09 1:35 
AnswerRe: Can we open two Modal Dialogs at Same Time? Pin
Richard MacCutchan8-Dec-09 2:03
mveRichard MacCutchan8-Dec-09 2:03 
AnswerRe: Can we open two Modal Dialogs at Same Time? Pin
dxlee8-Dec-09 4:10
dxlee8-Dec-09 4:10 
Question[Message Deleted] Pin
Benjamin Bruno7-Dec-09 18:15
Benjamin Bruno7-Dec-09 18:15 
AnswerRe: serialization Pin
Adam Roderick J7-Dec-09 18:24
Adam Roderick J7-Dec-09 18:24 
GeneralRe: serialization Pin
Tim Craig8-Dec-09 21:04
Tim Craig8-Dec-09 21:04 
AnswerRe: serialization Pin
Cedric Moonen7-Dec-09 20:21
Cedric Moonen7-Dec-09 20:21 
QuestionHelp - To draw image as banner with help of co-ordinates. Pin
Le@rner7-Dec-09 17:56
Le@rner7-Dec-09 17:56 
AnswerRe: Help - To draw image as banner with help of co-ordinates. Pin
Cedric Moonen7-Dec-09 20:31
Cedric Moonen7-Dec-09 20:31 
GeneralRe: Help - To draw image as banner with help of co-ordinates. Pin
Le@rner7-Dec-09 23:13
Le@rner7-Dec-09 23:13 
AnswerRe: Help - To draw image as banner with help of co-ordinates. Pin
Cedric Moonen7-Dec-09 23:48
Cedric Moonen7-Dec-09 23:48 
You mean that it always stays on top of your screen even when you scroll down and you like it to move upwards instead ?
If that's the case, what you have to do is keep the scroll offset in a member variable of your class: each time you scroll up or down, you calculate the offset that you have to apply to the drawings and you store it in the variable (and then request a repaint of your view). Then, in the OnPaint method you use this offset in the second parameter of the StretchBlt function (the y-coordinate of the upper-left corner of the destination rectangle). The scroll is not automatically managed for you, so you have to compute yourself the offset you will apply to the drawings so that they are positionned correctly.

There are also a lot of remarks for your code which is not really clean: you are for instance mixing calls to the MFC and calls to the Win32. It is not dramatic but it is really ugly. You should stick to one of the two, and as this is an MFC application, you should stick to the MFC API only (this could sometimes be really bad to mix the two).

CDC* dc=this->GetDC();

Why do you call GetDC ? You are in the OnPaint method so you receive the CDC as an argument and you should use that one.

HDC memdc;

Use the CDC class from the MFC instead of the win32 API

bitmap.LoadBitmapA(IDB_HEADER);

Never never call a specific type of a function like that. You should always call the generic version (LoadBitmap). If you have compilation errors, I strongly suggest you read this article[^] to have a better understanding of character encoding.

memdc=::CreateCompatibleDC(dc->m_hDC);

Once again you are calling the Win32 function and you should call the CDC::CreateCompatibleDC instead.

::SelectObject(memdc,bitmap);	
StretchBlt(dc->m_hDC,0,0,rect.Width(),50,memdc,0,0,w,h,SRCCOPY);

Same thing here.

m_Banner.GetWindowTextA(Title);

Same remark as before: use GetWindowText instead.

Cédric Moonen
Software developer

Charting control [v2.0]
OpenGL game tutorial in C++

QuestionBitmap [modified] Pin
transoft7-Dec-09 4:00
transoft7-Dec-09 4:00 
AnswerRe: Bitmap Pin
Cedric Moonen7-Dec-09 4:27
Cedric Moonen7-Dec-09 4:27 
GeneralRe: Bitmap Pin
transoft7-Dec-09 4:58
transoft7-Dec-09 4:58 
GeneralRe: Bitmap Pin
Cedric Moonen7-Dec-09 5:01
Cedric Moonen7-Dec-09 5:01 
GeneralRe: Bitmap Pin
transoft7-Dec-09 5:06
transoft7-Dec-09 5:06 
AnswerRe: Bitmap Pin
«_Superman_»7-Dec-09 4:31
professional«_Superman_»7-Dec-09 4:31 

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.