How to Convert HDC to CDC?
-
Hi guyz, Is it possible to convert HDC to CDC? When I pass CDC to other class I use its HDC, CDC->m_hDC this is to perform the process in there. Rather, I need a way to convert HDC to CDC and make some drawing over it. Now I'm encountering a problem integrating a CDC with the returned HDC. I needed the HDC as my background and the CDC for the drawing like lines. If you have an idea please let me know. Thank you
-
Hi guyz, Is it possible to convert HDC to CDC? When I pass CDC to other class I use its HDC, CDC->m_hDC this is to perform the process in there. Rather, I need a way to convert HDC to CDC and make some drawing over it. Now I'm encountering a problem integrating a CDC with the returned HDC. I needed the HDC as my background and the CDC for the drawing like lines. If you have an idea please let me know. Thank you
Hi man. I know how to convert it is. show below if your handle is m_hDC, CDC* pCDC = CDC::FromHandle(m_hDC); Ok. You can get the CDC* from m_hDC
-
Hi man. I know how to convert it is. show below if your handle is m_hDC, CDC* pCDC = CDC::FromHandle(m_hDC); Ok. You can get the CDC* from m_hDC
That will only work if the
HDC
is already wrapped by aCDC
. To wrap aHDC
in aCDC
use theCDC::Attach
method.Steve
-
Hi guyz, Is it possible to convert HDC to CDC? When I pass CDC to other class I use its HDC, CDC->m_hDC this is to perform the process in there. Rather, I need a way to convert HDC to CDC and make some drawing over it. Now I'm encountering a problem integrating a CDC with the returned HDC. I needed the HDC as my background and the CDC for the drawing like lines. If you have an idea please let me know. Thank you
To wrap a
HDC
in aCDC
use theCDC::Attach
method. If theHDC
is already wrapped by aCDC
use theCDC::FromHandle
method, as mentioned by the first replier.Steve
-
Hi guyz, Is it possible to convert HDC to CDC? When I pass CDC to other class I use its HDC, CDC->m_hDC this is to perform the process in there. Rather, I need a way to convert HDC to CDC and make some drawing over it. Now I'm encountering a problem integrating a CDC with the returned HDC. I needed the HDC as my background and the CDC for the drawing like lines. If you have an idea please let me know. Thank you
Thank you very much for your replies. I will try this now.
-
To wrap a
HDC
in aCDC
use theCDC::Attach
method. If theHDC
is already wrapped by aCDC
use theCDC::FromHandle
method, as mentioned by the first replier.Steve
-
Thank you very much for your replies. I will try this now.
CDC construtor is of any help??
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/codeProject$$>
-
Hi guyz, Is it possible to convert HDC to CDC? When I pass CDC to other class I use its HDC, CDC->m_hDC this is to perform the process in there. Rather, I need a way to convert HDC to CDC and make some drawing over it. Now I'm encountering a problem integrating a CDC with the returned HDC. I needed the HDC as my background and the CDC for the drawing like lines. If you have an idea please let me know. Thank you
-
That will only work if the
HDC
is already wrapped by aCDC
. To wrap aHDC
in aCDC
use theCDC::Attach
method.Steve
May be i understood wrongly, CDC::FromHandle() "If a CDC object is not attached to the handle, a temporary CDC object is created and attached." from msdn.