Case with .Net 2005:
(Add a reference to a AxInterop.CDIntfEx,copy&paste the code in a new project:)
Imports AxCDIntfEx
Public Class Form1
Friend WithEvents cdi As New AxCDIntfEx.AxCDIntfEx
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cdi.DriverInit("printerrific.net")
AddHandler cdi.StartPage, AddressOf StartPage_Function
cdi.SetDefaultPrinter()
cdi.CaptureEvents(1)
End Sub
Private Sub StartPage_Function(ByVal sender As Object, ByVal e As AxCDIntfEx._DCDIntfEvents_StartPageEvent)
MsgBox("StartPage_Function")
End Sub
End Class
***************************
Throws:
System.IO.FileNotFoundException was unhandled
Message="Could not load file or assembly 'Interop.CDIntfEx, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies."
1. Does exists a dependence between AxInterop.CDIntfEx and Interop.CDIntfEx?
Include reference Interop.CDIntfEx.dll
Throws:
System.Windows.Forms.AxHost.InvalidActiveXStateException was unhandled Message="Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown." Source="AxInterop.CDIntfEx"
Im planning to make it work at the end as a service.
Any help will be appreciated.
How to manage events with AxCDIntfEx (Addhandler)?
Thanks
Hi, I tried it succesfully.
It works fine with windows applications, but not with windows services. Looks like the cdintfex needs a form -a container- to receive the events and work properly. Not sure, but Im working -by now- as a windows application.
Thanks, Jose!
It works fine with windows applications, but not with windows services. Looks like the cdintfex needs a form -a container- to receive the events and work properly. Not sure, but Im working -by now- as a windows application.
Thanks, Jose!