-
October 23rd, 2003, 07:57 AM
#1
Parameter problems with VC++ dll
Hi again.
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:
PrinterInf{
DWORD Job;
char* Document;
DWORD PagesPrinted;
DWORD TotalPages;
};
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
End Type
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!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|