📄 stdafx.cpp
字号:
// stdafx.cpp : source file that includes just the standard includes
// alfa.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
WORD OUTPUT0,OUTPUT1,OUTPUT2,OUTPUT3;
CSkinDialog h_SkinDialog;
int spd_downminm;
int spd_downmins;
int spd_upminm;
int spd_upmins;
int spd_fwdminm;
int spd_fwdmins;
int spd_backminm;
int spd_backmins;
int spd_acrossin;
int spd_acrossout;
int spd_downmoutm;
int spd_downmout2m;
int spd_downmouts;
int spd_upmoutm;
int spd_upmouts;
unsigned int t_fwdminm,t_backminm,
t_upminm,t_downminm,t_holdm,t_vacsp,
t_vac,t_fwdmins,t_backmins,t_upmins,
t_downmins,t_nips,t_nipoffs,t_rej,
t_place,t_cutfwd,t_cutback,t_cut,
t_downmoutm,t_upmoutm;
unsigned int msgalm, dataflg, JogAlarm, WarnAlarm;
unsigned int OTAlarm, IOAlarm, ACTAlarm;
unsigned int BeepOnce;
double codposmx, codposmy, codposmz, codpossx, codpossz;
double codtmx, codtmy, codtmz, codtsx, codtsy, codtsz;
double unit0, unit1, unit2, unit3, unit4;//,div;
double gr0,gr1,gr2,gr3,gr4;
double MXSOT_Plus, MXSOT_Minus, MZSOT_Plus, MZSOT_Minus, YSOT_Plus, YSOT_Minus,
SXSOT_Plus, SXSOT_Minus, SZSOT_Plus, SZSOT_Minus;
double MX_AccTime, MX_DecTime, MZ_AccTime, MZ_DecTime, Y_AccTime, Y_DecTime,
SX_AccTime, SX_DecTime, SZ_AccTime, SZ_DecTime;
double msafepos, mytsafepos, mypsafepos; // Safe Pos.
double AcrossZH;
double NG_XPos, NG_ZPos, NG_YPos;
double QC_XPos, QC_ZPos, QC_YPos;
double Side_Wait_Timer, Vac_Chk_Timer;
CString MakerDate;
int actsel;
int zactsel;
int yactsel;
int mxminlit,mxmaxlit;
int mzminlit,mzmaxlit;
int msyminlit,msymaxlit;
int sxminlit,sxmaxlit;
int szminlit,szmaxlit;
int mzsafflg,szsafflg;
int msytakflg,msyplcflg;
int mxstpflg;
int mzstpflg;
int msystpflg;
int sxstpflg;
int szstpflg;
int teatovflg;
int autoovflg;
int nErrorCount;
int HomeOKflg, JogDir, JogSpeed, DataChanged;
int unit0a, unit1a, unit2a, unit3a, unit4a;//,div;
int Save_Flag, DiagID;
int Demo_Flag;
int GFixStep, GTimeCount, GInputData;
int QC_MoldSet, NG_QC_Flag;
int QC_Num, NG_Num;
int FileDataType;
int Buzzer;
int ServoLagMX, ServoLagMZ, ServoLagMSY, ServoLagSX, ServoLagSZ, Int_Count;
int CurLagMX, CurLagMZ, CurLagMSY, CurLagSX, CurLagSZ;
int MoldOpen_Flag;
int TryRun_Flag;
int Side_Correct;
int AlarmLagMX, AlarmLagMZ, AlarmLagMSY, AlarmLagSX, AlarmLagSZ;
// Global Data & Log
int ModeSys; // m_Valid
int MoldCountCur; // m_MoldCount
int MoldCountSet; // m_MoldTotal
int MoldSet; // m_MoldSet New
int MoldStack1; // m_MoldStack1 New
int MoldStack2; // m_MoldStack2 New
int MoldReserv1; // m_Reserved1, Stack1/2 Z Speed
int MoldReserv2; // m_Reserved2
int MoldReserv3; // m_Reserved3, Buzzer On/Off
CString FileNameSys; // m_num
int AlmLogIndex; // m_LogIndex
unsigned int AlmLogTime[50]; // m_LogTime[50]
unsigned int AlmLogID[50]; // m_LogID[50]
void ShowTransparentBitmap(CDC * pdc, UINT nIDBitmap, int x, int y)
{
CDC dcSrc,dcTemp,dcMask;
dcSrc.CreateCompatibleDC(pdc);
dcTemp.CreateCompatibleDC(pdc);
dcMask.CreateCompatibleDC(pdc);
CBitmap bmSrc,bmTemp,bmMask;
bmSrc.LoadBitmap(nIDBitmap);
BITMAP bm;
bmSrc.GetBitmap(&bm);
bmMask.CreateBitmap(bm.bmWidth,bm.bmHeight,1,1,NULL);
bmTemp.CreateCompatibleBitmap(pdc,bm.bmWidth,bm.bmHeight);
CBitmap * poldTemp,* poldMask,* poldSrc;
poldTemp=dcTemp.SelectObject(&bmTemp);
poldMask=dcMask.SelectObject(&bmMask);
poldSrc=dcSrc.SelectObject(&bmSrc);
dcTemp.BitBlt(0,0,bm.bmWidth,bm.bmHeight,pdc,0,0,SRCCOPY);
dcSrc.SetBkColor(RGB(255,0,255));
dcMask.BitBlt(0,0,bm.bmWidth,bm.bmHeight,&dcSrc,0,0,SRCCOPY);
dcTemp.BitBlt(0,0,bm.bmWidth,bm.bmHeight,&dcSrc,0,0,SRCINVERT);
dcTemp.BitBlt(0,0,bm.bmWidth,bm.bmHeight,&dcMask,0,0,SRCAND);
dcTemp.BitBlt(0,0,bm.bmWidth,bm.bmHeight,&dcSrc,0,0,SRCINVERT);
pdc->BitBlt(x,y,bm.bmWidth,bm.bmHeight,&dcTemp,0,0,SRCCOPY);
dcTemp.SelectObject(poldTemp);
dcMask.SelectObject(poldMask);
dcSrc.SelectObject(poldSrc);
}
BOOL ShowJpeg(CDC *pDC, char * lpName, char * lpType, int x, int y)
{
HGLOBAL hRes;
HRSRC hResInfo;
HINSTANCE insApp=AfxGetInstanceHandle();
hResInfo=FindResource(insApp, lpName, lpType);
hRes=LoadResource(insApp, hResInfo);
DWORD dwSize=SizeofResource(insApp, hResInfo);
HGLOBAL hGlobal=GlobalAlloc(GMEM_MOVEABLE|GMEM_NODISCARD, dwSize);
char * pDest=(char *)(GlobalLock(hGlobal));
char * pSrc=(char *)(LockResource(hRes));
CopyMemory(pDest, pSrc, dwSize);
FreeResource(hRes);
GlobalUnlock(hGlobal);
IStream * pStm;
CreateStreamOnHGlobal(hGlobal, TRUE,&pStm);
IPicture * pPic;
if(OleLoadPicture(pStm, dwSize, TRUE, IID_IPicture, (LPVOID*)&pPic)!=S_OK) {
pStm->Release();
GlobalFree(hGlobal);
return FALSE;
}
pStm->Release();
long hmWidth, hmHeight;
pPic->get_Width(&hmWidth);
pPic->get_Height(&hmHeight);
long fx, fy;
fx=MulDiv(hmWidth, pDC->GetDeviceCaps(LOGPIXELSX), 2540);
fy=MulDiv(hmHeight, pDC->GetDeviceCaps(LOGPIXELSY), 2540);
if(pPic->Render(*pDC,x,y,fx,fy,0,hmHeight,hmWidth,-hmHeight,NULL)!=S_OK) {
pPic->Release();
GlobalFree(hGlobal);
return FALSE;
}
pPic->Release();
GlobalFree(hGlobal);
return TRUE;
}
void DrawTransparent(int x, int y, CDC *pDC, CBitmap *pBitmap, COLORREF Color)
{
BITMAP bm;
pBitmap->GetObject( sizeof( BITMAP ), &bm );
CDC ImageDC;
ImageDC.CreateCompatibleDC( pDC );
CBitmap *pOldImageBitmap = ImageDC.SelectObject( pBitmap );
CDC MaskDC;
MaskDC.CreateCompatibleDC( pDC );
CBitmap MaskBitmap;
MaskBitmap.CreateBitmap( bm.bmWidth, bm.bmHeight, 1, 1, NULL );
CBitmap *pOldMaskBitmap = MaskDC.SelectObject( &MaskBitmap );
ImageDC.SetBkColor( Color );
MaskDC.BitBlt( 0, 0, bm.bmWidth, bm.bmHeight, &ImageDC, 0, 0, SRCCOPY );
CDC OrDC;
OrDC.CreateCompatibleDC( pDC );
CBitmap OrBitmap;
OrBitmap.CreateCompatibleBitmap( &ImageDC, bm.bmWidth, bm.bmHeight );
CBitmap *pOldOrBitmap = OrDC.SelectObject( &OrBitmap );
OrDC.BitBlt( 0, 0, bm.bmWidth, bm.bmHeight, &ImageDC, 0, 0, SRCCOPY );
OrDC.BitBlt( 0, 0, bm.bmWidth, bm.bmHeight, &MaskDC, 0, 0, 0x220326 );
CDC TempDC;
TempDC.CreateCompatibleDC( pDC );
CBitmap TempBitmap;
TempBitmap.CreateCompatibleBitmap( &ImageDC, bm.bmWidth, bm.bmHeight );
CBitmap *pOldTempBitmap = TempDC.SelectObject( &TempBitmap );
TempDC.BitBlt( 0, 0, bm.bmWidth, bm.bmHeight, pDC, x, y, SRCCOPY );
TempDC.BitBlt( 0, 0, bm.bmWidth, bm.bmHeight, &MaskDC, 0, 0, SRCAND );
TempDC.BitBlt( 0, 0, bm.bmWidth, bm.bmHeight, &OrDC, 0, 0, SRCPAINT );
pDC->BitBlt( x, y, bm.bmWidth, bm.bmHeight, &TempDC, 0, 0, SRCCOPY );
TempDC.SelectObject( pOldTempBitmap );
OrDC.SelectObject( pOldOrBitmap );
MaskDC.SelectObject( pOldMaskBitmap );
ImageDC.SelectObject( pOldImageBitmap );
}
/*void _stdcall RIO_ISR_Function(RIOINT_EX *pstINTSource)
{
if (pstINTSource->SET0_FAIL)// check whether any transmission error occurs
nErrorCount++;
}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -