Creativity, Innovation... Failure



Notes : Programming in a managed and native environment

In this post I will be writting about calling managed code from native code.

The flag of compilation /clr:old_syntax does not support the use of specific .NET keywords (as #using).
Therefore, using /clr would be a workaround but is incompatible with flag /rtc1.

So I need a way to call managed code in a dll B from native code in a dll A.
To do so, no C++ managed extensions (C++/CLI) must be in dll A. Otherwise, it would need to be compiled with the flag /clr.

Solution is to put a native exported function (_declspec(export)) in dll B which returns an interface to my managed class. Then in my native dll A, I would simply include the header file to the exported function from managed dll B and call it to retrieve an interface which maps to the concrete managed class in dll B.

Hope this helps someone, if not feel free to ask questions.


Notes : Printing in Windows


How to send raw data to a printer by using Visual C# .NET

Setting pDataType = "RAW" seems to have nothing to do with PCL exclusivly. The data that is later on sent can be PostScript, ESP, etc.

http://support.microsoft.com/kb/322091/en-us

Other samples :

http://www.codeproject.com/KB/printing/pclprinting.aspx
http://www.codeproject.com/KB/vb/Print_Raw_Data.aspx



Printer Escape Functions

The following printer escape functions are used with the Escape or ExtEscape functions.

Printer escape functionDescription
CHECKJPEGFORMAT Checks whether the printer supports a JPEG image.
CHECKPNGFORMAT Checks whether the printer supports a PNG image.
DRAWPATTERNRECT Draws a white, gray-scale, or black rectangle.
GET_PS_FEATURESETTING Gets information on a specified feature setting for a PostScript driver.
GETTECHNOLOGY For non-XPSDrv printers: Reports on whether or not the driver is a Postscript driver. For XPSDrv printers: Reports on whether or not the driver is the Microsoft XPS Document Converter (MXDC). If it is, the escape returns the zero-terminated string "http://schemas.microsoft.com/xps/2005/06".
MXDC_ESCAPE Windows Vista: Enables applications to write documents to a file or to a printer in XML Paper Specificaton (XPS) format by means of the Microsoft XPS Document Converter (MSDC).
PASSTHROUGH Sends data directly to a printer driver in compatibility mode or GDI-centric mode.
POSTSCRIPT_DATA Sends data directly to a printer driver in compatibility mode only.
POSTSCRIPT_IDENTIFY Sets a PostScript driver to GDI-centric or PostScript-centric mode.
POSTSCRIPT_INJECTION Inserts a block of raw data in a PostScript job stream.
POSTSCRIPT_PASSTHROUGH Sends data directly to a PostScript printer driver in compatibility mode or PostScript-centric mode.
SPCLPASSTHROUGH2 Allows applications to include private procedures and other resources at the document level-save context.

http://msdn.microsoft.com/en-us/library/dd162843(VS.85).aspx


Tags:
Categories: PDF | Programming | Printing
Actions: E-mail | Permalink | Comments (92) | Comment RSSRSS comment feed

Notes : LINQ

Linq-to-Entities = ObjectContext
Linq-to-Sql = DataContext
Why?


Tags: ,
Categories: Programming | Web | Notes
Actions: E-mail | Permalink | Comments (66) | Comment RSSRSS comment feed