Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Change Default Printer's Paper Size At Runtime


could anybody give me a sample code to change the default printer's setting (paper width/height,paper source, orientation) at runtime




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Default Printer - Set Paper Size - Need Help
How do you set the default printer's papersize to legal or letter? Really need help on this.

Searched the forum already but seem like nothing is working.

Thanks

Default Printer Paper Size
I have mapped printers on the login script using the following code:

PrinterPath = "\serverprinter"
PrinterDriver = "Lexmark Optra Color 1200 (MS)"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver

This works fine for all users.

The problem I have is that the printer's default paper size is set as 'Letter' for all users even though it is set as A4 on the Printer Server. I can manually change it and Terminal Server does remember this change, however changing this for every printer for every user, is an absolute nightmare.

Does anyone know a line I could add in to set the defaul paper size when the user logs in? Something like:

PrinterPaperSize = "A4"

Thanks
James

Set Default Paper Size For Default Printer ...
So, hope that someone could help me..hix..
If i cant do this i will loose my job, my boss say so. I have to print a webpage with the size of paper is A5 baut the default always is Letter, hix, I could change it by hand but the users may not. So i want to set the default paper size of default printer to A5.
Thanks a lot.

Changing Paper Size In Cdl.ShowPrinter Won't Change Printer.width And Printer.height
Hi,
I use this code to let the user change the paper size and orientation before printing.


VB Code:
CommonDialog.ShowPrintermsgbox printer.width & " " & printer.height 'print code here ...  


but under Windows XP even when I change the paper size from the dialog the vb's printer.width and printer.height arn't changed ....

Is there a better way to change the paper size .. and to retrieve the changed paper size ?

Change Printer Paper Size
my DataReport paper size is larger than the printer default size

How to change paper size programatically?


Code:
Printer.PaperSize = PrinterObjectConstants.vbPRPSUser 'supported by the priner driver
Printer.Width = #### 'number in twips which is larger than my report width
OR

Code:
Printer.PaperSize = ...A2 'The constant for A2 which is also supported by the printer driver
won't work, it has no effect on the printer at all (for my program or system-wide) and the error still popups.


the printer is EPSON LQ-1050 (wich driver is packed with win98/ME)

I searched the forums for this, I found alot of articles, I read more than 50 one, I got nothing usefull.

and this is the same article I wrote in other forum with about 4 replies and had no answer.
http://www.vbforums.com/showthread.p...51#post1555751

any help please

Change Printer Paper Size
my datareport reportWidth is about 20000 twips witch equal about 330 mm

when change paper size of the printer sittings to A2 (420 mm width) it works
when change paper size of the printer sittings to any other (smaller): "Error: Report width is larger than the paper width"

I put the folowing code to change the paper size before DataReport1.Show:

Code:
Printer.PaperSize = 258 'equivalent to A2 paper size

or

Code:
Printer.PaperSize = PrinterObjectConstants.vbPRPSUser
Printer.Width = 20000
Printer.Height = 20000

But the code did nothing

How can I change printer paper size by code?

Note that the printer is compatible with Epson LQ-1050


Of course I searched the forums for this "Printer paper size" and found alot of articles most left with no answer or not atchived a solution

please I realy need your help

How Can I Change The Default Printer At Runtime To Use It With Printer.print Command?
Hi everyone,
I have a little application which uses printer.print command to do some print jobs, of course there are some other things that I print using Data Reports.
When my application starts, I think it instantiates printer object with the default printer (lx300). Once the application is started, there are some options that use printer.print, but there are options that use printer.print too but I need to print them in another printer (ip1000). I have a common dialog that lets me choose the printer, and when I choose ip1000 every printer.print call goes to lx300. I assume there's no way to "reinstantiate" printer object to print in ip1000.
Also, when I close my application ip1000 becomes my default printer. Does the common dialog can select a printer without changing the Windows default printer like Word, Excel. do?

Thanks a lot for your help

How Can I Change The Default Printer At Runtime To Use It With Printer.print Command?
Hi everyone,
I have a little application which uses printer.print command to do some print jobs, of course there are some other things that I print using Data Reports.
When my application starts, I think it instantiates printer object with the default printer (lx300). Once the application is started, there are some options that use printer.print, but there are options that use printer.print too but I need to print them in another printer (ip1000). I have a common dialog that lets me choose the printer, and when I choose ip1000 every printer.print call goes to lx300. I assume there's no way to "reinstantiate" printer object to print in ip1000.
Also, when I close my application ip1000 becomes my default printer. Does the common dialog can select a printer without changing the Windows default printer like Word, Excel. do?

Thanks a lot for your help

Change Default Printer Setting At Runtime
could anybody give me a sample code to change the default printer's setting (paper width/height,paper source, orientatio) at runtime

Default Paper Size
Hi:

I´m trying to print a label 11 x 15 inches

I define the paper size:

    Dim TamEtiqueta As New PaperSize("TamEtiqueta", 1100, 1500)

After I want to print the label

I use the follow code:

'Declare the print Document and some properties (Papersize and Landscape)

Dim Etiqueta As New Printing.PrintDocument

Etiqueta.DefaultPageSettings.PaperSize = TamEtiqueta
Etiqueta.DefaultPageSettings.Landscape = True

'Print tha label
Etiqueta.Print()


The problem is: the printer uses a letter size,


I have to use a printdialog objet to correct this problem

Dim PrintDialog1 As New PrintDialog
Dim result As DialogResult = PrintDialog1.ShowDialog

BUT for each label printed I have to configure the paper size (already registered in the printer properties)
I print about 600 laber per day


I treated to configure some properties for printdialog object as showing

  Dim PrintDialog1 As New PrintDialog
            With PrintDialog1
                .Document = Etiqueta
                .PrinterSettings.PrinterName = "HP5100"
                .PrinterSettings.DefaultPageSettings.PaperSize.PaperName.ToString()
                .PrinterSettings.DefaultPageSettings.PaperSize = TamEtiqueta
                .PrinterSettings.DefaultPageSettings.Landscape = True
           End With

But doesnt work


What can I do?
Please I need help...






 

Setting Paper Bin Of Default Printer
Hello Everyone! I am stuck again. I am wanting to change the Paper Bin to the Lower Tray of a printer. Now, I have tried using Printer.PaperBin but that does not do what I want it to do. What is happening is I want to change the Paper Bin to the lower tray and then I need to launch AutoCAD where I will be printing a file from. When this gets printed, I want the drawing file from AutoCAD to be printed to the lower bin of the specified printer. Whenever I used the Printer.PaperBin prior to opening this file in AutoCAD, it does not seem to actually change the setting in the printer's property dialog box in Windows. If I print something using Printer.Print "Hello World!", then that prints to the lower bin but the AutoCAD drawing does not. So Printer.PaperBin seems to only change for the current Printer object session but does not actually change the Paper Source setting in the printer's property dialog box. I also tried the ResetPrinterDC API but that seems to work in the same fashion in the sense that it does not actually change the setting in the printer's property dialog box. To make it work, I use sendkeys to simulate changing the Paper Source of the specified printer when I do CommonDialog1.ShowPrinter. I was wondering if there was any way that I can actually set the Paper Source for a specified printer in the printer's property dialog box without having to use the sendkeys to simulate this change? Any ideas?

Thanks in advance.

Printer - Default Paper Setup Behaviour
Hello,

I have written a program in which I am printing directly to the printer (Dot Matrix Printer - Epson ) with the help of Printer.Print command. for e.g


VB Code:
Printer.Print "This"    Printer.Print "is"    Printer.Print "Test"    Printer.Print "Print"    Printer.EndDoc


When I give the Print command, then after printing the Data, it leaves the page as per settings of Paper Size for the printer.

I am using continous stationary (without perforation) and I want that printer should stop when the printing is finished. Are there any printer properties settings? Or programatically I need to do something?

Regards,
Rohit.

Default Paper Size When Printing Crystal Report From VB6
Problem:
When printing a crystal report from VB6, the default paper size sets to 'Letter'. I would like to change this to 'A4'. I have set the paper size of the crystal report to A4 and the default paper size of the printer to A4. When I print the report from crystal it prints fine but when I print the report from VB6, the paper size defaults to letter. This can be changed to A4 using the Advanced layout options but I want A4 to be the default.

Any ideas?

This is the bit of code that sets up the printer and prints the report.

CrRep.Destination = crptToPrinter
CrRep.PrinterSelect
CrRep.PrintReport

Thanks,

Sean

Printer Paper Size
Hi,

Can anyone tell me a way to set the paper size dynamically in vb? I am developing an application that prints timetables for students. I need to set the paper size dynamically..

Thanks in advance..

graci`as

HOLHI

VB Printer (paper Size)
ok i made some forms with some pics or documets i scanned as pictureboxes so that they can be edited in the app and printed ,,,, but for some reason one of these forms should be printed on a folio .. so i made an acception


din ddd as boanean
if ttt= true then
printer.papersize = vbprpsfolio
end if

i also got a module from the net so that i can print the picturebox and with values of X and Y

the printer i am using is a Xerox photocopy machine that can take 2 kinds of papers at the same time ...

what i need to know is can this command change the original Paper Media type , is it enough or do u advice i open a printer common dialg for my users ?


thankx

How Set The Paper Size, Printer.Papersize(?)
I am coding a little program to print graph paper.. (everyone's done this I presume).. I've got it to print on the standard 8.5 X 11 paper which I have figured out is the default setting when printing in VB..
What I want to do is have an option for the user to use 14 inch paper.. I'm stuck at Printer.Papersize(?) Whats the syntax ? Thanks

Using VB Printer Object Paper Size
hello, i noticed that whenever i printed with d printer object , the printed text gets cut off, of the right side of d paper. how can i wrap it like normal printer (i.e like notepad)

dim s as string
s="some lenghty message.....end of message"

it gets printed on a line
oyad

Designating Printer Paper Size
How can I designate the printer paper size before sending the job to the printer without using the CommonDialog box?

I am just using one printer on the machine.

Changing Printer Paper Size
There was a question not long ago about how to change th papersize property of the printer. What I want to know is how t get a list of available paper sizes for a given printer Something similar like list of fonts eg. Printer.FontCount Anybody knows how to do this programatically, without opening printer setup dialog box?

Printer Orientation And Paper Size
hello all,
please help about printer orientation and paper size. any body here know on how to control the printer orientation and paper size. using vb.

thank u
joseph

Set Printer Orientation And Paper Size
Hi to all!

Please help me I am developing some application and I have a report
file. Now my problem is I want to set the printer orientation and paper size
programmatically.

Thanks to all,
Joseph

Printer Object - Paper Size
I have looked through the archives and microsoft support. Could not find the answer. i am not sure if there is one. i have a generic text printer. I set the printer object to this printer in the code. Then i try to set the paper height. It will spit the paper out with no text. when i try to set the printer papersize the code bombs. I am getting approx. 10 inches of paper on a tape printer for 5 lines of print. Does anyone know what i am doing wrong or if the generic text driver supports changing the printer height.

Thanks

Jason

Dim prt As printer
'All the relevant information should be included in the printer device name.
For Each prt In Printers
If prt.DeviceName = "Generic / Text Only" Then
' set the network printer as system default.
Set printer = prt
Exit For
End If
Next
' printer.PaperSize = vbPRPSUser
' printer.Height = 2000
printer.Font = 14
printer.Print "Pack Station # " & m_str_PackStation
printer.Print "Packer Id:" & Space(5) & Text1(0).Text
printer.Print "Part No:" & Space(5) & Text1(1).Text
printer.Print "Quanity:" & Space(5) & Text1(2).Text
printer.Print "Target Wt:" & Space(5) & Text1(3).Text

printer.EndDoc

Custom Paper Size In Printer Object
Hi all
How can I set custom paper size in printer object in vb? I tried vbPRPSUser property. But it gives an error.
I have EPSON LQ-870 printer which doesn't have custom paper size in it's settings. I have to print in 5.5 inch X 9.5 inch pre printed paper. I'm using printer object to print.
Any idea? please help.
or how can I set custom paper size in crystal report 5?

Thanx in advance

Adding Printer Paper Size In A Combo Box
how to Add Printer paper size in a combo box ?

thanks

Printer Paper Size For Data Reports
Hi
Ive tried to use the printer object papersize property but it gets ignored when printing with the data report designer.
Here is part of my code:

Printer.PaperSize = vbPRPSA4

rptSummary.Orientation = rptOrientLandscape
rptSummary.Show vbModal

Is there an API I could use instead?

Any help would be much appreciated,
Thanks
Chris

Changing The Paper Size On A Network Printer
i'm needing to change the paper size on a network printer, i've seen some API functions that did this but it didn't seem to work for me here. here are the issues i'm dealing with.

1) i'm printing through another application, the vb app, but CorelDraw actually.
2) the printer is a network printer.
3) this all has to happen without user intervention - no dialogs.

can anyone point me in a direction here? it seems that i might be butting my head on some permissions issues since the printer is somewhere else. corel doesn't have a good way to get to the paper size through it (except with a dialog).

thanks.

Bill Bolte
http://www.billbolte.com | http://www.circle37.com
http://www.oldbarnsite.com | http://www.oldutguy.com

Change Paper Size
what is the cording to change paper size and set as landscape .. what is the right cording i m trying like this

printer.papersize = 9
printer.oriantation = 2

its not working
y is that ??

what should i do

Change Paper Size
How to get the Data Report height after loading the Report?
How to change the user difined Printing paper size in VB?

How Can I Change The Paper Size???
Hi to all

I'm using VB6 and i make a report with the datareport (default of vb).

I 'm searching the Web to find how i can change the paper size of the printer that user select but nothing.

I have a report tha prints Folio - Letter but it hasn't the same margins with the vbprpsFOLIO.

When the user select a printer from print button ( In Microsoft DataReport) i want to change the paper size of that printer.



**Sorry for my bad English**

Thnks

Change Paper Size Through VB
Hi all,

can anyone let me how to change the paper size through VB code dynamically as per requirement, ie some of my data reports are using letter size papaer some using legal and some A4, I have tried printer.paperSize but it is not working ,

Thanks in advance

bye

How To Customize Printing Paper Size At Runtime
How Can I Customize The Printing Paper Size At Runtime. I Need To Tell The Printer To Use A Page Setting Of Width=850 and Height =600. But I Am Not Able To Solve My Problem.... Please can u help me if you know how to do this at runtime?

It Can Be Done By Changing The Default Printer Setting But Apart From That I Want To Do This Without Changing The Default Printer Setting And In Runtime.
Thanks
If You Solve My Problem Do Mail Me At: udayan_chatterjee@mail.com

Please Help: How To Change Settings Of Paper Size?
Hi,

Could we change the settings of the paper size of the printer in windows using visual basic?How? And what is the synatx?Have browsed and come up with the line PRINTER.PAPERSIZE=VBPRPSA4.Is the liner correct and what are the other codes for papersize.

Thank you!

Change Paper Size Dynamically
i have problem with changing paparsize(A4,letter) using VB code.i use some code those dont take effect.
if any body have the solution please send me.
thanks

How Can I Set User Defined Paper Size Of Printer Object For (Epson Lq 300,....)
Hi My Friends

I have a problem in Visual Basic 6
I want to print some line by printer object .
My print doesn't have standard size and i cant Set PaperSize Property
Of Printer Object To UserDefined(When I Set It An Error Occured)
(My printer is Epson Lq Series)
How Can I Solve This problem

Thanks
smb19762003@yahoo.com

Programatically Change Paper Size In Access 97
Hullo. You know that frustrated feeling you get when you know you are about finished with a niffty project, but can't quite make it click? That's where I'm at now.
The situation: Access97 database to track service level responses. db is "locked" using the Startup options in Access, to prevent users from touching the tables manually. Works fine and dandy. Report for printing said responses works fine and dandy designed on Legal paper.

The problem: Users cannot change the paper source for the report, so the staggering majority of them, who had last selected Letter in their other Access db's cannot change to Legal for this. I know that with PrtDevMode I can do the mojo I want, but, my poor blonde brain is having a meltdown figuring out how.

If standard wisdom is, "Just keep pounding, and you'll eventaully get it" I can live with that. I'll buy stock in the aspirin company, but, I'll deal. I'd rather not, though. If somebody has already blazed this trail, I'd gladly follow in their Wenceslas-ian footsteps, and be warmed by their knowledge and effort.

If further explaination or questions need to be asked, please let me know.

Many thanks!

Jim

Urgent?can We Defined Size Of Paper In Crysal Report At Runtime
???urgent
can we defined size of paper in crysal report at runtime

Change Printer Paper Source In VB > Excel
Dear all,
Could any one can tell me how to change the paper source when printing a Excel file from VB, my network printer has many tray and I want the all print output of this file goes to the specific network printer and the specific papar tray (Say Tray 3), the printer actually is a copy machine has network componant.

Thanks a lot

Change Paper Source/ Printer Bin During Print Job
Is it possible to change the paper source of a print job half-way through?

For instance, i start printing from tray 1, then halfway through, i carry on printing from tray 2?

Thanks for your time

Change Data Report Paper Size At Run Time
i design my reports using Data Report. the reports will print into preprinted form with many size such as A4, F4 etc. my the default printer is set to A4 size. this cause some of the reports cannot print properly, the printing show in second page. (actually it is in 1 page which the paper is F4, higher than A4).

now my problem is: how to change the papersize for data report at runtime? say my default printer is set to A4, then i want to show some of the reports in B4 size, and some in F4 size...

i tried the printer.papersize, but it doesn work for data report.

is that possible to change the data report paper size in run time? How?

Change Paper Size For Data Report At Run Time
i had post this thread before but seems no one understand my problem...

in my program, i have 2 report. 1 is in Letter size (11in Height), another 1 is in custom size (14in Height), both report are in 8.5in Width and in Potrait.

How do i change the paper size in run time to allow to display the 1st report in Letter size and then also can display the 2nd report in the custom size(14in).

ps: Printer.Papersize doesn't change the data report paper size....

How To Change The Width Of Data Report To A3 Paper Size
I want to change the width of data report to A3 paper size,I dont know how ?

How To Change The Paper Size Before Printing In Data Report.
I have a problem regarding producing the summary report of the inventory system I am developing in our company. The problem is that I cannot produce a report in data report that is longer than A3 size of a bond paper.

In the design, I tried to enlarge the width but when I run the program, there is an error "Report width is larger than the paper width.

Please help me to have a code that will setup the paper size according to user's choice and preview the report an error.

Note: I dont want code that access Crystal Report. I already know how to change paper size in Crystal Report. What I want to know is the application of dynamic paper sizing in Data Report within the Visual Basic 6.0

Default Printer Not Getting Changed In Runtime
The following code is used to change the default printer. I call WinNTSetDefaultPrinter with the printer name which I want to make default.
In design time, the change is getting reflected and my application uses the new default printer to print. But in runtime, the default printer is not getting changed. The old printer is getting used.

I am Shelling a Batch file, which inturn runs my application. Does this has any thing to do with such a behaviour?




VB Code:
Option Explicit Public Const HWND_BROADCAST = &HFFFFPublic Const WM_WININICHANGE = &H1APrivate Const WM_SETTINGCHANGE As Long = WM_WININICHANGEPrivate Const SMTO_NORMAL As Long = &H0  ' constants for DEVMODE structurePublic Const CCHDEVICENAME = 32Public Const CCHFORMNAME = 32 ' constants for DesiredAccess member of PRINTER_DEFAULTSPublic Const STANDARD_RIGHTS_REQUIRED = &HF0000Public Const PRINTER_ACCESS_ADMINISTER = &H4Public Const PRINTER_ACCESS_USE = &H8Public Const PRINTER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or _PRINTER_ACCESS_ADMINISTER Or PRINTER_ACCESS_USE) ' constant that goes into PRINTER_INFO_5 Attributes member' to set it as defaultPublic Const PRINTER_ATTRIBUTE_DEFAULT = 4 ' Constant for OSVERSIONINFO.dwPlatformIdPublic Const VER_PLATFORM_WIN32_WINDOWS = 1 Public Type OSVERSIONINFO    dwOSVersionInfoSize As Long    dwMajorVersion As Long    dwMinorVersion As Long    dwBuildNumber As Long    dwPlatformId As Long    szCSDVersion As String * 128End Type Public Type DEVMODE     dmDeviceName As String * CCHDEVICENAME     dmSpecVersion As Integer     dmDriverVersion As Integer     dmSize As Integer     dmDriverExtra As Integer     dmFields As Long     dmOrientation As Integer     dmPaperSize As Integer     dmPaperLength As Integer     dmPaperWidth As Integer     dmScale As Integer     dmCopies As Integer     dmDefaultSource As Integer     dmPrintQuality As Integer     dmColor As Integer     dmDuplex As Integer     dmYResolution As Integer     dmTTOption As Integer     dmCollate As Integer     dmFormName As String * CCHFORMNAME     dmLogPixels As Integer     dmBitsPerPel As Long     dmPelsWidth As Long     dmPelsHeight As Long     dmDisplayFlags As Long     dmDisplayFrequency As Long     dmICMMethod As Long        ' // Windows 95 only     dmICMIntent As Long        ' // Windows 95 only     dmMediaType As Long        ' // Windows 95 only     dmDitherType As Long       ' // Windows 95 only     dmReserved1 As Long        ' // Windows 95 only     dmReserved2 As Long        ' // Windows 95 onlyEnd Type Public Type PRINTER_INFO_5     pPrinterName As String     pPortName As String     Attributes As Long     DeviceNotSelectedTimeout As Long     TransmissionRetryTimeout As LongEnd Type Public Type PRINTER_DEFAULTS     pDatatype As Long     pDevMode As Long     DesiredAccess As LongEnd Type Declare Function GetProfileString Lib "kernel32" _Alias "GetProfileStringA" _(ByVal lpAppName As String, _ByVal lpKeyName As String, _ByVal lpDefault As String, _ByVal lpReturnedString As String, _ByVal nSize As Long) As Long Declare Function WriteProfileString Lib "kernel32" _Alias "WriteProfileStringA" _(ByVal lpszSection As String, _ByVal lpszKeyName As String, _ByVal lpszString As String) As Long Declare Function SendMessage Lib "user32" _Alias "SendMessageA" _(ByVal hwnd As Long, _ByVal wMsg As Long, _ByVal wParam As Long, _lParam As String) As Long Declare Function GetVersionExA Lib "kernel32" _(lpVersionInformation As OSVERSIONINFO) As Integer Public Declare Function OpenPrinter Lib "winspool.drv" _Alias "OpenPrinterA" _(ByVal pPrinterName As String, _phPrinter As Long, _pDefault As PRINTER_DEFAULTS) As Long Public Declare Function SetPrinter Lib "winspool.drv" _Alias "SetPrinterA" _(ByVal hPrinter As Long, _ByVal Level As Long, _pPrinter As Any, _ByVal Command As Long) As Long Public Declare Function GetPrinter Lib "winspool.drv" _Alias "GetPrinterA" _(ByVal hPrinter As Long, _ByVal Level As Long, _pPrinter As Any, _ByVal cbBuf As Long, _pcbNeeded As Long) As Long Public Declare Function lstrcpy Lib "kernel32" _Alias "lstrcpyA" _(ByVal lpString1 As String, _ByVal lpString2 As Any) As Long Public Declare Function ClosePrinter Lib "winspool.drv" _(ByVal hPrinter As Long) As Long Private Declare Function SendMessageTimeout Lib "user32.dll" Alias "SendMessageTimeoutA" _(ByVal hwnd As Long, ByVal msg As Long, _ByVal wParam As Long, ByVal lParam As Long, _ByVal fuFlags As Long, ByVal uTimeout As Long, _ByRef lpdwResult As Long) As Long  Public Sub WinNTSetDefaultPrinter(PrinterName As String)    Dim Buffer As String    Dim DeviceName As String    Dim DriverName As String    Dim PrinterPort As String    Dim r As Long    If PrinterName <> vbNullString Then        ' Get the printer information for the currently selected        ' printer in the list. The information is taken from the        ' WIN.INI file.        Buffer = Space(1024)        r = GetProfileString("PrinterPorts", PrinterName, "", _            Buffer, Len(Buffer))         ' Parse the driver name and port name out of the buffer        GetDriverAndPort Buffer, DriverName, PrinterPort            If DriverName <> "" And PrinterPort <> "" Then               SetDefaultPrinter PrinterName, DriverName, PrinterPort               SelectPrinter (PrinterName)           End If    End IfEnd Sub  Public Sub SelectPrinter(NewPrinter As String)    Dim Prt As Printer    For Each Prt In Printers        If Prt.DeviceName = NewPrinter Then            Set Printer = Prt        Exit For        End If    NextEnd Sub        Private Function PtrCtoVbString(Add As Long) As String    Dim sTemp As String * 512, x As Long     x = lstrcpy(sTemp, Add)    If (InStr(1, sTemp, Chr(0)) = 0) Then         PtrCtoVbString = ""    Else         PtrCtoVbString = Left(sTemp, InStr(1, sTemp, Chr(0)) - 1)    End IfEnd Function Private Sub SetDefaultPrinter(ByVal PrinterName As String, _    ByVal DriverName As String, ByVal PrinterPort As String)    Dim DeviceLine As String    Dim r As Long    Dim l As Long    DeviceLine = PrinterName & "," & DriverName & "," & PrinterPort    ' Store the new printer information in the [WINDOWS] section of    ' the WIN.INI file for the DEVICE= item    r = WriteProfileString("windows", "Device", DeviceLine)        ' Cause all applications to reload the INI file:    l = SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, "windows")        'Tell all open programs that this change occurred.Allow each app 1 second to handle this message.    'Using This also just in case this helps. But....Still the problem persists    l = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0, SMTO_NORMAL, 500, 0)    End Sub  Private Sub GetDriverAndPort(ByVal Buffer As String, DriverName As _    String, PrinterPort As String)     Dim iDriver As Integer    Dim iPort As Integer    DriverName = ""    PrinterPort = ""     ' The driver name is first in the string terminated by a comma    iDriver = InStr(Buffer, ",")    If iDriver > 0 Then          ' Strip out the driver name        DriverName = Left(Buffer, iDriver - 1)         ' The port name is the second entry after the driver name        ' separated by commas.        iPort = InStr(iDriver + 1, Buffer, ",")         If iPort > 0 Then            ' Strip out the port name            PrinterPort = Mid(Buffer, iDriver + 1, _            iPort - iDriver - 1)        End If    End IfEnd Sub

How To Change The Default Printer?
Hi brains


i am working in a accounting software, i don't know how i change the default printer in run time because i have a different page setup as default for different printer. i am using windows XP/sp2


pls help me .............................................................


with regards

annamalai

Change The Default Printer
I have two printers that have been setup in my computer. One is local and the other is in the network. My program needs to print in those two printers. How can I change the default printer of my computer? Im using vb6 in Windows 98 OS.

Change Default Printer
Hi again,

I want to know how we can change default printer through vb code ?

does anyone know about this stuff ?

Change Default Printer ?
Hello

I need to change the default printer
and then print something from a report.

but it keeps on ending up on the wrong printer.

I think i need to use API bud dont know how.

anybody ?

Thanks in advance
Micke

Change Default Printer In VB
Is there a way to change the default printer. One way suggested in Vb Help is to change the Printer.Device name to the specified printer and then use the set printer statement. But this just sends the output to that printer. I want to change the default printer in start/settings/printer also to show the default printer to the specified printer.
Is there a way in VB or is there an API to do this.
Thanks!

Change Default Printer
Hello!
i amn trying to add a Visuail basic 6 code to an excisting code that has the
purpose to change the current default printer to another printer by name and
then after the printer to change back to the old default printer again...

Anyone knows how to do this easy??

Copyright © 2005-08 www.BigResource.com, All rights reserved