Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Help me Master "Develop SDK for printer" (http://www.go4expert.com/forums/help-master-develop-sdk-printer-t17430/)

Ciapa 9May2009 09:30

Help me Master "Develop SDK for printer"
 
Hello Master,
I have a task from my college to develop SDK (printer), when i browsed to site i got 3 files: reference.pdf, .h and .dll.
I heard a lot of master C++ here so help me please how to use the SDK.
please give a little source code in visual C++ in using this SDK (how to call the function)
in the below thread i'll post the .h (header file)

Ciapa 9May2009 09:34

Help me Master "Develop SDK for printer"
 
This is the header file:

Code:

typedef void (CALLBACK *ZBRGDIGetSDKVer)(LPINT major, LPINT minor, LPINT engLevel);

typedef INT (CALLBACK *ZBRGDICloseGraphics)(HDC hDC, LPINT err);
typedef INT (CALLBACK *ZBRGDIInitGraphics)(LPSTR printerName, HDC *hDC, LPINT err);
typedef INT (CALLBACK *ZBRGDIInitGraphicsEx)(LPSTR printerName, HDC *hDC, LPSTR jobName, int *jobID, LPINT err);
typedef INT (CALLBACK *ZBRGDIInitGraphicsFromPrintDlg)(HDC *hDC, LPINT err);
typedef INT (CALLBACK *ZBRGDIPrintGraphics)(HDC hDC, LPINT err);
typedef INT (CALLBACK *ZBRGDIPrintGraphicsEx)(HDC hDC, LPINT err);
typedef INT (CALLBACK *ZBRGDIStartPage)(HDC hDC, LPINT err);
typedef INT (CALLBACK *ZBRGDIEndPage)(HDC hDC, LPINT err);
typedef INT (CALLBACK *ZBRGDIClearGraphics)(LPINT err);
typedef INT (CALLBACK *ZBRGDIPrintFilePos)(HDC hDC, LPSTR fileName, DWORD position, LPINT err);
typedef INT (CALLBACK *ZBRGDIPrintFileRect)(HDC hDC, LPSTR fileName, DWORD x, DWORD y, DWORD width, DWORD sizeY, LPINT err);
typedef INT (CALLBACK *ZBRGDIDrawText)(DWORD x, DWORD y, LPSTR text, LPSTR font, DWORD fontSize, DWORD fontStyle, DWORD color, LPINT err);
typedef INT (CALLBACK *ZBRGDIDrawTextUnicode)(DWORD x, DWORD y, LPWSTR text, LPWSTR font, DWORD fontSize, DWORD fontStyle, DWORD color, LPINT err);
typedef INT (CALLBACK *ZBRGDIDrawTextEx)(DWORD x, DWORD y, INT angle, DWORD alignment, LPSTR text, LPSTR font, DWORD fontSize, DWORD fontStyle, DWORD color, LPINT err);
typedef INT (CALLBACK *ZBRGDIDrawTextRect)(DWORD x, DWORD y, DWORD width, DWORD sizeY, DWORD alignment, LPSTR text, LPSTR font, DWORD fontSize, DWORD fontStyle, DWORD color, LPINT err);
typedef INT (CALLBACK *ZBRGDIDrawTextRectEx)(DWORD x, DWORD y, DWORD width, DWORD height, INT angle, DWORD alignment, LPSTR text, LPSTR font, DWORD fontSize, DWORD fontStyle, DWORD color, LPINT err);
typedef INT (CALLBACK *ZBRGDIDrawLine)(DWORD x1, DWORD y1, DWORD x2, DWORD y2, DWORD color, float thickness, LPINT err);
typedef INT (CALLBACK *ZBRGDIDrawImage)(LPSTR fileName, DWORD x, DWORD y, LPINT err);
typedef INT (CALLBACK *ZBRGDIDrawImagePos)(LPSTR fileName, DWORD position, LPINT err);
typedef INT (CALLBACK *ZBRGDIDrawImageRect)(LPSTR fileName, DWORD x, DWORD y, DWORD width, DWORD sizeY, LPINT err);
typedef INT (CALLBACK *ZBRGDIDrawRectangle)(DWORD x, DWORD y, DWORD width, DWORD sizeY, float thickness, DWORD color, LPINT err);
typedef INT (CALLBACK *ZBRGDIDrawEllipse)(DWORD x, DWORD y, DWORD width, DWORD height, float thickness, DWORD color, LPINT err);
typedef INT (CALLBACK *ZBRGDIDrawBarCode)(DWORD x, DWORD y, DWORD rotation, DWORD barCodeType, DWORD barWidthRatio, DWORD barCodeMultiplier, DWORD barCodeHeight, DWORD textUnder, LPSTR barCodeData, LPINT err);
typedef INT (CALLBACK *ZBRGDIIsPrinterReady)(LPSTR printerName, LPINT err);
typedef INT (CALLBACK *ZBRGDIPreviewGraphics)(HWND hwnd, LPINT err);

// Number of graphical pixels on card, width and height
#define MAX_WIDTH 1044
#define MAX_HEIGHT 660

// For positioning text and images
#define ZBR_UPPER_LEFT 0
#define ZBR_LOWER_LEFT 1
#define ZBR_UPPER_RIGHT 2
#define ZBR_LOWER_RIGHT 3
#define ZBR_CENTER 4
#define ZBR_LEFT  5
#define ZBR_RIGHT 6

// For font styles
#define ZBR_REGULAR 0    //FontStyleRegular
#define ZBR_BOLD 1        //FontStyleBold
#define ZBR_ITALIC 2      //FontStyleItalic
#define ZBR_BOLD_ITALIC 3 //FontStyleBoldItalic
#define ZBR_UNDERLINE 4  //FontStyleUnderline
#define ZBR_STRIKEOUT 8  //FontStyleStrikeout

// Errors returned by the SDK graphics engine
#define ZBR_GDI_ERROR_GENERIC_ERROR                8001        //GenericError      = 1,
#define ZBR_GDI_ERROR_INVALID_PARAMETER            8002        //InvalidParameter  = 2,
#define ZBR_GDI_ERROR_OUT_OF_MEMORY                8003        //OutOfMemory      = 3,
#define ZBR_GDI_ERROR_OBJECT_BUSY                  8004        //ObjectBusy        = 4,
#define ZBR_GDI_ERROR_INSUFFICIENT_BUFFER          8005        //InsufficientBuffer = 5,
#define ZBR_GDI_ERROR_NOT_IMPLEMENTED              8006        //NotImplemented    = 6,
#define ZBR_GDI_ERROR_WIN32_ERROR                  8007        //Win32Error        = 7,
#define ZBR_GDI_ERROR_WRONG_STATE                  8008        //WrongState        = 8,
#define ZBR_GDI_ERROR_ABORTED                      8009        //Aborted            = 9,
#define ZBR_GDI_ERROR_FILE_NOT_FOUND              8010        //FileNotFound      = 10,
#define ZBR_GDI_ERROR_VALUE_OVERFLOW              8011        //ValueOverflow      = 11,
#define ZBR_GDI_ERROR_ACCESS_DENIED                8012        //AccessDenied      = 12,
#define ZBR_GDI_ERROR_UNKNOWN_IMAGE_FORMAT        8013        //UnknownImageFormat = 13,
#define ZBR_GDI_ERROR_FONT_FAMILY_NOT_FOUND        8014        //FontFamilyNotFound = 14,
#define ZBR_GDI_ERROR_FONT_STYLE_NOT_FOUND        8015        //FontStyleNotFound  = 15,
#define ZBR_GDI_ERROR_NOT_TRUE_TYPE_FONT          8016        //NotTrueTypeFont    = 16,
#define ZBR_GDI_ERROR_UNSUPPORTED_GDIPLUS_VERSION  8017        //UnsupportedGdiplusVersion = 17,
#define ZBR_GDI_ERROR_GDIPLUS_NOT_INITIALIZED      8018        //GdiplusNotInitialized    = 18,
#define ZBR_GDI_ERROR_PROPERTY_NOT_FOUND          8019        //PropertyNotFound    = 19,
#define ZBR_GDI_ERROR_PROPERTY_NOT_SUPPORTED      8020        //PropertyNotSupported = 20

#define ZBR_GDI_ERROR_GRAPHICS_ALREADY_INITIALIZED 8021
#define ZBR_GDI_ERROR_NO_GRAPHIC_DATA              8022
#define ZBR_GDI_ERROR_GRAPHICS_NOT_INITIALIZED    8023

// Print Dialog Error Codes
#define ZBR_DLG_ERROR_DLG_CANCELED                                  8025        //User closed or canceled the dlg window
#define ZBR_DLG_ERROR_SETUP_FAILURE                              8026        //PrintDlg function failed to load the required resources.
#define ZBR_DLG_ERROR_PARSE_FAILURE                              8027        //PrintDlg function failed to parse the strings in the
                                                                                                                //[devices] section of the WIN.INI file.
#define ZBR_DLG_ERROR_RET_DEFAULT_FAILURE          8028        //PD_RETURNDEFAULT flag was specified in the Flags member of
                                                                                                                //the PRINTDLG structure, but the hDevMode or hDevNames member was not NULL
#define ZBR_DLG_ERROR_LOAD_DRV_FAILURE 8029 //PrintDlg function failed to load the device driver for the specified printer.
#define ZBR_DLG_ERROR_GET_DEVMODE_FAIL                      8030        //printer driver failed to initialize a DEVMODE structure.
#define ZBR_DLG_ERROR_INIT_FAILURE                                  8031        //PrintDlg function failed during initialization, and there is no more specific
                                                                                                                //extended error code to describe the failure.
#define ZBR_DLG_ERROR_NO_DEVICES                                  8032        //No printer drivers were found.
#define ZBR_DLG_ERROR_NO_DEFAULT_PRINTER          8033        //A default printer does not exist.
#define ZBR_DLG_ERROR_DN_DM_MISMATCH                          8034        //data in the DEVMODE and DEVNAMES structures describes two different printers.
#define ZBR_DLG_ERROR_CREATE_IC_FAILURE 8035 //PrintDlg function failed when it attempted to create an information context.
#define ZBR_DLG_ERROR_PRINTER_NOT_FOUND 8036 //The [devices] section of the WIN.INI file did not contain an entry for the requested printer.
#define ZBR_DLG_ERROR_DEFAULT_DIFFERENT 8037 //error occurs when you store the DEVNAMES structure and the user changes the default printer by using the Control Panel.

#define ZBR_ERROR_NO_ERROR                                                                                0
#define ZBR_SDK_ERROR_PRINTER_NOT_SUPPORTED                                                60
#define ZBR_SDK_ERROR_CANNOT_GET_PRINTER_HANDLE                                        61
#define ZBR_SDK_ERROR_CANNOT_GET_PRINTER_DRIVER                                        62
#define ZBR_SDK_ERROR_INVALID_PARAMETER                                                        63
#define ZBR_SDK_ERROR_PRINTER_BUSY                                                                64
#define ZBR_SDK_ERROR_INVALID_PRINTER_HANDLE                                        65
#define ZBR_SDK_ERROR_CLOSE_HANDLE_ERROR                                                66
#define ZBR_SDK_ERROR_COMMUNICATION_ERROR                                                67
#define ZBR_SDK_ERROR_BUFFER_OVERFLOW                                                        68
#define ZBR_SDK_ERROR_READ_DATA_ERROR                                                        69
#define ZBR_SDK_ERROR_WRITE_DATA_ERROR                                                        70
#define ZBR_SDK_ERROR_LOAD_LIBRARY_ERROR                                                71

#define ZBR_SDK_ERROR_INVALID_STRUCT_ALIGNMENT                                        72
#define ZBR_SDK_ERROR_GETTING_DEVICE_CONTEXT                                        73
#define ZBR_SDK_ERROR_SPOOLER_ERROR                                                                74
#define ZBR_SDK_ERROR_OUT_OF_MEMORY                                                                75
#define ZBR_SDK_ERROR_OUT_OF_DISK_SPACE                                                        76
#define ZBR_SDK_ERROR_USER_ABORT                                                                77
#define ZBR_SDK_ERROR_APPLICATION_ABORT                                                        78
#define ZBR_SDK_ERROR_CREATE_FILE_ERROR                                                        79
#define ZBR_SDK_ERROR_WRITE_FILE_ERROR                                                        80
#define ZBR_SDK_ERROR_READ_FILE_ERROR                                                        81

#define ZBR_SDK_ERROR_UNKNOWN_ERROR                                                                0xFFFF


shabbir 9May2009 20:14

Re: Help me Master "Develop SDK for printer"
 
Avoid DLL as attachment and its removed.


All times are GMT +5.5. The time now is 14:31.