|
-
Nov 18th, 2009, 09:59 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Application hang printing throught the network!!
Hi friends.
I have 2 printers throught the network each are connected to a print server
I redirect the printer with .bat file in windows startup
Print Server 1
Net Use LPT1 :/DELETE
Net Use LPT1 :\\192.168.1.1\Printer1
Print Server 2
Net Use LPT2 :/DELETE
Net Use LPT2 :\\192.168.1.2\Printer2
Sometimes when there is a network like "Request Time Out", when User are going to print the application hang
I use this code to check printer status but the application hang again
Code:
Private Function CheckPrinterStatus(ByVal LPTPort as String) as Boolean
On Local Error GoTo PrinterError:
Select Case LPTPort
Case LPT1:
Open LPT1 For Output #1
Case LPT2:
Open LPT2 For Output #1
end select
Close #1
Exit Function
PrinterError:
Select Case LPTPort
Case LPT1:
CheckPrinterStatus = True
MsgBox "Check Print Server 1"
Case LPT2:
CheckPrinterStatus = True
MsgBox "Check Print Server 2"
End Select
End sub
Is there is a way to check the print servers throught the network that the application don't hang
I'll Apreciate a lot if someone can help me.

Cabral
I don't need any books to learn Visual Basic and SQL Server, vbforum.com is the answer to learn SQL and break the code 
-
Nov 19th, 2009, 08:03 AM
#2
Re: Application hang printing throught the network!!
Why not configuring those printers directly on the system so you can print directly using Printer.Print?
-
Nov 19th, 2009, 01:31 PM
#3
Thread Starter
Addicted Member
Re: Application hang printing throught the network!!
Ok, If I use printer.print the application don't hang?
Please can you show the code to configure those print server with printer.print?
Thanks,
Cabral
I don't need any books to learn Visual Basic and SQL Server, vbforum.com is the answer to learn SQL and break the code 
-
Nov 19th, 2009, 01:42 PM
#4
Re: Application hang printing throught the network!!
There is no code - add printer to your computer, set it as default and that's about it.
If system has multiple printers you may programmatically change default printer and we have samples that handle that already posted.
VB6 has built-in object - Printer - so when your use Printer.Print command it will send print job to default printer.
There is also way to loop through printers collection and set Printer object to another printer without actually changing default.
For samples and other suggestions try searching this forum for something like "printer.print" or "default printer", etc...
-
Nov 19th, 2009, 04:32 PM
#5
Re: Application hang printing throught the network!!
Code i use to get a list of printers and highlight the default printer
Code:
Dim I As Integer
Dim p As Printer
On Error GoTo errHandler
'Printer.DeviceName is the way to get default printer
For Each p In Printers
List1.AddItem p.DeviceName
Next
For I = 0 To List1.ListCount - 1
If List1.list(I) = Printer.DeviceName Then
List1.ListIndex = I
Exit Sub
End If
Next
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
-
Nov 19th, 2009, 05:54 PM
#6
Thread Starter
Addicted Member
Re: Application hang printing throught the network!!
I don't need any books to learn Visual Basic and SQL Server, vbforum.com is the answer to learn SQL and break the code 
-
Nov 19th, 2009, 07:43 PM
#7
Re: Application hang printing throught the network!!
That will only work if there is at least one printer configured.
Like I said it only through existing printers and populates listbox control.
However, it does not add any printers to your system nor it configures it.
-
Nov 19th, 2009, 07:52 PM
#8
Re: Application hang printing throught the network!!
 Originally Posted by ecabralrojas
I'll Try This!!
To determine if there are no printers:
Dim i as integer
i = Printers.Count
If i = 0 then 'no printers configured on the system
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
-
Nov 19th, 2009, 08:28 PM
#9
Thread Starter
Addicted Member
Re: Application hang printing throught the network!!
It's like it Rhino Said I'll working it
I Apreciate a lot you help inoend07
I don't need any books to learn Visual Basic and SQL Server, vbforum.com is the answer to learn SQL and break the code 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|