VB5/EE SP2 creates junk on printer

VB5/EE SP2 creates junk on printer

Post by Philipp Ot » Tue, 16 Sep 1997 04:00:00


Ever since I installed SP2 for VB5/EE I cannot printer a form any longer
properly. The form was printed under VB 4.0a/EE and VB 5.0/EE with the
following routine:


Public Sub PrintWithOffset(ByVal yOffset As Integer)

Dim element   As Control
Dim message   As String
Dim x1        As Integer
Dim y1        As Integer
Dim x2        As Integer
Dim y2        As Integer
Dim xPart     As Integer
Dim yPart     As Integer
Dim savedDC   As Long
Dim hFont     As Long
Dim total     As Integer
Dim num       As Integer
Dim gResult   As Long
Dim prevFont  As Long

  For Each element In Me.Controls
    Select Case TypeName(element)

      Case "Line":

      Case "Label":

      Case "CTLabel":
        x1 = element.Left / Printer.TwipsPerPixelX - 1
        y1 = (element.Top + element.Height + yOffset) /
Printer.TwipsPerPixelY - 1
        message = element.Caption
        savedDC = SaveDC(Printer.hDC)     ''' Save DC
        hFont = CreateFont(5.25 * 5, 5.25 * 2, 900, 0, 400, False, False,
False, 1, 8, 0, 2, 32, "Arial") ''' Create counterclockwise rotated Font
        prevFont = SelectObject(Printer.hDC, hFont) ''' get previous font
        gResult = SetBkMode(Printer.hDC, TRANSPARENT) ''' set background
        gResult = SetTextColor(Printer.hDC, element.ForeColor)  ''' Set
forecolor (black)
        gResult = TextOut(Printer.hDC, x1, y1, message, Len(message))   '''
print rotated text
        gResult = SelectObject(Printer.hDC, prevFont)   ''' restore prev.
        gResult = RestoreDC(Printer.hDC, savedDC) ''' restore DC
        gResult = DeleteObject(hFont) ''' free font resource

      Case "CommandButton":
        ' natrlich NICHT ausdrucken!

      Case Else:
        MsgBox "UNKNOWN CONTROL WITH TYPE " & TypeName(element)

    End Select
  Next element

End Sub

This little piece of code iterates through a forms element collection and
draws them. Unfortunately, since SP2 the part with the WIN32 API graphics
call doesn't work any more. It should print the contents of the CTLabel
caption vertically, but instead now it prints it horizontal. Almost, as if
VB5/SP2 restores the DC between each single line and resets the font
attributes - or something similiar stupid.

Does anybody else print vertical text with VB5/EE/SP2 - not using the
printform method? If so, please let me know how.

With kind Regards,
Philipp Ott

BTW: I'm using NT 4.0 german / service pack #3 installed.


1. creating .avi files for VB5

Because of the rather unusual crossposting, I'll explain in some detail.

I am writing an application in Visual Basic 5.  As part of the application, I
want some simple animation.  I have used POV-Ray, a freeware ray-tracing
program, to generate a series of still pictures in .tga format.

I then proceeded to use VFD, a video cross-compiler, to make an .avi file from
the still frames.  The .avi file, when double-clicked from the Win95 desktop,
plays a neat little movie of my animation.  Hoo-rah!

Now, I want to do this from within my application.  Visual Basic provides an
Animation Control that will play .avi files.  According to the manual, the
avi file must have no sound and must not be compressed or be compressed with
RLE compression.

When I try to load my .avi file into the Animation Control, I get an error
that means the file either includes sound data or is in a format not supported
by the control.  (Not a terribly helpful message, I'm afraid.)

Can anyone help me make an .avi file from a series of .tga (Targa-format)
graphics files that will run in the animation control?  Am I not using the
correct flags in VFD, for you raytracers, or is there something I'm doing
wrong on the VB side, for you programmers?

Thanks for any help.  Please be aware of the crossposting in your reply.


2. FS: LOADED R3K Indigo Elan

3. Create Win32API Exported Functions w/ VB5!

4. Book recommendation for PSP 6

5. Creating bitmap in vb5 and put your own pixeldata inside

6. bad perfomance...

7. Creating DIBs using VB5?

8. The Decline and Fall of Comp.graphics[.algorithms]

9. SP2 support?

10. Driver for a Genius SP2 scanner

11. Help:Softimage SP2, Flexlm and manual install on Origin 200

12. PS7-why SP2 for W2K?