pass file handler to functions in DLL

battouchi
06-09-2003, 10:20 PM
Dear all,

I have written a DLL (ActiveX) to hidden the process from the main program. And I already created a new instance
Dim NTA as new NTA_Lib

However, when I click the button in the form, error happened: "Bad filename or number". Please help. Thanks all.

Codes as below:
<in Main program>
Public Sub BT1_click()
DIM FH1 as integer
FH1 = 1

Open txtInputPath For Input As #FH1
NTA.HProcess(FH1)
End Sub

<in DLL>
Public Sub HProcess(IHandler as Integer)
Do Until (EOF(IHandler))
' code here
Loop
End Sub

OnErr0r
06-09-2003, 11:21 PM
Instead of FH1 = 1 do this:

FH1 = FreeFile

If you happen to create multiple instances of the dll, make sure you keep the filenumbers in sync. A better idea might be to pass the drive:\path\filename.ext string to the dll, and then process the file. That way the filenumber is private to the dll instance.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum