Click here to Skip to main content
15,890,438 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Shutdown Without CMD or Run As Pin
Dave Kreskowiak28-Oct-08 17:31
mveDave Kreskowiak28-Oct-08 17:31 
Questionlisting ports with prnport.vbs and using that info in VB?? Pin
Trey549828-Oct-08 9:16
Trey549828-Oct-08 9:16 
AnswerRe: listing ports with prnport.vbs and using that info in VB?? Pin
Dave Kreskowiak28-Oct-08 10:00
mveDave Kreskowiak28-Oct-08 10:00 
GeneralRe: listing ports with prnport.vbs and using that info in VB?? Pin
Trey549828-Oct-08 11:02
Trey549828-Oct-08 11:02 
GeneralRe: listing ports with prnport.vbs and using that info in VB?? Pin
Dave Kreskowiak28-Oct-08 13:55
mveDave Kreskowiak28-Oct-08 13:55 
GeneralRe: listing ports with prnport.vbs and using that info in VB?? Pin
Trey549829-Oct-08 2:03
Trey549829-Oct-08 2:03 
GeneralRe: listing ports with prnport.vbs and using that info in VB?? Pin
Dave Kreskowiak29-Oct-08 2:13
mveDave Kreskowiak29-Oct-08 2:13 
GeneralRe: listing ports with prnport.vbs and using that info in VB?? Pin
Trey549829-Oct-08 2:38
Trey549829-Oct-08 2:38 
Imports Microsoft.Win32

Public Class prnProcessing
    Dim x As New System.Diagnostics.Process
    Public arrInstalled As New ArrayList()
    Dim WithEvents ToDoWork As New System.ComponentModel.BackgroundWorker


    Public Sub prnProcessing_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        If prnSelection.arrToInstall.Count > 0 Then
            'added 10-2-08
            prnProgress.Style = ProgressBarStyle.Continuous
            'prnProgress.Dock = DockStyle.Bottom
            prnProgress.Visible = False
            prnProgress.Minimum = 1
            prnProgress.Maximum = prnSelection.arrToInstall.Count
            'end add 10-2-08

            ToDoWork.WorkerReportsProgress = True
            ToDoWork.WorkerSupportsCancellation = True
            ToDoWork.RunWorkerAsync(prnSelection.arrToInstall)
            Me.CenterToScreen()
        Else
            MsgBox("There are no printers to install.  Please choose the printers you wish to install.")
            prnSelection.Show()
            Me.Close()
        End If

    End Sub

    Public Sub ToDoWork_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles ToDoWork.DoWork

        Dim worker As System.ComponentModel.BackgroundWorker = CType(sender, System.ComponentModel.BackgroundWorker)
        If e.Argument IsNot Nothing AndAlso TypeOf (e.Argument) Is ArrayList Then
            Dim arrToInstall As ArrayList = e.Argument
            If arrToInstall.Count > 0 Then
                Dim i As Integer = 1
                For Each printer As String In arrToInstall
                    CallByName(Me, printer, CallType.Method)
                    worker.ReportProgress(i)
                    i += 1
                    System.Threading.Thread.Sleep(200)
                Next
            End If
        End If
    End Sub

    Public Sub ToDoWork_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles ToDoWork.ProgressChanged
        prnProgress.Visible = True
        prnProgress.Value = e.ProgressPercentage
    End Sub

    Public Sub PrinterProgress(ByVal i As Integer, ByVal worker As System.ComponentModel.BackgroundWorker, ByVal e As System.ComponentModel.DoWorkEventArgs)
        worker.ReportProgress(i)
    End Sub
    Public Sub ToDoWork_EndProgress() Handles ToDoWork.RunWorkerCompleted
        ToDoWork.Dispose()
        prnWrapup.Show()
        Me.Close()
    End Sub

    Public Sub CSE211CLQ()
       
        'Added on 10/27/2008
        Process.Start("cmd", "Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq")
        Process.Start("cmd", "rundll32 printui.dll, PrintUIEntry /if /b ""CSE-211-CLQ"" /f ""C:\7760.inf"" /q /r ""CSE-211-CLQ"" /m ""Xerox Phaser 7760GX PS"" /z /u")
        arrInstalled.Add("CSE-211-CLQ")
        'end Added on 10/27/2008
        
        'for test purposes
        MsgBox("CSE-211-CLQ Installed", vbOK)

    End Sub
End Class



Here is the form that contains the BGworker and Dos commands. I truncated the printers to one so that it wont be spam. I added the "cmd" to see if that would make a difference and it still doesnt work, however the command prompt pops up and everything else executes, just not the adding of the printer/port.
GeneralRe: listing ports with prnport.vbs and using that info in VB?? Pin
Dave Kreskowiak29-Oct-08 3:35
mveDave Kreskowiak29-Oct-08 3:35 
GeneralRe: listing ports with prnport.vbs and using that info in VB?? [modified] Pin
Trey549829-Oct-08 3:52
Trey549829-Oct-08 3:52 
GeneralRe: listing ports with prnport.vbs and using that info in VB?? Pin
Dave Kreskowiak29-Oct-08 4:14
mveDave Kreskowiak29-Oct-08 4:14 
GeneralRe: listing ports with prnport.vbs and using that info in VB?? Pin
Trey549829-Oct-08 4:26
Trey549829-Oct-08 4:26 
QuestionHelp me, How can i get the perl print data? Pin
f340492327-Oct-08 23:10
f340492327-Oct-08 23:10 
AnswerRe: Help me, How can i get the perl print data? Pin
Dave Kreskowiak28-Oct-08 1:35
mveDave Kreskowiak28-Oct-08 1:35 
GeneralRe: Help me, How can i get the perl print data? Pin
f340492328-Oct-08 20:07
f340492328-Oct-08 20:07 
QuestionAssembly Redirect Pin
Tauseef A27-Oct-08 22:18
Tauseef A27-Oct-08 22:18 
AnswerRe: Assembly Redirect Pin
Dave Kreskowiak28-Oct-08 1:34
mveDave Kreskowiak28-Oct-08 1:34 
QuestionEncrypt App.config Pin
Dinesh Vitharana27-Oct-08 22:10
Dinesh Vitharana27-Oct-08 22:10 
AnswerRe: Encrypt App.config Pin
Dave Kreskowiak28-Oct-08 1:27
mveDave Kreskowiak28-Oct-08 1:27 
AnswerRe: Encrypt App.config Pin
Jon_Boy28-Oct-08 2:38
Jon_Boy28-Oct-08 2:38 
Questioncommand builder Pin
jac10001111010127-Oct-08 20:02
jac10001111010127-Oct-08 20:02 
AnswerRe: command builder Pin
Dave Kreskowiak28-Oct-08 1:22
mveDave Kreskowiak28-Oct-08 1:22 
Questionim stuck in CRUD - my codes don't work. Pin
jac10001111010127-Oct-08 12:43
jac10001111010127-Oct-08 12:43 
AnswerRe: im stuck in CRUD - my codes don't work. Pin
Paul Conrad27-Oct-08 12:59
professionalPaul Conrad27-Oct-08 12:59 
AnswerRe: im stuck in CRUD - my codes don't work. Pin
Dave Kreskowiak27-Oct-08 15:50
mveDave Kreskowiak27-Oct-08 15:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.