' declare external routines

Private Declare Function CCLoadTable Lib "CC32.DLL" (ByVal FNtable$, ByVal phTable As String, ByVal hInstance As Long) As Long
Private Declare Function CCUnloadTable Lib "CC32.DLL" (ByVal hTable As Long) As Long
Private Declare Function CCProcessFile Lib "CC32.DLL" (ByVal hTable As Long, ByVal FNinput$, ByVal FNoutput$, ByVal bAppend As Long) As Long

Private Declare Function GetActiveWindow Lib "User32" () As Long
Private Declare Function GetWindowLongA Lib "User32" (ByVal hWnd As Long, ByVal offset As Long) As Long


Private Sub ConsistantChange(sInputFile$, sCCTable$, sOutputFile$)
Dim hWnd
Dim hInstance
Dim x$
Dim iRtn
Dim Multiplier
Dim hTable
Dim nBytes
Dim i
    hWnd = GetActiveWindow
    hInstance = GetWindowLongA(hWnd, -6)

    x$ = "    "     '4-byte string used to mimic ptr to HANDLE var

    iRtn = CCLoadTable(sCCTable$, x$, hInstance)

    If (iRtn = 0) Then

        ' Convert the string to a handle
        Multiplier = 1

        hTable = 0

        nBytes = Len(x$)

        If nBytes > 4 Then nBytes = 4

        For i = 1 To nBytes
            hTable = hTable + Asc(Mid(x$, i, 1)) * Multiplier
            Multiplier = Multiplier * 256
        Next i

        CCProcessFile hTable, sInputFile$, sOutputFile$, 0

        CCUnloadTable (hTable)
    End If
End Sub


Private Sub TestCC()
'
' TestCC Macro
' Macro created 09/01/97 by Doug Rintoul
'
Call ConsistantChange("e:\temp\x.in", "e:\temp\x.cc", "e:\temp\x.out")
End Sub