Full Version: Creating Metafile

From: Victor [#1]
 3 Apr 2008
To: ALL

,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5K,
I am tryi5

Reply


From: xeffort [#2]
 3 Apr 2008
To: Victor [#1] 4 Apr 2008

In my opinion, GetDeviceCaps could fail only if hDCRef refers to an invalid DC. That begs the question: was m_xTestDC initialized, i.e. where did m_xTestDC%hDC obtain the value? Or is there just some random garbage and/or invalid handle therein?

Try:

code:
m_xTestDC = XMemoryDC(1, 1)
...
IF(XCreateMetaFile (m_xTestDC, sFileName, xDCmf, iWidth, iHeight)) THEN
...
END IF
...
ret = XDeleteDC(m_xTestDC)


Maybe the xDCref argument should have been optional, defaulting to screen DC, thus saving the user some effort. Mike?

Reply


From: geezer (MG) [#3]
 3 Apr 2008
To: ALL

Try initializing the reference DC with
m_XTestDC = XCreateDC ()

This will use the DC of the default printer which is what one almost always wants when using metafiles.

Reply


From: Victor [#4]
 4 Apr 2008
To: ALL

Thanks a lot.
This is a modification of the original Jugoslav's XZoom sample.
m_xTestDC is defined in View module and its value is assigned in
xView_OnPaint function:
m_xTestDC = xDC.
With Mike's suggestion XCreateMetafile fills RECT structure with correct values (default printer DC), but call to CreateEnhMetaFile fails.
Only direct call of CreateEnhMetaFile solves the problem.
Strange that XCreateMetafile does not work.
Victor.

Reply


From: geezer (MG) [#5]
 4 Apr 2008
To: Victor [#4] unread

Strange indeed. I'd like to learn more. Would it be possible for you to send source that does and does not work to me at comm_gaitens@bellsouth.net

Reply


From: geezer (MG) [#6]
 6 Apr 2008
To: ALL

Thanks to Victor's sample, the bug in XCreateMetaFile has been found. A corrected XCreateMetaFile will likely be in the next Xeffort release (Release 24).

Reply


From: xeffort [#7]
 9 Apr 2008
To: Victor [#1] unread

The bug is supposedly fixed in the new release, 1.2.24.

Reply


Reply to All

Back to thread list | Login

© 2010 Project BeehiveForum