Dzwebs.Net

撰写电脑技术杂文十余年

VB调用“打印”对话框的代码

Admin | 2009-5-5 13:12:10 | 被阅次数 | 8424

温馨提示!

如果未能解决您的问题,请点击搜索;登陆可复制文章,点击登陆
VB调用"打印"对话框的代码

  Private Type PrintDlg
  lStructSize As Long
  hwndOwner As Long
  hDevMode As Long
  hDevNames As Long
  hdc As Long
  flags As Long
  nFromPage As Integer
  nToPage As Integer
  nMinPage As Integer
  nMaxPage As Integer
  nCopies As Integer
  hInstance As Long
  lCustData As Long
  lpfnPrintHook As Long
  lpfnSetupHook As Long
  lpPrintTemplateName As String
  lpSetupTemplateName As String
  hPrintTemplate As Long
  hSetupTemplate As Long
  End Type

  Private Declare Function PrintDlg Lib "comdlg32.dll" Alias "PrintDlgA" (pPrintdlg As PrintDlg) As Long

  '将以下代码置于某一事件中

  Dim tPrintDlg As PrintDlg
  tPrintDlg.lStructSize = Len(tPrintDlg)
  tPrintDlg.hwndOwner = Me.hwnd
  tPrintDlg.hdc = hdc
  tPrintDlg.flags = 0
  tPrintDlg.nFromPage = 0
  tPrintDlg.nToPage = 0
  tPrintDlg.nMinPage = 0
  tPrintDlg.nMaxPage = 0
  tPrintDlg.nCopies = 1
  tPrintDlg.hInstance = App.hInstance
  lpPrintTemplateName = "Print Page"
  Dim a
  a = PrintDlg(tPrintDlg)
  If a Then
  lFromPage = tPrintDlg.nFromPage
  lToPage = tPrintDlg.nToPage
  lMin = tPrintDlg.nMinPage
  lMax = tPrintDlg.nMaxPage
  lCopies = tPrintDlg.nCopies
  PrintMyPage 'Custom printing Subroutine
  End If

该杂文来自: 网站开发杂文

上一篇:VB调用“打开文件”对话框的代码

下一篇:VB实现客户机←→服务器(TCP/IP)编程监听代码

网站备案号:

网站备案号:滇ICP备11001339号-7

版权属性:

Copyright 2007-2021-forever Inc. all Rights Reserved.

联系方式:

Email:dzwebs@126.com QQ:83539231 访问统计