Home > Software engineering >  Pray god to help and see what is wrong with ~ VB
Pray god to help and see what is wrong with ~ VB

Time:10-03

Option Explicit
Private Declare Function PrintDialog Lib "comdlg32. DLL" Alias "PrintDlgA" _
(pPrintdlg As PRINTDLG_TYPE) As Long

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(hpvDest As Any, _
HpvSource As Any, _
ByVal cbCopy As Long)
Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
Private Declare Function GlobalUnlock Lib "kernel32" _
(ByVal hMem As Long) As Long
Private Declare Function GlobalAlloc Lib "kernel32" _
(ByVal wFlags As Long, _
ByVal dwBytes As Long As Long)
Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long
Scarlet letter said undefined user defined type, could you tell me how can I modify?

CodePudding user response:

public

CodePudding user response:

PPrintdlg As PRINTDLG_TYPE

Undefined PRINTDLG_TYPE type

CodePudding user response:

This type PRINTDLG_TYPE is defined before the API declaration, or in other modules, use the public type

CodePudding user response:

Below it add a type definition:
Private Type PRINTDLG_TYPE
LStructSize As Long
HwndOwner As Long
HDevMode As Long
HDevNames As Long
HDC As Long
Flags As Long
NFromPage As Integer
NToPage As Integer
NMinPage As Integer
NMaxPage As Integer
NCopies As Integer
HInstance As Long
LCustData As Long
LpfnPrintHook As Long
LpfnSetupHook As Long
LpPrintTemplateName As String
LpSetupTemplateName As String
HPrintTemplate As Long
HSetupTemplate As Long
End Type

CodePudding user response:

This error message should be more clear, is the type of undefined.
PRINTDLG_TYPE is a custom types of data
  •  Tags:  
  • API
  • Related