原创 Labwindows/cvi8.5 实现基本的打印功能

2010-6-12 14:04 4091 8 8 分类: 软件与OS

https://static.assets-stash.eet-china.com/album/old-resources/2010/6/5/8ef955ca-b849-4299-a9c0-f5297bb5dffa.RAR//************************************************************
// Labwindows/cvi8.5 实现基本的打印功能
// szlihongtao
// 2010-06-04
//************************************************************
#include <cvirte.h>  
#include <userint.h>
#include <utility.h>  
#include "print.h"
//************************************************************
static int panelHandle;
//************************************************************
int main (int argc, char *argv[])
{
 if (InitCVIRTE (0, argv, 0) == 0)
  return -1; /* out of memory */
 if ((panelHandle = LoadPanel (0, "print.uir", PANEL)) < 0)
  return -1;
 DisplayPanel (panelHandle);
 RunUserInterface ();
 DiscardPanel (panelHandle);
 return 0;
}
//************************************************************
int CVICALLBACK QuitCallback (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 switch (event)
 {
  case EVENT_COMMIT:
   QuitUserInterface (0);
   break;
  default:
   break;
 }
 return 0;
}
//************************************************************
int CVICALLBACK Callback_print (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)

 static int f_led;
 
 switch (event)
 {
  case EVENT_COMMIT:
  {
   ++f_led;
   f_led&=0x01;
   SetCtrlVal (panelHandle,PANEL_LED,f_led);   // LED ON 
    
   SetPrintAttribute (ATTR_SYSTEM_PRINT_DIALOG_ONLY,1);   // 设置打印机的打样属性


   /* VAL_VISIBLE_AREA答应标题,滚动条,边框,菜单栏等等 */
   PrintPanel (panelHandle, "", 1, VAL_VISIBLE_AREA, 0);
   break; 
  }
  default:
   break;
 }
 return 0;
}   
//************************************************************
//************************************************************
//************************************************************

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
8
关闭 站长推荐上一条 /3 下一条