I have the following function:
the olDmAllocBuffer function is defined as:
An error of System.NullReference Exception or "Object reference not set to an instance of an object" is being thrown at the line
All of this code is contained in a module. I dont see any objects here other than longs and integers. This code works in VB6. What am I doing wrong?
Code:
Function AllocBuffer(ByVal WinFlags As Integer, ByVal buffersize As Long) As Long
Dim hbuf As Long
Dim ecode As Long
ecode = olDmAllocBuffer(WinFlags, buffersize, hbuf)
If ecode <> OLNOERROR Then
OLMEMTrap("AllocBuffer", ecode)
Else
AllocBuffer = hbuf
End If
End Function
the olDmAllocBuffer function is defined as:
Code:
Declare Function olDmAllocBuffer& Lib "OLMEM32.DLL" (ByVal usWinFlags%, ByVal ulBufferSize&, ByVal hBuffer&)
An error of System.NullReference Exception or "Object reference not set to an instance of an object" is being thrown at the line
Code:
ecode = olDmAllocBuffer(WinFlags, buffersize, hbuf)
All of this code is contained in a module. I dont see any objects here other than longs and integers. This code works in VB6. What am I doing wrong?