October 23rd, 2003, 07:57 AM
Parameter problems with VC++ dll
I'm working with a dll written in VC++ and I call to some of its functions from VB6.
This dll works with a struct:
One function receives a PrinterInf pointer (PrinterInf*). So what I do is to define a type:
Public Type PrinterInf
Job As Integer
Document As String
PagesPrinted As Integer
TotalPages As Integer
Public Declare Function GetPrinterInf Lib "CDI.dll" (ByVal HandlePrinter As Long, Buffer As Any) As Integer
And then, when I call that function from VB6, I send the first element of an array of 1024 PrinterInf:
ReDim Buffer(1024) As PrinterInf
intRet = GetPrinterInf(lngHandle, Buffer(0))
The fact is that I get an error and VB6 quits. The function in VC++ works well when called from VC++, so I think it must be some problem about how I send the parameters to the dll.
I would appreciate any help regarding this, thank you very much!!!
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!