FYI, For those who visit my thread,VBAccelerator also has comprehensive CommonDialog Class at : http://www.vbaccelerator.com/home/VB...ull_Source.asp
The addressing for retrieve Printer name is something like C# PrinterDialog class (Reflector shown):
m_sDevice = getDevNameString(ptrDevNames, tDevNames.wDeviceOffset)Code:Private Function getDevNameString( _ ByVal ptrDevNames As Long, _ ByVal ptrOffset As Long _ ) Dim ptr As Long Dim lSize As Long Dim b() As Byte ptr = UnsignedAdd(ptrDevNames, ptrOffset) lSize = lstrlenPtr(ptr) If (lSize > 0) Then ReDim b(0 To lSize - 1) As Byte CopyMemory b(0), ByVal ptr, lSize getDevNameString = StrConv(b, vbUnicode) End If End Function Private Function UnsignedAdd(Start As Long, Incr As Long) As Long ' This function is useful when doing pointer arithmetic, ' but note it only works for positive values of Incr If Start And &H80000000 Then 'Start < 0 UnsignedAdd = Start + Incr ElseIf (Start Or &H80000000) < -Incr Then UnsignedAdd = Start + Incr Else UnsignedAdd = (Start + &H80000000) + (Incr + &H80000000) End If End Function




Reply With Quote