| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1213 人关注过本帖
标题:一个关于C++中动态链接库的问题
只看楼主 加入收藏
lxqlyld
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:116
专家分:125
注 册:2012-6-18
结帖率:85.29%
收藏
已结贴  问题点数:20 回复次数:1 
一个关于C++中动态链接库的问题
下面是小弟写的POS打印机动态链接库程序,第一次写,感觉也写的不对,请问各位高手能不能帮看一下,该如何修改,同时给点写动态库的建议,非常感谢
#include<iostream.h>
#include <vcl.h>
#include <windows.h>
#pragma hdrstop

#pragma argsused
#ifdef DLL_H
extern "C"__declspec (dllexport)HANDLE POS_Open(
LPCTSTR lpName,
int nComBaudrate,
int nComDataBits,
int nComStopBits,
int nComParity,
int nParam);
extern "C"__declspec (dllexport)HANDLE POS_Open(
LPCTSTR lpName,
int nComBaudrate,
int nComDataBits,
int nComStopBits,
int nComParity,
int nParam);
extern "C"__declspec (dllexport)int POS_Close(void);
extern "C"__declspec (dllexport)int POS_Reset(void);
extern "C"__declspec (dllexport)int POS_SetMode(int nPrintMode);
extern "C"__declspec (dllexport)int POS_SetMotionUnit(int nHorizontalMU,int nVerticalMU );
extern "C"__declspec (dllexport)int POS_SetCharSetAndCodePage(int nCharSet,int nCodePage);
extern "C"__declspec (dllexport)int POS_FeedLine(void);
extern "C"__declspec (dllexport)int POS_SetLineSpacing(int nDistance);
extern "C"__declspec (dllexport)int POS_SetRightSpacing(int nDistance);
extern "C"__declspec (dllexport)int POS_PreDownloadBmpToRAM(char *pszPath,int nID);
extern "C"__declspec (dllexport)int POS_PreDownloadBmpsToFlash(char* pszPaths[],int nCount);
extern "C"__declspec (dllexport)int POS_RTQueryStatus(char *pszStatus);
extern "C"__declspec (dllexport)int POS_QueryStatus(char *pszStatus,int nTimeouts);
extern "C"__declspec (dllexport)int POS_NETQueryStatus(char *ipAddress,char *pszStatus);
extern "C"__declspec (dllexport)int POS_KickOutDrawer(int nID,int nOnTimes,int nOffTimes);
extern "C"__declspec (dllexport)int POS_CutPaper(int nMode,int nDistance);
extern "C"__declspec (dllexport)bool POS_StartDoc();
extern "C"__declspec (dllexport)bool POS_EndDoc();
extern "C"__declspec (dllexport)void POS_BeginSaveFile(LPCTSTR lpFileName,bool bToPrinter);
extern "C"__declspec (dllexport)void POS_EndSaveFile();
extern "C"__declspec (dllexport)int POS_S_SetAreaWidth(int nWidth);
extern "C"__declspec (dllexport)int POS_S_TextOut(
char *pszString,
int nOrgx,
int nWidthTimes,
int nHeightTimes,
int nFontType,
int nFontStyle);
extern "C"__declspec (dllexport)int POS_S_DownloadAndPrintBmp(char *pszPath,int nOrgx,int nMode);
extern "C"__declspec (dllexport)int POS_S_PrintBmpInRAM(int nID,int nOrgx,int nMode);
extern "C"__declspec (dllexport)int POS_S_PrintBmpInFlash(int nID,int nOrgx,int nMode);
extern "C"__declspec (dllexport)int POS_S_SetBarcode(
char *pszInfoBuffer,
int nOrgx,
int nType,
int nWidthX,
int nHeight,
int nHriFontType,
int nHriFontPosition,
int nBytesToPrint);
extern "C"__declspec (dllexport)int POS_PL_SetArea(int nOrgx,int nOrgy,int nWidth,int nHeight,int nDirection);
extern "C"__declspec (dllexport)int POS_PL_TextOut(
char *pszString,
int nOrgx,
int nOrgy,
int nWidthTimes,
int nHeightTimes,
int nFontType,
int nFontStyle);
extern "C"__declspec (dllexport)int POS_PL_DownloadAndPrintBmp(char *pszPath,int nOrgx,int nOrgy,int nMode);
extern "C"__declspec (dllexport)int POS_PL_PrintBmpInRAM(int nID,int nOrgx,int nOrgy,int nMode);
extern "C"__declspec (dllexport)int POS_PL_SetBarcode(
char *pszInfoBuffer,
int nOrgx,
int nOrgy,
int nType,
int nWidthX,
int nHeight,
int nHriFontType,
int nHriFontPosition,
int nBytesToPrint );
extern "C"__declspec (dllexport)int POS_PL_Print(void);
extern "C"__declspec (dllexport)int POS_PL_Clear(void);
extern "C"__declspec (dllexport)int POS_WriteFile(HANDLE hPort,char *pszData,int nBytesToWrite);
extern "C"__declspec (dllexport)int POS_ReadFile(HANDLE hPort,char *pszData,int nBytesToRead,int nTimeouts);
extern "C"__declspec (dllexport)HANDLE POS_SetHandle(HANDLE hNewHandle);
extern "C"__declspec (dllexport)int POS_GetVersionInfo(int *pnMajor,int *pnMinor);
#endif /* Not BUILDING_DLL */
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, LPVOID lpvReserved)
{
   switch (fwdreason)
    {
      case DLL_PROCESS_ATTACH:
        break;

      case DLL_PROCESS_DETACH:
        break;

      case DLL_THREAD_ATTACH:
        break;

      case DLL_THREAD_DETACH:
        break;
    }
return 1;
}
//---------------------------------------------------------------------------
#include <iostream.h>
using namespace std;

#pragma hdrstop
#pragma argsused
#define POS_SUCCESS 1001
#define POS_FAIL 1002
#define POS_ERROR_INVALID_HANDLE 1101
#define POS_ERROR_INVALID_PARAMETER 1102
#define POS_ERROR_NOT_BITMAP 1103
#define POS_ERROR_NOT_MONO_BITMAP 1104
#define POS_ERROR_BEYONG_AREA 1105
#define POS_ERROR_INVALID_PATH 1106
#define    hinstDLL  1
#if BUILDING_DLL
#define DLLEXPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
#define DLLEXPORT __declspec (dllimport)
#endif  /* _DLL_H_ */
class DLLEXPORT DllClass
{

   public:
    DllClass();
    virtual ~DllClass(void);







//打开端口,建立与打印机的通信连接
HANDLE POS_Open(
LPCTSTR lpName,
int nComBaudrate,
int nComDataBits,
int nComStopBits,
int nComParity,
int nParam)
{

    nComStopBits>=5&&nComStopBits<=8;

  switch(nComBaudrate){
          case 1200:case 2400:case 4800:case 9600:case 14400:case 19200:case 38400:case 56000:case 57600:
           cout<<"波特率"<<'\n';
           }
//指定串口通讯时数据停止位   
switch(nComStopBits){
                       case 0x00:
                       cout<<"停止位为1"<<'\n';break;
                       case 0x01:
                       cout<<"停止位为1.5"<<'\n'; break;
                       case 0x02:
                       cout<<"停止位为2"<<'\n'; break;
                       }
//指定串口的奇偶校验方法  
switch(nComParity){
                    case 0x00:
                         cout<<"无校验"<<'\n';break;
                    case 0x01:
                         cout<<"奇校验"<<'\n';break;
                    case 0x02:
                         cout<<"偶校验"<<'\n';break;
                    case 0x03:
                         cout<<"标记校验"<<'\n';break;
                    case 0x04:
                         cout<<"空格校验"<<'\n';break;
                    }
//指定串口的流控制(握手)方式、或表示通讯方式   
switch(nParam){
                  case 0x00:
                       cout<<"流控制为DTR/DST"<<'\n';break;
                  case 0x01:
                       cout<<"流控制为RTS/CTS"<<'\n';break;
                  case 0x02:
                       cout<<"流控制为XON/OFF"<<'\n';break;
                  case 0x03:
                       cout<<"无握手"<<'\n';break;
                  case 0x12:
                       cout<<"打开并口通讯端口"<<'\n';
                       nComBaudrate=0;
                       nComDataBits=0;
                       nComStopBits=0;
                       nComParity=0;
                       break;
                  case 0x13:
                       cout<<"打开USB通讯端口"<<'\n';break;
                  case 0x14:
                       cout<<"打开打印机驱动程序"<<'\n';break;
                  case 0x15:
                       cout<<"打开网络接口"<<'\n';break;}
    if(lpName)
    return INVALID_HANDLE_VALUE;
return hinstDLL;//该函数调用成功,返回一个已经打开的端口句柄;如果函数调用失败,返回值为 INVALID_HANDLE_VALUE (-1)


        }

//关闭串口
int POS_Close(void)
{
            return 1;
}
//复位打印机
int POS_Reset(void)
{
            return POS_SUCCESS;
}
//设置打印机的打印模式以及出纸模式
int POS_SetMode(int nPrintMode)
{
            switch(nPrintMode){
                              case 0x00:
                                   cout<<"标准模式(行模式)"<<'\n';break;
                              case 0x01:
                                   cout<<"页模式"<<'\n';break;
                              case 0x02:
                                   cout<<"黑标记标签模式"<<'\n';break;
                              case 0x03:
                                   cout<<"白标记标签模式"<<'\n';break;
                                   }
      if(nPrintMode>=0x00&&nPrintMode<=0x03)
      return POS_SUCCESS;
      else return POS_FAIL;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE,POS_ERROR_INVALID_PARAMETER
           }
//设置打印机的水平和垂直方向的移动单位
int POS_SetMotionUnit(int nHorizontalMU,int nVerticalMU )
{
      nHorizontalMU>=0&&nHorizontalMU<=255;
      nVerticalMU>=0&&nVerticalMU<=255;
return POS_SUCCESS;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE,POS_ERROR_INVALID_PARAMETER
}
//设置字符集和代码页
int POS_SetCharSetAndCodePage(int nCharSet,int nCodePage)
{
           switch(nCharSet){
                           case 0x00:
                                cout<<"U.S.A"<<'\n';break;
                           case 0x01:
                                cout<<"France"<<'\n';break;
                           case 0x02:
                                cout<<"Germany"<<'\n';break;
                           case 0x03:
                                cout<<"U.K."<<'\n';break;
                           case 0x04:
                                cout<<"DenmarkI"<<'\n';break;
                           case 0x05:
                                cout<<"Sweden"<<'\n';break;
                           case 0x06:
                                cout<<"Italy"<<'\n';break;
                           case 0x07:
                                cout<<"Spain I"<<'\n';break;
                           case 0x08:
                                cout<<"Japan"<<'\n';break;
                           case 0x09:
                                cout<<"Nonway"<<'\n';break;
                           case 0x0A:
                                cout<<"Denmark II"<<'\n';break;
                           case 0x0B:
                                cout<<"Spain II"<<'\n';break;
                           case 0x0C:
                                cout<<"Latin America"<<'\n';break;
                           case 0x0D:
                                cout<<"Korea"<<'\n'; break;
                                }
           switch(nCodePage){
                            case 0x00:
                                 cout<<"PC437 [U.S.A. Standard Europe]"<<'\n';break;
                            case 0x01:
                                 cout<<"Reserved"<<'\n';break;
                            case 0x02:
                                 cout<<"PC850 [Multilingual]"<<'\n';break;
                            case 0x03:
                                 cout<<"PC860 [Portuguese]"<<'\n';break;
                            case 0x04:
                                 cout<<"PC863 [Canadian-French]"<<'\n';break;
                            case 0x05:
                                 cout<<"PC865 [Nordic]"<<'\n';break;
                            case 0x12:
                                 cout<<"PC852"<<'\n';break;
                            case 0x13:
                                 cout<<"PC858"<<'\n';break;
                                 }
           return POS_SUCCESS;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE,POS_ERROR_INVALID_PARAMETER
}
//打印机向前走纸
int POS_FeedLine(void)
 {
            return  POS_SUCCESS;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE
}
//设置字符行高
int POS_SetLineSpacing(int nDistance)
{
             nDistance>=0&&nDistance<=255;
             return POS_SUCCESS;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE,POS_ERROR_INVALID_PARAMETER
}
 //设置字符右间距
int POS_SetRightSpacing(int nDistance)
{
       nDistance>=0&&nDistance<=255;
       return POS_SUCCESS;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE,POS_ERROR_INVALID_PARAMETER
}
//预下载一幅位图到打印机的 RAM 中,同时指定此位图的 ID 号
int POS_PreDownloadBmpToRAM(char *pszPath,int nID)
{
           nID>=0&&nID<=7;
           return POS_SUCCESS;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE,POS_ERROR_INVALID_PARAMETER
}
//预下载一幅或若干幅位图到打印机的 Flash 中
int POS_PreDownloadBmpsToFlash(char* pszPaths[],int nCount)
{
           nCount>=1&&nCount<=255;
           return POS_SUCCESS;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE,POS_ERROR_INVALID_PARAMETER
}
//通过串口查询当前打印机的状态,此函数式非实时的
int POS_QueryStatus(char *pszStatus,int nTimeouts)
{
       pszStatus=(char*)malloc(1);
       nTimeouts=2;
       return  POS_SUCCESS;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE
}
//通过串口返回打印机当前的状态,此函数为实时的
int POS_RTQueryStatus(char *pszStatus)
{
           pszStatus=(char*)malloc(1);
           return POS_SUCCESS;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE
}
//查询网络设备状态
int POS_NETQueryStatus(char *ipAddress,char *pszStatus)
{
           pszStatus=(char*)malloc(1);
           return POS_SUCCESS;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE
}
 //打开钱箱
int POS_KickOutDrawer(int nID,int nOnTimes,int nOffTimes)
{
            switch(nID){
            case 0x00:
            cout<<"钱箱连接引脚2"<<'\n';break;
            case 0x01:
            cout<<"钱箱连接引脚2"<<'\n';break;
            }
            nOnTimes>=1&&nOnTimes<=255;
            nOnTimes=nOnTimes*2;
            nOffTimes>=1&&nOffTimes<=255;
            nOffTimes=nOffTimes*2;
            if(nOffTimes<nOnTimes)
            nOffTimes=nOnTimes*2;
          return POS_SUCCESS;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE,POS_ERROR_INVALID_PARAMETER
}
//切纸
int POS_CutPaper(int nMode,int nDistance)
{
           switch(nMode){
                        case 0x00:
                             cout<<"全切"<<'\n';break;
                        case 0x01:
                             cout<<"半切"<<'\n';break;
                             }
           nDistance>=0&&nDistance<=255;//如果函数成功,则返回值为 POS_SUCCESS。如果函数失败,则返回值为以下值之一:POS_FAIL,POS_ERROR_INVALID_HANDLE,POS_ERROR_INVALID_PARAMETER
//开始一个打印作业
bool POS_StartDoc();
{
return true;//如果函数成功,为TRUE;否则为FALSE
           }
//结束一个打印作业
bool POS_EndDoc()//如果函数成功,为TRUE;否则为FALSE
//将数据写入文件
void POS_BeginSaveFile(LPCTSTR lpFileName,bool bToPrinter)
{
  return;
}
//结束返回文件操作
void POS_EndSaveFile()
{
 return;
}

//标准模式打印函数
//设置标准模式下的打印区域宽度
int POS_S_SetAreaWidth(int nWidth)
{
           nWidth>=0&&nWidth<=65535;
    return POS_SUCCESS;
}


//打印文本
int POS_S_TextOut(
char *pszString,
int nOrgx,
int nWidthTimes,
int nHeightTimes,
int nFontType,
int nFontStyle)
{
   char ia[];
   char *pszString=ia;
   nOrgx>=0&&nOrgx<=65535;
   nWidthTimes>=1&&nWidthTimes<=6;
   nHeightTimes>=1&&<=6;
   switch(nFontType){
                    case 0x00:
                         cout<<"标准 ASCII"<<'\n';break;
                    case 0x01:
                         cout<<"压缩 ASCII"<<'\n';break;
                    case 0x02:
                         cout<<"用户自定义字符"<<'\n';break;
                    case 0x03:
                         cout<<"标准 “宋体”"<<'\n';break;}
   switch(nFontStyle){
                     case 0x00:
                          cout<<"正常"<<'\n';break;
                     case 0x08:
                          cout<<"加粗"<<'\n';break;
                     case 0x80:
                          cout<<"1点粗的下划线"<<'\n';break;
                     case 0x100:
                          cout<<"2点粗的下划线"<<'\n';break;
                     case 0x200:
                          cout<<"倒置(只在行首有效)"<<'\n';break;
                     case 0x400:
                          cout<<"反显(黑底白字)"<<'\n';break;
                     case 0x800:
                          cout<<"平滑处理(用于放大时"<<'\n';break;
                     case 0x1000:
                          cout<<"每个字符顺时针旋转 90 度"<<'\n';break;
                          }
   return  POS_SUCCESS;

}
//下载并立即打印位图
int POS_S_DownloadAndPrintBmp(char *pszPath,int nOrgx,int nMode)
{
           nOrgx>=0&&nOrgx<=65535;
           switch(nMode){
                        case 0x00:
                             return POS_BITMAP_MODE_8SINGLE_DENSITY;break;
                        case 0x01:
                             return POS_BITMAP_MODE_8DOUBLE_DENSITY;break;
                        case 0x20:
                             return POS_BITMAP_MODE_24SINGLE_DENSITY;break;
                        case 0x21:
                             return POS_BITMAP_MODE_24DOUBLE_DENSITY;break;
                             }
          return  POS_SUCCESS;


           }
//打印已经下载到RAM中的位图
int POS_S_PrintBmpInRAM(int nID,int nOrgx,int nMode)
{
           nID>=0&&nID<=7;
           nOrgx>=0&&nOrgx<=65535;
           switch(nMode){
                        case 0x00:
                             return POS_BITMAP_PRINT_NORMAL;break;
                        case 0x01:
                             return POS_BITMAP_PRINT_DOUBLE_WIDTH;break;
                        case 0x02:
                             return POS_BITMAP_PRINT_DOUBLE_HEIGHT;break;
                        case 0x03:
                             return POS_BITMAP_PRINT_QUADRUPLE;break;
                             }
             return POS_SUCCESS;


              }
//打印已经下载到flash中的位图
int POS_S_PrintBmpInFlash(int nID,int nOrgx,int nMode)
{
          nID>=1&&nID<=255;
          nOrgx>=0&&nOrgx<=65535;
          switch(nMode){
                       case 0x00:
                            return POS_BITMAP_PRINT_NORMAL;break;
                       case 0x01:
                            return POS_BITMAP_PRINT_DOUBLE_WIDTH;break;
                       case 0x02:
                            return POS_BITMAP_PRINT_DOUBLE_HEIGHT;break;
                       case 0x03:
                            return POS_BITMAP_PRINT_QUADRUPLE;break;
                            }
        return  POS_SUCCESS;


          }
//设置并打印条码
int POS_S_SetBarcode(
char *pszInfoBuffer,
int nOrgx,
int nType,
int nWidthX,
int nHeight,
int nHriFontType,
int nHriFontPosition,
int nBytesToPrint)
{
    nOrgx>=0&&nOrgx<=65535;
    switch(nType){
                 case 0x41:
                      return POS_BARCODE_TYPE_UPC_A;break;
                 case 0x42:
                      return POS_BARCODE_TYPE_UPC_E;break;
                 case 0x43:
                      return POS_BARCODE_TYPE_JAN13;break;
                 case 0x44:
                      return POS_BARCODE_TYPE_JAN8;break;
                 case 0x45:
                      return POS_BARCODE_TYPE_CODE39;break;
                 case 0x46:
                      return POS_BARCODE_TYPE_ITF;break;
                 case 0x47:
                      return POS_BARCODE_TYPE_CODEBAR;break;
                 case 0x48:
                      return POS_BARCODE_TYPE_CODE93;break;
                 case 0x49:
                      return POS_BARCODE_TYPE_CODE128;break;
                      }
     nWidthX>=2&&nWidthX<=6;
     nHeight>=1&&nHeight<=255;
     if(nHeight=null)
     nHeight=162;
     switch(nHriFontType){
                         case 0x00:
                              return POS_FONT_TYPE_STANDARD;break;
                         case 0x01:
                              return POS_FONT_TYPE_COMPRESSED;break;
                              }
     switch(nHriFontPosition){
                             case 0x01:
                                  return POS_HRI_POSITION_NONE;break;
                             case 0x02:
                                  return POS_HRI_POSITION_ABOVE; break;
                             case 0x03:
                                  return POS_HRI_POSITION_BELOW;break;
                             case 0x04:
                                  return POS_HRI_POSITION_BOTH;break;
                                  }
           return  POS_SUCCESS;
}
//只支持页面打印模式或标签打印模式下的打印函数
//设置页面的打印区域
int POS_PL_SetArea(int nOrgx,int nOrgy,int nWidth,int nHeight,int nDirection)
{
           nOrgx>=0&&nOrgx<=65535;
           nOrgy>=0&&nOrgy<=65535;
           nWidth>=0&&nWidth<=65535;
           nHeight>=0&&nHeight<=65535;
           switch(nDirection){
                             case 0:
                                  return POS_AREA_LEFT_TO_RIGHT;break;
                             case 1:
                                  return POS_AREA_BOTTOM_TO_TOP;break;
                             case 2:
                                  return POS_AREA_RIGHT_TO_LEFT;break;
                             case 3:
                                  return POS_AREA_TOP_TO_BOTTOM;break;
                                  }
            return  POS_SUCCESS;


           }
//打印文本
int POS_PL_TextOut(
char *pszString,
int nOrgx,
int nOrgy,
int nWidthTimes,
int nHeightTimes,
int nFontType,
int nFontStyle)
{
    nOrgx>=0&&nOrgx<=65535;
    nOrgy>=0&&nOrgy<=65535;
    nWidthTimes>=1&&nWidthTimes<=6;
    nHeightTimes>=1&&nHeightTimes<=6;
    switch(nFontType){
                     case 0x00:
                          return POS_FONT_TYPE_STANDARD;break;
                     case 0x01:
                          return POS_FONT_TYPE_COMPRESSED;break;
                     case 0x02:
                          return POS_FONT_TYPE_UDC; break;
                     case 0x03:
                          return POS_FONT_TYPE_CHINESE;break;
                          }
    switch(nFontStyl){
                     case 0x00:
                          return POS_FONT_STYLE_NORMAL;break;
                     case 0x08:
                          return POS_FONT_STYLE_BOLD;break;
                     case 0x80:
                          return POS_FONT_STYLE_THIN_UNDERLINE;break;
                     case 0x100:
                          return POS_FONT_STYLE_THICK_UNDERLINE;break;
                     case 0x400:
                          return POS_FONT_STYLE_REVERSE;break;
                     case 0x800:
                          return POS_FONT_STYLE_SMOOTH;break;
                          }
           return  POS_SUCCESS;


           }
//下载并立即打印位图
int POS_PL_DownloadAndPrintBmp(char *pszPath,int nOrgx,int nOrgy,int nMode)
{
           nOrgx>=0&&nOrgx<=65535;
           nOrgy>=0&&nOrgy<=65535;
           switch(nMode){
                        case 0x00:
                             return POS_BITMAP_MODE_8SINGLE_DENSITY;break;
                        case 0x01:
                             return POS_BITMAP_MODE_8DOUBLE_DENSITY;break;
                        case 0x20:
                             return POS_BITMAP_MODE_24SINGLE_DENSITY;break;
                        case 0x21:
                             return POS_BITMAP_MODE_24DOUBLE_DENSITY;break;
                             }
            return  POS_SUCCESS;
}
//打印已经下载到RAM中的位图
int POS_PL_PrintBmpInRAM(int nID,int nOrgx,int nOrgy,int nMode)
{
           nID>=0&&nID<=7;
           nOrgx>=0&&nOrgx<=65535;
           nOrgy>=0&&nOrgy<=65535;
           switch(nMode){
                        case 0x00:
                             return POS_BITMAP_PRINT_NORMAL;break;
                        case 0x01:
                             return POS_BITMAP_PRINT_DOUBLE_WIDTH;break;
                        case 0x02:
                             return POS_BITMAP_PRINT_DOUBLE_HEIGHT;break;
                        case 0x03:
                             return POS_BITMAP_PRINT_QUADRUPLE;break;
                             }
          return  POS_SUCCESS;
}
//设置条码
int POS_PL_SetBarcode(
char *pszInfoBuffer,
int nOrgx,
int nOrgy,
int nType,
int nWidthX,
int nHeight,
int nHriFontType,
int nHriFontPosition,
int nBytesToPrint )
{
    nOrgx>=0&&nOrgx<=65535;
    nOrgy>=0&&nOrgy<=65535;
    switch(nType){
                 case 0x41:
                      return POS_BARCODE_TYPE_UPC_A;
                 case 0x42:
                      return POS_BARCODE_TYPE_UPC_E;
                 case 0x43:
                      return POS_BARCODE_TYPE_JAN13;
                 case 0x44:
                      return POS_BARCODE_TYPE_JAN8;
                 case 0x45:
                      return POS_BARCODE_TYPE_CODE39;
                 case 0x46:
                      return POS_BARCODE_TYPE_ITF;
                 case 0x47:
                      return POS_BARCODE_TYPE_CODEBAR;
                 case 0x48:
                      return POS_BARCODE_TYPE_CODE93;
                 case 0x49:
                      return POS_BARCODE_TYPE_CODE128;
                      }
     nHeight>=1&&nHeight<=255;
     if(nHriFontType=0x00)
     return POS_FONT_TYPE_STANDARD;
     else
         if(nHriFontType=0x01)
         return POS_FONT_TYPE_COMPRESSED;
     switch(nHriFontPosition){
                             case 0x00:
                                  return POS_HRI_POSITION_NONE;
                             case 0x01:
                                  return POS_HRI_POSITION_ABOVE;
                             case 0x02:
                                  return POS_HRI_POSITION_BELOW;
                             case 0x03:
                                  return POS_HRI_POSITION_BOTH;
                                  }
         return POS_SUCCESS;


           }
//打印页或标签缓冲区中的数据
int POS_PL_Print(void)
{
           return POS_SUCCESS;
}
//清除票面和标签的打印缓冲区中的数据
int POS_PL_Clear(void)
{
           return POS_SUCCESS;
}
//杂项,主主要用于调试和自定义控制函数使用
//往端口或文件写数据
int POS_WriteFile(HANDLE hPort,char *pszData,int nBytesToWrite)
{
          return POS_SUCCESS;
}
//从端口或文件读数据
int POS_ReadFile(HANDLE hPort,char *pszData,int nBytesToRead,int nTimeouts)
{
           return POS_SUCCESS;
}
//设置端口或文件的句柄
HANDLE POS_SetHandle(HANDLE hNewHandle)
{
    return POS_SUCCESS;
}
//获取 dll 的版本信息
int POS_GetVersionInfo(int *pnMajor,int *pnMinor)
{
           }



 private:

;};
搜索更多相关主题的帖子: 链接 动态 include 
2012-07-20 14:48
pangding
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:北京
等 级:贵宾
威 望:94
帖 子:6784
专家分:16751
注 册:2008-12-20
收藏
得分:20 
如果你自己没有任何头绪,相信也不会有人有时间或者有兴趣看这么长的代码。
2012-07-20 21:26
快速回复:一个关于C++中动态链接库的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.036830 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved