Click here to Skip to main content
15,912,578 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Windows crash time Pin
Yaakov Davis29-Dec-04 6:31
Yaakov Davis29-Dec-04 6:31 
GeneralRe: Windows crash time Pin
WoutL29-Dec-04 10:34
WoutL29-Dec-04 10:34 
GeneralVS 2003 hangs when adding class Pin
greekgoddj29-Dec-04 2:01
greekgoddj29-Dec-04 2:01 
GeneralRe: VS 2003 hangs when adding class Pin
Gary R. Wheeler29-Dec-04 2:15
Gary R. Wheeler29-Dec-04 2:15 
GeneralRe: VS 2003 hangs when adding class Pin
greekgoddj29-Dec-04 2:31
greekgoddj29-Dec-04 2:31 
GeneralRe: VS 2003 hangs when adding class Pin
greekgoddj10-Jan-05 21:21
greekgoddj10-Jan-05 21:21 
GeneralN-Ary Tree (almost) Pin
DiamondGeezer29-Dec-04 1:47
DiamondGeezer29-Dec-04 1:47 
GeneralProblem when retrieving Clipboard data in the Enhanced Metadata format. Pin
SivaramanDhamodharan28-Dec-04 23:31
SivaramanDhamodharan28-Dec-04 23:31 
Problem when retrieving Clipboard data in the Enhanced Metadata format.
// 1. This one Draws Some Sample Line in the Edit box.

Code:

CDC * h_meta_dc = m_ctrl_edit_metadata.GetDC() ;
h_meta_dc->MoveTo(1,1);
h_meta_dc->LineTo(1,10);
h_meta_dc->LineTo(100,10);





// 2. Trying to copy the data in metadata format. Also this code saves the drawing content into the clipboard in metadata format(Enhanced).
// Copies the content that is visible in the text box.

Code:

OpenClipboard();
EmptyClipboard();
CMetaFileDC * pMDC = new CMetaFileDC();
RECT client_rct;
::GetClientRect(m_ctrl_edit_metadata.m_hWnd, & client_rct );
pMDC->CreateEnhanced( m_ctrl_edit_metadata.GetDC() , NULL , &client_rct , "Meta_Data");
pMDC->MoveTo(1,1);
pMDC->LineTo(1,10);
pMDC->LineTo(100,10);
HENHMETAFILE handle = pMDC->CloseEnhanced();
SetClipboardData(CF_ENHMETAFILE,handle);
CloseClipboard();
delete pMDC;



// 3. Erases the content drawn.
Code:

RECT client_rct;
HBRUSH h_brsh = ::CreateSolidBrush(RGB(255,255,255));
::GetClientRect(m_ctrl_edit_metadata.m_hWnd, & client_rct );
::FillRect(::GetDC(m_ctrl_edit_metadata.m_hWnd), &client_rct, h_brsh );



// 4. Drawing content retrieved from the Clipboard and Displayed
Code:

if ( OpenClipboard() )
{
HENHMETAFILE handle = (HENHMETAFILE)GetClipboardData(CF_ENHMETAFILE);
RECT client_rct;
::GetClientRect(m_ctrl_edit_metadata.m_hWnd, & client_rct );
CDC * dc = m_ctrl_edit_metadata.GetDC() ;
::PlayEnhMetaFile(::GetDC(m_ctrl_edit_metadata.m_hWnd), handle, &client_rct);
CloseClipboard();
}



m_ctrl_edit_metadata - This is a CEdit control Variable involved in this case.
I have assigned each piece of this code in different Button event handler. When I try to retrieve the content, I am getting the magnified effect of the drawing content . Can anybody test and tell me the Reason.

The order in which I had executed the event are => Code Snippet 1, Code Snippet 2, Code Snippet 3, Code Snippet 4

Thanks in Advance
GeneralAlignment problem in ListBox Pin
Rajesh_K_Sharma28-Dec-04 23:27
Rajesh_K_Sharma28-Dec-04 23:27 
GeneralRe: Alignment problem in ListBox Pin
Gary R. Wheeler29-Dec-04 0:37
Gary R. Wheeler29-Dec-04 0:37 
GeneralRe: Alignment problem in ListBox Pin
David Crow29-Dec-04 2:27
David Crow29-Dec-04 2:27 
GeneralRe: Alignment problem in ListBox Pin
David Crow29-Dec-04 2:29
David Crow29-Dec-04 2:29 
Questionhow can i send midi data to the usb??? Pin
namaskaaram28-Dec-04 23:25
namaskaaram28-Dec-04 23:25 
Questionhow to get Pin
vc-programmer-28-Dec-04 22:58
vc-programmer-28-Dec-04 22:58 
AnswerRe: how to get Pin
David Crow29-Dec-04 2:32
David Crow29-Dec-04 2:32 
GeneralRe: how to get Pin
vc-programmer-30-Dec-04 16:35
vc-programmer-30-Dec-04 16:35 
GeneralRe: how to get Pin
David Crow3-Jan-05 1:56
David Crow3-Jan-05 1:56 
GeneralError 2660 Pin
Mithilaa28-Dec-04 20:01
Mithilaa28-Dec-04 20:01 
GeneralRe: Error 2660 Pin
PJ Arends28-Dec-04 20:55
professionalPJ Arends28-Dec-04 20:55 
GeneralBeep sound of the application. Pin
Neelesh K J Jain28-Dec-04 19:54
Neelesh K J Jain28-Dec-04 19:54 
GeneralRe: Beep sound of the application. Pin
David Crow29-Dec-04 2:41
David Crow29-Dec-04 2:41 
GeneralWhere is the problem ? please help... Pin
pc_dev28-Dec-04 19:07
pc_dev28-Dec-04 19:07 
GeneralRe: Where is the problem ? please help... Pin
Aamir Butt28-Dec-04 19:37
Aamir Butt28-Dec-04 19:37 
GeneralRe: Where is the problem ? please help... Pin
pc_dev28-Dec-04 21:33
pc_dev28-Dec-04 21:33 
GeneralRe: Where is the problem ? please help... Pin
Aamir Butt28-Dec-04 22:24
Aamir Butt28-Dec-04 22:24 

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.