Need Help! I want to connect HHT through classic ASP page

M

Mansoor

Hi All,

I wrote a wrapper dll 'SmartTransfer.dll' that using rapi APIs
(CeRapiInitEx, CeReadFile, CeWriteFile, CeRapiUninit).I have tested
'SmartTransfer.dll' and connected HHT with VB 6 Application
through wrapper dll and It is working fine but when I called this
wrapper dll on ASP page ,it is not working and not connected with HHT.

Then I logged my code and found that CeRapiInitEx return less than 0
value .Can someone help me on this regards and its is possible that I
used rapi.dll with ASP 3.

code is here :
Public Function RapiConnect() As Boolean
'Initiates a connection and returns true
' if it connected, false if it did not.
' Dim fs As New FileSystemObject
' Dim ts As TextStream
' Set ts = fs.CreateTextFile("C:\newman.txt ", True)
' ts.WriteLine "Start"

Dim pRapiInit As RAPIINIT
Dim dwWaitRet, dwTimeout As Long
Dim hr As Long

On Error GoTo RapiConnect_Err

pRapiInit.cbSize = Len(pRapiInit)
pRapiInit.heRapiInit = 0
pRapiInit.hrRapiInit = 0

hr = E_FAIL
dwWaitRet = 0
dwTimeout = 10 * ONE_SECOND 'However long you want to wait

'Call CeRapiInitEx one time.
hr = CeRapiInitEx(pRapiInit)

If hr < 0 Then 'FAILED
GoTo Failed
End If

' ts.WriteLine "hr is not failed"

'Wait for the RAPI event until timeout.

'Use the WaitForSingleObject function for the worker thread
'Use the WaitForMultipleObjects function if you are also waiting for
other events.

dwWaitRet = WaitForSingleObject(pRapiInit.heRapiInit, dwTimeout)

If dwWaitRet = 0 Then 'WAIT_OBJECT_0
'If the RAPI init is returned, check result
' ts.WriteLine "dwWaitRet SUCCEEDED"
If pRapiInit.hrRapiInit >= 0 Then 'SUCCEEDED
' ts.WriteLine "hrRapiInit SUCCEEDED"
GoTo Succeeded
Else
' ts.WriteLine "hrRapiInit failed"
GoTo Failed

End If
Else
' ts.WriteLine "dwWaitRet failed"

'Timeout or failed.
GoTo Failed

End If

'success
Succeeded:
'Now you can make RAPI calls.
'ts.Close
'Set ts = Nothing
'Set fs = Nothing

RapiConnect = True
Exit Function
Failed:
'Uninitialize RAPI if you ever called CeRapiInitEx.
If hr >= 0 Then 'SUCCEEDED
Call CeRapiUninit
End If

'ts.Close
'Set ts = Nothing
'Set fs = Nothing

RapiConnect = False
Exit Function

RapiConnect_Err:
RapiConnect = False
End Function


Regards,
Mansoor Ali
 
P

Peter Foot [MVP]

So what exact value does CeRapiInitEx return - this will help determine the
cause of the problem.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top