borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (titlebar changing color)Next Topic (VB Preference) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : Printing through API
Poster Message
thirumalaicb
Level: Sage

Registered: 09-09-2003
Posts: 51

icon Printing through API

hi

i want to direct the output to the printer from VB 6.0. The problem here is i want fast print outs. It is possible only through APIs. i know how to use the *.txt file to save the required data in it and then print it through the shell command by running a batch file, which stores the dos command for printing a txt file as follows


type filename.txt > PRN


the actual problem is when i want to have output in a network printer. i dont want to do as i said above. is there any way through APIs.



____________________________
Life is at Stake; Make the most out of it!

23-02-2004 at 04:12 PM
View Profile Send Email to User Show All Posts | Quote Reply
donramesh
Level: Guest

icon Re: Printing through API

Hi thiru, Just try this code
Probably u can use the printer.port to identify the port and print a text file directly.
No need for APIs
-------------------------------------------------------------------

Private Sub PrintDirectly()
    Dim strFilename As String
    Dim strLine As String
      
      strFilename = InputBox("Enter the file name to print", "Filename to print")
  
      If InStr(UCase(Printer.Port), "LPT") <> 0 Then
       Open Printer.Port For Output As #1
         Open strFilename For Input As #2
          Do Until EOF(2) = True
             Line Input #2, strLine
             Print #1, strLine
          Loop
         Close #2
       Close #1
      Else
    
       If Not bAlert Then MsgBox "Default printer is not set to LPT port."
    
      End If
  End Sub

-------------------------------------------------------------------

25-02-2004 at 07:04 AM
| Quote Reply
thirumalaicb
Level: Sage

Registered: 09-09-2003
Posts: 51
icon Re: Printing through API

hi ramesh

thanks 4 the code. i will come back to u after testing it.



____________________________
Life is at Stake; Make the most out of it!

26-02-2004 at 12:14 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB.Net : Printing through API
Previous Topic (titlebar changing color)Next Topic (VB Preference) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder