Click here to Skip to main content
15,923,557 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProblems with drawing Pin
S O S26-Dec-02 7:58
S O S26-Dec-02 7:58 
GeneralRe: Problems with drawing Pin
Neville Franks26-Dec-02 10:02
Neville Franks26-Dec-02 10:02 
GeneralRe: Problems with drawing Pin
S O S26-Dec-02 11:04
S O S26-Dec-02 11:04 
GeneralFor Mr.Locked Ghost Pin
HellShrimp4free26-Dec-02 11:22
HellShrimp4free26-Dec-02 11:22 
GeneralRe: For Mr.Locked Ghost Pin
S O S26-Dec-02 21:47
S O S26-Dec-02 21:47 
GeneralRe: Problems with drawing Pin
Neville Franks26-Dec-02 13:00
Neville Franks26-Dec-02 13:00 
GeneralRe: Problems with drawing Pin
S O S26-Dec-02 21:49
S O S26-Dec-02 21:49 
GeneralRe: Problems with drawing Pin
Iain Clarke, Warrior Programmer27-Dec-02 7:43
Iain Clarke, Warrior Programmer27-Dec-02 7:43 
I've run into this myself in the past. You are creating a DC which initially has a mono 1x1 bitmap
selected into it (look at ::CreateCompatible DC...) You need to create a HBITMAP compatible with the
end DC (e.g. Screen).

You need something like:

void Init (CxImage *i)
{
    CWindowDC dcScreen (CWnd::FromHandle (::GetDesktopWindow ()));

    w = i->GetWidth();
    h = i->GetHeight();

    VERIFY(CreateCompatibleDC(&dcScreen));    // <-- Changed to make it more obvious.
    ////////////////////////////
    VERIFY(bmp.CreateCompatibleBitmap(&dcScreen, w, h)); // <-- Changed
    ////////////////////////////
    bmpOld = (CBitmap*)SelectObject(bmp);
    i->Draw(m_hDC); // Works if I do this on the window DC straight away
}


I hope this helps,


Iain.
GeneralRe: Problems with drawing Pin
S O S27-Dec-02 8:18
S O S27-Dec-02 8:18 
GeneralRe: Problems with drawing Pin
Iain Clarke, Warrior Programmer28-Dec-02 13:11
Iain Clarke, Warrior Programmer28-Dec-02 13:11 
GeneralMetafile Pin
Anthony988726-Dec-02 7:48
Anthony988726-Dec-02 7:48 
GeneralSendMessage and BN_CLICKED doesn't work Pin
User 665826-Dec-02 6:40
User 665826-Dec-02 6:40 
GeneralRe: SendMessage and BN_CLICKED doesn't work Pin
AlexO26-Dec-02 6:51
AlexO26-Dec-02 6:51 
GeneralRe: SendMessage and BN_CLICKED doesn't work Pin
User 665826-Dec-02 7:17
User 665826-Dec-02 7:17 
GeneralRe: SendMessage and BN_CLICKED doesn't work Pin
Brian Delahunty26-Dec-02 8:07
Brian Delahunty26-Dec-02 8:07 
GeneralOwner of a process Pin
Nish Nishant26-Dec-02 6:09
sitebuilderNish Nishant26-Dec-02 6:09 
GeneralRe: Owner of a process Pin
AlexO26-Dec-02 6:35
AlexO26-Dec-02 6:35 
GeneralRe: Owner of a process Pin
Nish Nishant26-Dec-02 7:19
sitebuilderNish Nishant26-Dec-02 7:19 
GeneralRe: Owner of a process Pin
Mike Nordell26-Dec-02 7:35
Mike Nordell26-Dec-02 7:35 
GeneralRe: Owner of a process Pin
Nish Nishant26-Dec-02 8:18
sitebuilderNish Nishant26-Dec-02 8:18 
GeneralRe: Owner of a process Pin
Nish Nishant26-Dec-02 8:28
sitebuilderNish Nishant26-Dec-02 8:28 
GeneralRe: Owner of a process Pin
Mike Nordell27-Dec-02 1:36
Mike Nordell27-Dec-02 1:36 
GeneralRe: Owner of a process Pin
User 665826-Dec-02 8:40
User 665826-Dec-02 8:40 
GeneralRe: Owner of a process Pin
Nish Nishant26-Dec-02 8:52
sitebuilderNish Nishant26-Dec-02 8:52 
GeneralRe: Owner of a process Pin
retZ26-Dec-02 10:45
retZ26-Dec-02 10:45 

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.