Does Calling Bit Blaster effect deployment?

JohnM

Well-known member
Joined
Jul 2, 2004
Messages
116
Location
Massachusetts
Programming Experience
1-3
In order to print the screen for my users, I put in code calling Bit Blaster from the Library "gdi32.dll" alias "BitBlt". Does this mean that the client's computers would need to have this Library installed on their PC's?

You can tell that I am still new at .Net.

Thanks for your time on this.
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
If the client's computer is Windows, they will need the gdi32.dll library to do just about anything. gdi.dll is a core library for the windows operating system. So if they are using windows, they should already have it. :)
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
if all yer doing is printing the form (as is) this'll also do the trick (no dll's)

VB.NET:
Module FormUtilities

    Private PicForm As PictureBox
    Private blnFirstTimeThrough As Boolean = True
    Friend WithEvents Pd As System.Drawing.Printing.PrintDocument
    '=======================================================================
    ' InitializeFormForPrinting
    '=======================================================================
    ' David Grebner
    '
    ' This procedure instantiates the PrintDocument and the PictureBox
    ' that are requied by the PrintForm and pd_PrintPage procedures.
    '=======================================================================
    Private Sub InitializeFormForPrinting()
        Pd = New System.Drawing.Printing.PrintDocument
        PicForm = New PictureBox
    End Sub
    '=======================================================================
    'PrintForm  - Prints the passed form (2 parameter version)
    '=======================================================================
    ' This code was originally written by Joseph G. Letts.
    '
    ' It was modified by David Grebner to run from a standard module and to 
    ' provide the option of printing the form with or without buttons.
    ' 
    ' This procedure accepts the form as its first parameter which is then 
    ' printed on the default printer. Its second parameter determines 
    ' whether or not the command buttons are removed prior to its printing.
    ' 
    ' This procedure requires the use of the procedure: ButtonMagic and
    ' InitializeFormForPrinting.
    '=======================================================================
    Public Overloads Sub PrintForm(ByVal TheForm As Form, ByVal ButtonVisibility As Boolean)

        If blnFirstTimeThrough Then
            InitializeFormForPrinting()
            blnFirstTimeThrough = False
        End If

        If ButtonVisibility = False Then
            Call ButtonMagic(TheForm, False)
        End If

        'Now, save active form as bmp to the 
        'clipboard by simulating <Alt> <Prt Sc> keystrokes
        SendKeys.SendWait("%{PRTSC}")

        'get clipboard image and put it in a picturebox
        PicForm.Image = DirectCast(System.Windows.Forms.Clipboard.GetDataObject.GetData _
            (System.Windows.Forms.DataFormats.Bitmap), Bitmap)

        Try
            Pd.Print()
        Catch err As Exception
            MessageBox.Show(err.ToString(), "Print Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
        Finally
            Call ButtonMagic(TheForm, True)

        End Try
    End Sub
    '=======================================================================
    'PrintForm  - Prints the passed form (1 parameter version)
    '=======================================================================
    ' This code was originally written by Joseph G. Letts.
    '
    ' It was modified by David Grebner to run from a standard module.
    ' This procedure prints the form that is passed to it on the 
    ' default printer. This procedure is overloaded so that it may 
    ' be called using either signature.
    ' 
    ' This procedure requires the use of the procedures: ButtonMagic and
    ' InitializeFormForPrinting.
    '=======================================================================
    Public Overloads Sub PrintForm(ByVal TheForm As Form)

        If blnFirstTimeThrough Then
            InitializeFormForPrinting()
            blnFirstTimeThrough = False
        End If

        Call ButtonMagic(TheForm, True)

        'Now, save active form as bmp to the 
        'clipboard by simulating <Alt> <Prt Sc> keystrokes
        SendKeys.SendWait("%{PRTSC}")

        'get clipboard image and put it in a picturebox
        PicForm.Image = DirectCast(System.Windows.Forms.Clipboard.GetDataObject.GetData _
            (System.Windows.Forms.DataFormats.Bitmap), Bitmap)

        Try
            Pd.Print()
        Catch err As Exception
            MessageBox.Show(err.ToString(), "Print Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
        Finally
            Call ButtonMagic(TheForm, True)

        End Try
    End Sub
    '=======================================================================
    ' ButtonMagic - Makes buttons invisible or visible 
    '=======================================================================
    ' Dave Grebner   
    ' This procedure takes two arguments. The first is the form and the 
    ' second is the desired visibility of the command buttons (True to make 
    ' them visible and send False to make them invisible).
    '=======================================================================
    Private Sub ButtonMagic(ByVal TheContainer As Control, ByVal ButtonVisibility As Boolean)

        Dim c As Control

        ' Look at each of the controls in the form or in the current container
        For Each c In TheContainer.Controls

            ' If the control is itself a container then call the ButtonMagic
            ' and give it the new container to iterate
            If Not c.Controls Is Nothing Then
                ButtonMagic(c, ButtonVisibility)
            End If

            'If the control is a command button, check the desired visibility
            'and change all buttons to that setting
            If TypeOf c Is Button Then
                If ButtonVisibility = True Then
                    c.Visible = True
                Else
                    c.Visible = False
                End If
            End If

        Next
    End Sub
    '=======================================================================
    ' Joseph G. Letts - Prints a  Picturebox on the default printer.
    ' 
    '=======================================================================
    Private Sub pd_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles Pd.PrintPage
        '---------------------------------------------------------------
        ' this procedure handles events raised by the printer object pd
        '---------------------------------------------------------------
        e.Graphics.DrawImageUnscaled(PicForm.Image, 0, 0) 'send image to printer - upper left position

        e.HasMorePages = False  'this is the last page to print

    End Sub
    '=======================================================================
End Module
just call printform(frmMain) or whatever form ya want
 

JohnM

Well-known member
Joined
Jul 2, 2004
Messages
116
Location
Massachusetts
Programming Experience
1-3
JuggaloBrotha,

Thanks alot for your time on this. I will try this out too. I have several versions of the application I'm creating.

Thank you very much

John
 
Top Bottom