home *** CD-ROM | disk | FTP | other *** search
- 'HUGE.BAS version .01 ⌐1992 Marquis Computing. All rights are reserved.
- DefInt A-Z
- Declare Function GlobalSize Lib "Kernel" (ByVal hmem As Integer) As Long
- Declare Function GlobalAlloc Lib "Kernel" (ByVal wFlags As Integer, ByVal dwbytes As Long) As Integer
- Declare Function GlobalFree Lib "Kernel" (ByVal hmem As Integer) As Integer
- Declare Function GlobalLock Lib "Kernel" (ByVal hmem As Integer) As Long
- Declare Function GlobalUnlock Lib "Kernel" (ByVal hmem As Integer) As Integer
- Declare Function lstrcpy Lib "Kernel" (ByVal lpString1 As Any, ByVal lpString2 As Any) As Long
- Declare Sub hmemcpy Lib "kernel" (ByVal lpdest&, ByVal lpsource&, ByVal dwbytes&)
- Declare Function GetVersion Lib "Kernel" () As Integer
- Dim ha&(0 To 10, 0 To 4)
-
-
- Sub GetREC ()
- On Error GoTo GetRECE
- If handle < 1 Or handle > 15 Then Error 104
- recsize = 100
- headsize = 0
- Get handle, (headsize + (recsize * record)) - recsize + 1, recdata
- status = 0
- GetRECExit:
- On Error GoTo 0
- Exit Sub
- GetRECE:
- status = Err
- Resume GetRECExit
- End Sub
-
- Sub HugeDIM (handle%, status%, recordsize%, elements%)
- On Error GoTo HugeDIME
- If ha(0, 0) + 1 > UBound(ha, 1) Then Error 171 Else handle = ha(0, 0) + 1
- If GetVersion() \ 256 < 10 Then Error 174
- dwbytes& = CLng(recordsize) * elements
- hmem = GlobalAlloc(64, dwbytes&)
- If GlobalSize(hmem) < dwbytes& Then Error 170 Else hmemptr& = GlobalLock(hmem)
- ha(0, 0) = handle
- ha(handle, 1) = hmem
- ha(handle, 2) = hmemptr&
- ha(handle, 3) = recordsize
- ha(handle, 4) = elements
- status = 0
- HugeDIMExit:
- On Error GoTo 0
- Exit Sub
- HugeDIME:
- status = Err
- Resume HugeDIMExit
- End Sub
-
- Function HugeERR (status%) As String
- Select Case status%
- Case 170: msg$ = "Not enough memory to create HUGE array"
- Case 171: msg$ = "No more HUGE handles available"
- Case 172: msg$ = "Invalid HUGE element requested"
- Case 173: msg$ = "HUGE handle invalid"
- Case 174: msg$ = "Windows version 3.10 or higher required"
- End Select
- HugeERR = "Error" + Str$(status) + Chr$(10) + Chr$(10) + msg$
- End Function
-
- Sub HugeGET (handle%, status%, element%, recdata$)
- On Error GoTo HugeGETE
- If handle < 1 Or handle > UBound(ha, 1) Then Error 173
- If element < 1 Or element > ha(handle, 4) Then Error 172
- recdata$ = Space$(ha(handle, 3))
- hmemcpy lstrcpy(ByVal recdata$, ByVal recdata$), ha(handle, 2) + (CLng(element - 1) * ha(handle, 3)), Len(recdata$)
- status = 0
- HugeGETExit:
- On Error GoTo 0
- Exit Sub
- HugeGETE:
- status = Err
- Resume HugeGETExit
- End Sub
-
- Sub HugePUT (handle%, status%, element%, recdata$)
- On Error GoTo HugePUTE
- If handle < 1 Or handle > UBound(ha, 1) Then Error 173
- If element < 1 Or element > ha(handle, 4) Then Error 172
- hmemcpy ha(handle, 2) + (CLng(element - 1) * ha(handle, 3)), lstrcpy(ByVal recdata$, ByVal recdata$), Len(recdata$)
- status = 0
- HugePUTExit:
- On Error GoTo 0
- Exit Sub
- HugePUTE:
- status = Err
- Resume HugePUTExit
- End Sub
-
- Sub HugeZAP (handle%, status%)
- On Error GoTo HugeZAPE
- If handle < 1 Or handle > UBound(ha, 1) Then Error 173
- status = GlobalUnlock(ha(handle, 1)) Or GlobalFree(ha(handle, 1))
- ha(0, 0) = ha(0, 0) - 1
- ha(handle, 1) = 0
- ha(handle, 2) = 0
- ha(handle, 3) = 0
- ha(handle, 4) = 0
- HugeZAPExit:
- On Error GoTo 0
- handle = 0
- Exit Sub
- HugeZAPE:
- status = Err
- Resume HugeZAPExit
- End Sub
-
- Sub PutREC (handle%, status%, record, recdata$)
- On Error GoTo PutRECE
- If handle < 1 Or handle > 15 Then Error 104
- recsize = 100
- headsize = 0
- Put handle, (headsize + (recsize * record)) - recsize + 1, recdata
- status = 0
- PutRECExit:
- On Error GoTo 0
- Exit Sub
- PutRECE:
- status = Err
- Resume PutRECExit
- End Sub
-
-