//*****************************************************************************
// Labwindows/cvi8.5 进度条控件
// szlihongtao
// 2010-08-03
//*****************************************************************************
#include "MSCOMCTL.h"
#include <cvirte.h>
#include <userint.h>
#include "progressbar.h"
//*****************************************************************************
static CAObjHandle objecthandle;
static int panelHandle;
//*****************************************************************************
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "progressbar.uir", PANEL)) < 0)
return -1;
GetObjHandleFromActiveXCtrl (panelHandle, PANEL_PROGRESSBAR, &objecthandle);
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
}
//*****************************************************************************
int CVICALLBACK panelCB (int panel, int event, void *callbackData,
int eventData1, int eventData2)
{
switch (event)
{
case EVENT_CLOSE:
QuitUserInterface (0);
break;
}
return 0;
}
//*****************************************************************************
int CVICALLBACK timer (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
static float pfvalue=2;
static int tmr;
switch (event)
{
case EVENT_TIMER_TICK:
{
SetCtrlVal(panel,PANEL_NUMERIC,++tmr);
//设置进度条的最小值
MSComctlLib_IProgressBarSetMin (objecthandle, NULL, 0.0);
//设置进度条的最大值
MSComctlLib_IProgressBarSetMax (objecthandle, NULL, 21.0);
//设置进度条上的鼠标显示模式
MSComctlLib_IProgressBarSetMousePointer (objecthandle, NULL, MSComctlLibConst_ccHourglass);
MSComctlLib_IProgressBarSetValue (objecthandle, NULL, pfvalue);
//设置递增进度
pfvalue+=2;
break;
}
}
return 0;
}
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
用户560734 2013-11-16 17:47
用户883410 2013-5-18 23:24