hDocCleanRgn example for Visual Basic
Dim nRet As Integer
'HolePunch Remove
'This example updates a windows region with all removed hole punches
'For the example, a windows region is updated and then converted to a LEAD region
'but in practice it would easier and faster to just update a LEAD region
'The HOLEPUNCH_USE_DPI flag instructs the C DLL to determine the size of the hole punches
'based on the image DPI
'The image is modified
'The HolePunch Event is used to display information about each hole punch removed
nRet = LEAD1.HolePunchRemove(HOLEPUNCH_SINGLE_REGION Or HOLEPUNCH_USE_DPI Or HOLEPUNCH_USE_COUNT Or HOLEPUNCH_USE_LOCATION, _
2, 4, 0, 0, 0, 0, HOLEPUNCH_LEFT)
If (nRet = 0) Then
LEAD1.FreeRgn
LEAD1.SetRgnHandle LEAD1.hDocCleanRgn, 0, 0, L_RGN_SET
LEAD1.hDocCleanRgn = 0 'no longer need rgn
LEAD1.RgnFrameType = RGNFRAME_COLOR
End If
Private Sub LEAD1_HolePunchRemove(ByVal hRgn As Stdole.OLE_HANDLE, ByVal fBoundingRectLeft As Single, ByVal fBoundingRectTop As Single, ByVal fBoundingRectWidth As Single, ByVal fBoundingRectHeight As Single, ByVal iHoleIndex As Long, ByVal iHoleTotalCount As Long, ByVal iWhiteCount As Long, ByVal iBlackCount As Long)
Debug.Print "HolePunch at " & CStr(fBoundingRectLeft) & "," & CStr(fBoundingRectTop) _
& "," & CStr(fBoundingRectWidth) & "," & CStr(fBoundingRectHeight) _
& " HoleIndex=" & CStr(iHoleIndex) & " TotalCount=" & CStr(iHoleTotalCount) _
& " WhiteCount=" & CStr(iWhiteCount) & " BlackCount=" & CStr(iBlackCount)
End Sub