borderAndreaVB free resources for Visual Basic developersborder

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

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

Print This Topic
Previous Topic (Print API problem)Next Topic (How to know when a printing is started) New Topic New Poll Post Reply
AndreaVB Forum : Printing : Thanks but ...
Poster Message
supera
Level: Guest


icon Thanks but ...  Archived to Disk

Thanks for your help but tell me please; must I use a timer to intercept the WM_SPOOLERSTATUS messages?
In fact, I don't know in advance which application user will use to print; I thought that I was able to use a timer in which I could scan my printer's status and jobs... But If I use this method, I could intercept the signal a little seconds late.
My problems is that when a user wants to print since any application in Windows 9x/2000, I would like to pause the printing, ask him some informations and if the anwsers are right,continue with printing otherwise cancel it...
What's the best way to do this?
Thanks in advance.

09-07-2002 at 01:18 PM
| Quote Reply
Merrion
Level: VB Guru

Registered: 15-04-2002
Posts: 37
icon Re: Thanks but ...  Archived to Disk

When a job is added or removed from the print queue in Windows 95/98/Me the message wm_spoolerstatus is sent to every application's main window.

Unfortunately this message is just ignored by VB and so no event is generated.

However it is possible to subclass your application's main window and thereby intercept that message.

Subclassing is a very advanced programming technique - however I have written a dll - EventVB that makes this a lot easier...
you can do this thus:


Dim WithEvents vbLink As EventVB.ApiFunctions
Dim WithEvents vbWnd As EventVB.ApiWindow

Private Sub Form_Load()

Set vbLink = New ApiFunctions

Set vbWnd = New ApiWindow
vbWnd.hwnd = Me.hwnd

vbLink.SubclassedWindows.Add vbWnd

End Sub

Private Sub vbWnd_WindowMessageFired(ByVal msg As WindowMessages, ByVal wParam As Long, ByVal lParam As Long, Cancel As Boolean, ProcRet As Long)

If msg = WM_SPOOLERSTATUS Then
  ' A print job was added or removed...

End If

End Sub


Hope this helps,
  Duncan


[Edited by admin on 09-07-2002 at 05:04 PM GMT]

____________________________
--8<------------------------------
Free components and source code - see http://www.merrioncomputing.com/Download/index.htm for details

09-07-2002 at 03:36 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Printing : Thanks but ...
Previous Topic (Print API problem)Next Topic (How to know when a printing is started) 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-2007 Andrea Tincaniborder