简体   繁体   中英

How to create a OPOS Service Object virtual printer - c#

I'm looking to build an OPOS Service Object (SO) virtual printer for a POS application to capture shopping receipts. If somebody could advise steps for how to create the Service Object would be greatly appreciated.

Overall, the amount of information needed to answer this is so great that it is difficult to answer shortly.

Therefore, here are mainly links to relevant information.
Please use these as a reference to learn and work.

I have a device-independent and simple introduction description on my GitHub.
kunif/OposInternals

Other than that, it's neither C# nor POSPrinter, but there is a skeleton of MSR SO by ATL of VC++ on GitHub.
RichardChambers/atl_msr_so

Here are the attributes used in relation.
ComVisibleAttribute Class
GuidAttribute Class
InterfaceTypeAttribute Class
ComRegisterFunctionAttribute Class
ComUnregisterFunctionAttribute Class

This is the table of contents of the commentary article including the mechanism behind it.
Interoperability (C# Programming Guide)
Advanced COM Interoperability


Added in response to comments:

  1. What is the definition of that property defines in the OPOS PosPrinter internals and OPOS internals ENUM?
    From the name, I can not find what is the meaning of that?
    • The following part is based on the property name and index value definitions described in the include file(OPOSyyyy.hi) for Service Objects created in C ++, which is included in the CCO (Common Control Objects).
  • Device common property: OPOS_Internals.PIDX_pppp (property name in pppp)
  • Device specific property: OPOSxxxxInternals.PIDXyyyy_pppp (OPOS device class name in xxxx, abbreviation for device class name in yyyy, property name in pppp)
  1. For the VirtualPrinter and not PhysicalPrinter what functions defined in that class should be implemented as essential?
    In the case of we are only handling print commands of the virtual printer.

    • It depends not on the virtual printer factor, but on what method property event the application is using.
    • If the feature your application is using is not supported by your virtual printer, your application will detect an anomaly and stop processing.
  2. Does this sentence which you write "save a pointer to the CO's IDispatch.... event notification" means saving "pDispatch" into this class?

    • About the following. Yes, it is.
  • In the implementation of the OpenService method, save a pointer to the CO's IDispatch object passed as a parameter by preparing a dynamic type variable and use it for event notification.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM