Click here to Skip to main content
15,920,603 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to add MFC CStatic to a ATL project? Pin
ThinkingPrometheus16-Jun-05 4:29
ThinkingPrometheus16-Jun-05 4:29 
GeneralRe: how to add MFC CStatic to a ATL project? Pin
James R. Twine16-Jun-05 8:28
James R. Twine16-Jun-05 8:28 
GeneralRe: how to add MFC CStatic to a ATL project? Pin
vikas amin26-Aug-05 2:56
vikas amin26-Aug-05 2:56 
GeneralRe: how to add MFC CStatic to a ATL project? Pin
James R. Twine6-Sep-05 16:46
James R. Twine6-Sep-05 16:46 
Generalhelp needed Pin
amneetKAUR16-Jun-05 3:39
amneetKAUR16-Jun-05 3:39 
GeneralConverting a metafile to a 24-bit color bitmap Pin
bkphat16-Jun-05 3:25
bkphat16-Jun-05 3:25 
GeneralRe: Converting a metafile to a 24-bit color bitmap Pin
Chris Losinger16-Jun-05 3:50
professionalChris Losinger16-Jun-05 3:50 
GeneralCOM Port Pin
A_Fa16-Jun-05 2:54
A_Fa16-Jun-05 2:54 
GeneralRe: COM Port Pin
Bob Stanneveld16-Jun-05 2:58
Bob Stanneveld16-Jun-05 2:58 
GeneralRe: COM Port Pin
David Crow16-Jun-05 3:39
David Crow16-Jun-05 3:39 
GeneralRe: COM Port Pin
A_Fa16-Jun-05 7:56
A_Fa16-Jun-05 7:56 
GeneralRe: COM Port Pin
David Crow16-Jun-05 8:08
David Crow16-Jun-05 8:08 
GeneralRe: COM Port Pin
Toby Opferman16-Jun-05 18:21
Toby Opferman16-Jun-05 18:21 
GeneralRe: COM Port Pin
A_Fa17-Jun-05 18:47
A_Fa17-Jun-05 18:47 
GeneralRe: COM Port Pin
Toby Opferman18-Jun-05 13:47
Toby Opferman18-Jun-05 13:47 
GeneralRe: COM Port Pin
Anonymous19-Jun-05 21:37
Anonymous19-Jun-05 21:37 
GeneralActiveXScripting Pin
dittygrail16-Jun-05 2:22
dittygrail16-Jun-05 2:22 
GeneralAdding image view capability to control bar Pin
MFCRookie16-Jun-05 2:09
MFCRookie16-Jun-05 2:09 
GeneralContext Sensitive help for Edit Box Pin
topagarwal16-Jun-05 0:46
topagarwal16-Jun-05 0:46 
GeneralRe: Context Sensitive help for Edit Box Pin
samit116-Jun-05 1:24
samit116-Jun-05 1:24 
Questionhow to create a temporary DC using ATL without a Parent Window? Pin
ThinkingPrometheus16-Jun-05 0:43
ThinkingPrometheus16-Jun-05 0:43 
AnswerRe: how to create a temporary DC using ATL without a Parent Window? Pin
Bob Stanneveld16-Jun-05 1:13
Bob Stanneveld16-Jun-05 1:13 
Hello,

Me again! I was searching through MSDN and found the following functions usefull for your problem:
<list>
  • GetDC()[^] for retrieving the DC of the desktop.
  • CreateCompatibleDC()</a>[<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceshellui5/html/wce50lrfCreateCompatibleDC.asp" target="_blank" rel="nofollow" title="New Window">^</a>] for creating a memory DC<br />
    <li> <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_9v3o.asp" rel="nofollow"><code>SelectObject()
    [^] for placing the bitmap in the DC (Note that the bitmap can only be selected in one DC at a time!)
    Using these functions, one can do the following:
    HDC hMemDC = ::CreateCompatibleDC(GetDC(NULL));
    HGDIOBJ hOldObj = ::SelectObject(hMemDC, hbmp);
    COLORREF cf = GetPixel(hMemDC, 0, 0);
    
    // release resources
    ::SelectObject(hMemDC, hOldObj);
    ::DeleteDC(hMemDC);
    
    return cf;


    Hope this helps Big Grin | :-D

    P.S.
    Some of your problems could be: tmpwin has no DC, which results in invalid handle errors, hbmp is already selected in a DC, hbmp is not created correctly,..

    Behind every great black man...
                ... is the police. - Conspiracy brother


    Blog[^]

  • GeneralRe: how to create a temporary DC using ATL without a Parent Window? Pin
    ThinkingPrometheus16-Jun-05 3:04
    ThinkingPrometheus16-Jun-05 3:04 
    GeneralRe: how to create a temporary DC using ATL without a Parent Window? Pin
    Bob Stanneveld16-Jun-05 3:17
    Bob Stanneveld16-Jun-05 3:17 
    Questionconvert Variant to CString? Pin
    ThinkingPrometheus15-Jun-05 23:08
    ThinkingPrometheus15-Jun-05 23:08 

    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.