C
chenfeng
I use code in http://www.lebans.com/msword.htm to extract embedded OLE
objects, It do work. But there a small problem for the following code:
----------------------------------------------------------------------------
--
Public Function CreateDIB( _
ByVal lhdc As Long, _
ByVal lWidth As Long, _
ByVal lHeight As Long, _
ByRef hDib As Long, _
Optional ByVal PelsX As Long = 0, Optional ByVal PelsY As Long = 0 _
) As Boolean
With m_bmi.bmiHeader
.biSize = Len(m_bmi.bmiHeader)
.biWidth = lWidth
.biHeight = lHeight
.biPlanes = 1
' Always use 24bits for this clas
.biBitCount = 24
.biCompression = BI_RGB
.biSizeImage = BytesPerScanLine * .biHeight
.biXPelsPerMeter = PelsX
.biYPelsPerMeter = PelsY
End With
'' Create our DibSection. Pointer to bitmap data is in m_lPtr
hDib = CreateDIBSection(lhdc, m_bmi, DIB_RGB_COLORS, m_lPtr, 0, 0)
CreateDIB = (hDib <> 0)
End Function
----------------------------------------------------------------------------
----
Because the background of OLE object is transparent and the background of
DIB Created is black, if using code"lngRet = apiPlayEnhMetaFile(m_hDC,
m_hEMF, rc)" to copy picture of OLE object to the DIB, all black information
of OLE object is erased.So when creating a DIB, we need to set default color
of the created DIB to white color. I see through the code, but I am sorry
for not knowing how to modify the code. Can someone help me? Thanks very
much!
objects, It do work. But there a small problem for the following code:
----------------------------------------------------------------------------
--
Public Function CreateDIB( _
ByVal lhdc As Long, _
ByVal lWidth As Long, _
ByVal lHeight As Long, _
ByRef hDib As Long, _
Optional ByVal PelsX As Long = 0, Optional ByVal PelsY As Long = 0 _
) As Boolean
With m_bmi.bmiHeader
.biSize = Len(m_bmi.bmiHeader)
.biWidth = lWidth
.biHeight = lHeight
.biPlanes = 1
' Always use 24bits for this clas
.biBitCount = 24
.biCompression = BI_RGB
.biSizeImage = BytesPerScanLine * .biHeight
.biXPelsPerMeter = PelsX
.biYPelsPerMeter = PelsY
End With
'' Create our DibSection. Pointer to bitmap data is in m_lPtr
hDib = CreateDIBSection(lhdc, m_bmi, DIB_RGB_COLORS, m_lPtr, 0, 0)
CreateDIB = (hDib <> 0)
End Function
----------------------------------------------------------------------------
----
Because the background of OLE object is transparent and the background of
DIB Created is black, if using code"lngRet = apiPlayEnhMetaFile(m_hDC,
m_hEMF, rc)" to copy picture of OLE object to the DIB, all black information
of OLE object is erased.So when creating a DIB, we need to set default color
of the created DIB to white color. I see through the code, but I am sorry
for not knowing how to modify the code. Can someone help me? Thanks very
much!