Click here to Skip to main content
15,897,273 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
    AnswerRe: convert Variant to CString? Pin
    Graham Bradshaw15-Jun-05 23:18
    Graham Bradshaw15-Jun-05 23:18 
    AnswerRe: convert Variant to CString? Pin
    Nilesh K.15-Jun-05 23:21
    Nilesh K.15-Jun-05 23:21 
    GeneralRe: convert Variant to CString? Pin
    ThinkingPrometheus15-Jun-05 23:51
    ThinkingPrometheus15-Jun-05 23:51 
    AnswerRe: convert Variant to CString? Pin
    Anonymous16-Jun-05 0:09
    Anonymous16-Jun-05 0:09 
    AnswerRe: convert Variant to CString? Pin
    James R. Twine16-Jun-05 8:34
    James R. Twine16-Jun-05 8:34 
    GeneralSent data from Doc to dialog Pin
    mafuza15-Jun-05 22:58
    mafuza15-Jun-05 22:58 
    GeneralRe: Sent data from Doc to dialog Pin
    Nilesh K.15-Jun-05 23:17
    Nilesh K.15-Jun-05 23:17 
    GeneralRe: Sent data from Doc to dialog Pin
    mafuza21-Jun-05 17:21
    mafuza21-Jun-05 17:21 
    GeneralRe: Sent data from Doc to dialog Pin
    Nilesh K.21-Jun-05 17:50
    Nilesh K.21-Jun-05 17:50 
    GeneralPicture on dialog based application Pin
    Rostfrei15-Jun-05 22:48
    Rostfrei15-Jun-05 22:48 
    GeneralRe: Picture on dialog based application Pin
    Nilesh K.15-Jun-05 23:06
    Nilesh K.15-Jun-05 23:06 
    GeneralRe: Picture on dialog based application Pin
    Rostfrei15-Jun-05 23:32
    Rostfrei15-Jun-05 23:32 
    GeneralRe: Picture on dialog based application Pin
    toxcct16-Jun-05 0:14
    toxcct16-Jun-05 0:14 
    GeneralRe: Picture on dialog based application Pin
    Nilesh K.16-Jun-05 0:45
    Nilesh K.16-Jun-05 0: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.