опубликован 13-06-2001 09:50 MSK
Люди обрые, помогите разобраться с WinAPI
Объявляю FORM_INFO_1 и его компоненты SIZEL и RECTLОбъявляю API-функцию EnumForms:
Private Declare Function EnumForms Lib "winspool.drv" Alias "EnumFormsA" _
(ByVal hPrinter As Long, _ 'handler of Printer object
ByVal Level As Long, _ 'всегда=1
pForm As Byte, _ 'points to buffer that receives
'form info. structure array
ByVal cbBuf As Long, _ 'count of bytes in buffer
pcbNeeded As Long, _ 'points to variable to receive count
'of bytes copied or required
pcReturned As Long) As Long 'points to variable to receive
'count of structures copied
Затем получаю handler объекта "принтер" (в printerHandle) и пишу следующее:
Dim MyForm As FORM_INFO_1
Dim MyFormInfo(Len(MyForm)) As Byte
Dim NumReturned As Long
Dim RetLongNeed As Long
RetVal = EnumForms(printerHandle, 1, MyFormInfo(Len(MyForm)), Len(MyForm), RetLongNeed, NumReturned)
Len(MyForm) возвращает 28
RetVal, RetLongNeed и NumReturned возвращают нули.
Где ошибки?