hi all,
thanks to helping until this time.
now i want to display printer properties...
please help me to do this. do i have to using api function to do this??

any help will be appreciated...
best regards :)

Recommended Answers

All 4 Replies

what have you meant by printer properties?

plz explain in detail.

or you can try this :-

add the component Microsoft Common Dialog Control 6.0 from Project->Components.
make an instance of it on your form.
now take a comman button and place this code,

Private Sub Command1_Click()
[B]CommonDialog1.ShowPrinter[/B]
End Sub

It will show you the windows Print dialog box (the same one which you might be seen when trying to print documents from external windows applications like Notepad,wordpad,etc.

using API becomes more advance technique. you can API to access printer properties and configure it right through your code like finding its driver, setting up proper port, sending print commands,etc.,etc. For API reference Visit This Link.

regards
Shouvik

commented: great help :) +1
commented: simple and nice +1

try this following code :

Private Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As Any) As Long
Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Private Declare Function PrinterProperties Lib "winspool.drv" (ByVal hwnd As Long, ByVal hPrinter As Long) As Long
Private Sub Form_Load()
     Dim hPrinter As Long
    OpenPrinter Printer.DeviceName, hPrinter, ByVal 0&
    PrinterProperties Me.hwnd, hPrinter
    ClosePrinter hPrinter
End Sub

hope this helps...

commented: never through.. +1
commented: very helping me +1

wow...thanks all.
thanks shouvik...
thanks too jx_man...

yeah...you're welcome :)

commented: always helping ;) +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.