⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 screendlg.cpp

📁 一个很不错的
💻 CPP
📖 第 1 页 / 共 4 页
字号:
	  vector[i1]=0;
	  for (int j1=0;j1<5*4;j1=j1+4)
	  {
		    if (px1[i1*5*4+j1] == 0xff )
			   ispixel=1;
			else
			   ispixel=0;
		  vector[i1]=vector[i1]+ispixel;

		  }
 
  }

 for (int l=0;l<8;l++)
  {
	  s.Format("%d",vector[l]);
	  s_vector=s_vector+""+s;
  }
//AfxMessageBox(s_vector);
 return s_vector.Right(8);
}

CString project3( unsigned   char   *px1)
{//
int vector [9];
CString s_vector,s; 
int ispixel;
 
  for(int i1=0;i1<9;i1++)
  {
	  vector[i1]=0;
	  for (int j1=0;j1<5*4;j1=j1+4)
	  {
		    if (px1[i1*5*4+j1+2] == 0x80 )
			   ispixel=1;
			else
			   ispixel=0;
		  vector[i1]=vector[i1]+ispixel;

		  }
 
  }

 for (int l=0;l<9;l++)
  {
	  s.Format("%d",vector[l]);
	  s_vector=s_vector+""+s;
  }
//AfxMessageBox(s_vector);
 return s_vector.Right(9);
}

CString character2(CString vector)
{
   CString s="";
   if  (vector.Left(8)=="00000000")
	   s="";
   else if (vector.Left(8)=="32222223")
 	   s="0";
   else if (vector.Left(8)=="12111113")
	   	s="1";
    else if (vector.Left(8)=="32211115")
	   	s="2";
    else if (vector.Left(8)=="32121123")
	   	s="3";
    else if (vector.Left(8)=="12222412")
	   	s="4";
    else if (vector.Left(8)=="51141123")
	   	s="5";
    else if (vector.Left(8)=="32142223")
	   	s="6";
    else if (vector.Left(8)=="52111111")
	   	s="7";
    else if (vector.Left(8)=="32232223")
	   	s="8";
    else if (vector.Left(8)=="32224123")
	   	s="9";
	else if (vector.Left(8)=="00000001")
	   	s=".";
	return s;
}

CString character3(CString vector)
{
   CString s="";
   if  (vector.Left(9)=="000000000")
	   s="";
   else if (vector.Left(9)=="322222223")
 	   s="0";
   else if (vector.Left(9)=="122111111")
	   	s="1";
    else if (vector.Left(9)=="321111115")
	   	s="2";
    else if (vector.Left(9)=="321121123")
	   	s="3";
    else if (vector.Left(9)=="122222511")
	   	s="4";
    else if (vector.Left(9)=="411421123")
	   	s="5";
    else if (vector.Left(9)=="321332221")
	   	s="6";
    else if (vector.Left(9)=="511111111")
	   	s="7";
    else if (vector.Left(9)=="322232223")
	   	s="8";
    else if (vector.Left(9)=="322233123")
	   	s="9";
	else if (vector.Left(9)=="00000001")
	   	s=".";
	return s;
}


CString character(CString vector)
{
   CString s=" ";
   if  (vector.Right(10)=="00000000000")
	   s=" ";
   else if (vector.Left(10)=="4444444444")
       	if (vector.Right(1)=="0")
			s="0";
		else
			s="8";
    else if (vector.Left(10)=="2422222222")
	   	s="1";
    else if (vector.Left(10)=="4442222226")
	   	s="2";
    else if (vector.Left(10)=="4422322244")
	   	s="3";
    else if (vector.Left(10)=="2344444622")
	   	s="4";
    else if (vector.Left(10)=="6222542244")
	   	s="5";
    else if (vector.Left(10)=="4422544444")
	   	s="6";
    else if (vector.Left(10)=="6222222222")
	   	s="7";
    else if (vector.Left(10)=="4444452244")
	   	s="9";
	return s;
}

CString minute_add(CString s,int i)
{
	CString s1,s2,s3;
	int i1,i2;
	s1=s.Left(2);
	s2=s.Right(2);
    i1=atoi(s1.GetBuffer(0));
    i2=atoi(s2.GetBuffer(0));
	
	if (s=="15:00")
		return "09:31";
	if (s=="11:29")
		return "13:00";
	if ( i2+1<60 )
	{
        s3.Format("%d",i2+1);
		if (i2+1<=9)
		    return s1+":0"+s3;
		else
			return s1+":"+s3;
	   }
	else 
	{
	   if ( i1+1<24 )
	   {
		   s3.Format("%d",i1+1);
		   if (i1+1<=9)
			   return "0"+s3+":00";
		   else
	           return s3+":00";
	   }
	   else
		   return "00:00";
	   }
}

void CScreenDlg::OnButton2() 
{
	// TODO: Add your control notification handler code here
    CString title;
	GetDlgItem(IDC_BUTTON2)->GetWindowText(title);

    if (title=="停止运行")
	{
        GetDlgItem(IDC_BUTTON2)->SetWindowText("开始运行");
		KillTimer(IDT_TIMER);
//		_endthread();

	}
     else
	 {
        UpdateData();
	    GetDlgItem(IDC_BUTTON2)->SetWindowText("停止运行");
		SetTimer(IDT_TIMER, INITIAL_DELAY, NULL);
		_beginthread(read_data,0,this);
		_beginthread(read_data1,0,this);
		fresh_needed=2;

	 }
}

 CString arrow(unsigned char *px,int a,int b,int c)
 {
	 CString arrow="0";
	for (int i=0;i<c*b;i=i+4)
	  {
		if (px[i]==0x00 &&
			px[i+1]==0xFF &&
			px[i+2]==0x00 &&
			px[i+3]==0x00 &&
 			px[i+b]==0x00 &&
			px[i+b+1]==0xFF &&
 			px[i+b+2]==0x00 &&
			px[i+b+3]==0x00 &&
			px[i+b*2]==0x00 &&
			px[i+b*2+1]==0xFF &&
			px[i+b*2+2]==0x00 &&
			px[i+b*2+3]==0x00 )
			{
				arrow="1";
				return arrow;
			}
		if (px[i]==0x00 &&
			px[i+1]==0x00 &&
			px[i+2]==0xFF &&
			px[i+3]==0x00 &&
 			px[i+b]==0x00 &&
			px[i+b+1]==0x00 &&
 			px[i+b+2]==0xFF &&
			px[i+b+3]==0x00 &&
			px[i+b*2]==0x00 &&
			px[i+b*2+1]==0x00 &&
			px[i+b*2+2]==0xFF &&
			px[i+b*2+3]==0x00 )
			{
				arrow="2";
				return arrow;
			}
	}  
	return arrow;
}

void undo_trade()
{
    char sCaption[20];
	HWND hwnd1,hwnd2,hwnd3,hwnd4;
    hwnd1=hWnd2;
	GetLocalTime(&UnTradeTime);
	hwnd1=::GetWindow(hwnd1,GW_CHILD);
    hwnd1=::GetWindow(hwnd1,GW_CHILD);
    hwnd1=::GetWindow(hwnd1,GW_CHILD);
    for (int i11=0;i11<39;i11++)
	   hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
   hWnd_plcd=hwnd1;
   ::SendMessage(hWnd_plcd,BM_CLICK,0,0);
   Sleep(200);
   hwnd1=hWnd_plcd;
   hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
   hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
   hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
   hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
   hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
   hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
 //  hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
   hwnd1=::GetWindow(hwnd1,GW_CHILD);
   hwnd1=::GetWindow(hwnd1,GW_CHILD);
 	do 
	{
		::GetWindowText(hwnd1,sCaption,20);
		if ((CString)sCaption=="全部选择INS")
		  hwnd2=hwnd1;
		if ((CString)sCaption=="撤单F3")
		  hwnd3=hwnd1;
		if ((CString)sCaption=="返回ESC")
		  hwnd4=hwnd1;
		hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
	} while (hwnd1!=NULL) ;
   ::SendMessage(hwnd2,BM_CLICK,0,0); //全部选择
   Sleep(100);
//   hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
//   hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
//   hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
   ::SendMessage(hwnd3,BM_CLICK,0,0); //撤单
   Sleep(500);
   hwnd2=::FindWindow(NULL,"提示信息");
   if ( hwnd2 )
   {
	   hwnd2=::GetWindow(hwnd2,GW_CHILD);
	   ::PostMessage(hwnd2,BM_CLICK,0,0); //提示信息确定
   }
   Sleep(50);
//   hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
//   hwnd1=::GetNextWindow(hwnd1,GW_HWNDNEXT);
   ::PostMessage(hwnd4,BM_CLICK,0,0); //返回

   is_undo=0;
   fresh_needed=1;
   return;
}
  
void CScreenDlg::get_arrow()
{
 //分7部分来识别其中是否含有箭头 每部分为35+11
////////////////////////////////////////////////////
 int a=bm.bmWidth;
 int b=bm.bmWidthBytes;
 int c=bm.bmHeight;
 CString status_arrow="";

  for ( int i=0;i<c;i++)
	  for (int j=0;j<35*b/a;j++)
	  {
	  	  px2[i*35*b/a+j]=px[i*b+j];
	  }

  status_arrow=status_arrow+arrow(px2,35,35*4,c);

  for ( i=0;i<c;i++)
	  for (int j=0;j<35*b/a;j++)
	  {
	  	  px2[i*35*b/a+j]=px[i*b+46*4+j];
	  }
  status_arrow=status_arrow+arrow(px2,35,35*4,c);
  
  for ( i=0;i<c;i++)
	  for (int j=0;j<35*b/a;j++)
	  {
	  	  px2[i*35*b/a+j]=px[i*b+92*4+j];
	  }
  status_arrow=status_arrow+arrow(px2,35,35*4,c);

for ( i=0;i<c;i++)
	  for (int j=0;j<35*b/a;j++)
	  {
	  	  px2[i*35*b/a+j]=px[i*b+138*4+j];
	  }
  status_arrow=status_arrow+arrow(px2,35,35*4,c);
  curr_status=status_arrow;

 for ( i=0;i<c;i++)
	  for (int j=0;j<35*b/a;j++)
	  {
	  	  px2[i*35*b/a+j]=px[i*b+184*4+j];
	  }
  status_arrow=status_arrow+arrow(px2,35,35*4,c);
  curr_status=status_arrow;
for ( i=0;i<c;i++)
	  for (int j=0;j<35*b/a;j++)
	  {
	  	  px2[i*35*b/a+j]=px[i*b+230*4+j];
	  }
  status_arrow=status_arrow+arrow(px2,35,35*4,c);
  curr_status=status_arrow;
for ( i=0;i<c;i++)
	  for (int j=0;j<35*b/a;j++)
	  {
	  	  px2[i*35*b/a+j]=px[i*b+276*4+j];
	  }
  status_arrow=status_arrow+arrow(px2,35,35*4,c);
  curr_status=status_arrow;

return;
}

void CScreenDlg::get_time()
{
	int a=bm.bmWidth;
	int b=bm.bmWidthBytes;
	int c=bm.bmHeight;
	CString s1="";
    CString s2="";
    int line=666;
//    int colume=872;
//    int colume=222;
    int colume=252;
 
  
  for (int i=0;i<9;i++)
	  for (int j=0;j<5*b/a;j++)
	  {
	  	  px3[i*5*b/a+j]=px[(i+line)*b+colume*b/a+j];
	  }

  
   s1=s1+character3(project3(px3));

   for ( i=0;i<9;i++)
	  for ( int j=0;j<5*b/a;j++)
	  {
	  	  px3[i*5*b/a+j]=px[(i+line)*b+(colume+7)*b/a+j];
	  }

  
   s1=s1+character3(project3(px3));
   s1=s1+":";

   for ( i=0;i<9;i++)
	  for ( int j=0;j<5*b/a;j++)
	  {
	  	  px3[i*5*b/a+j]=px[(i+line)*b+(colume+17)*b/a+j];
	  }
   s1=s1+character3(project3(px3));
   for ( i=0;i<9;i++)
	  for ( int j=0;j<5*b/a;j++)
	  {
	  	  px3[i*5*b/a+j]=px[(i+line)*b+(colume+24)*b/a+j];
	  }
   s1=s1+character3(project3(px3));

   m_curr_time=minute_add(s1,1);
   UpdateData(FALSE);
   return;
}

void CScreenDlg::get_price()
{
	int a=bm.bmWidth;
	int b=bm.bmWidthBytes;
	int c=bm.bmHeight;
	CString s1="";
    CString s2="";
    int line=247;
//    int colume=872;
//    int colume=222;
    int colume=403;
 
//  unsigned   char   *px1=new   unsigned   char  [10*8*b/a];   
//小数点的位置要判别


  
  for (int i=0;i<10;i++)
	  for (int j=0;j<8*b/a;j++)
	  {
	  	  px1[i*8*b/a+j]=px[(i+line)*b+colume*b/a+j];
	  }

  
   s1=s1+character(project1(px1,a,b));

   for ( i=0;i<10;i++)
	  for ( int j=0;j<8*b/a;j++)
	  {
	  	  px1[i*8*b/a+j]=px[(i+line)*b+(colume+8)*b/a+j];
	  }
  
   s1=s1+character(project1(px1,a,b));

   for ( i=0;i<10;i++)
	  for ( int j=0;j<8*b/a;j++)
	  {
	  	  px1[i*8*b/a+j]=px[(i+line)*b+(colume+16)*b/a+j];
	  }
  
   s1=s1+character(project1(px1,a,b));
   s1=s1+".";

   for ( i=0;i<10;i++)
	  for (int  j=0;j<8*b/a;j++)
	  {
	  	  px1[i*8*b/a+j]=px[(i+line)*b+(colume+28)*b/a+j];
	  }
  
   s1=s1+character(project1(px1,a,b));
  
   for ( i=0;i<10;i++)
	  for ( int j=0;j<8*b/a;j++)
	  {
	  	  px1[i*8*b/a+j]=px[(i+line)*b+(colume+36)*b/a+j];
	  }
  
   s1=s1+character(project1(px1,a,b));
  

     
  for ( i=0;i<10;i++)
	  for (int j=0;j<8*b/a;j++)
	  {
	  	  px1[i*8*b/a+j]=px[(i+line)*b+colume*b/a+j];
	  }

  
   s2=s2+character(project1(px1,a,b));

   for ( i=0;i<10;i++)
	  for ( int j=0;j<8*b/a;j++)
	  {
	  	  px1[i*8*b/a+j]=px[(i+line)*b+(colume+8)*b/a+j];
	  }
  
   s2=s2+character(project1(px1,a,b));
   s2=s2+".";



   for ( i=0;i<10;i++)
	  for ( int j=0;j<8*b/a;j++)
	  {
	  	  px1[i*8*b/a+j]=px[(i+line)*b+(colume+20)*b/a+j];
	  }
  
   s2=s2+character(project1(px1,a,b));
 
   for ( i=0;i<10;i++)
	  for (int  j=0;j<8*b/a;j++)
	  {
	  	  px1[i*8*b/a+j]=px[(i+line)*b+(colume+28)*b/a+j];
	  }
  
   s2=s2+character(project1(px1,a,b));
  
   for ( i=0;i<10;i++)
	  for ( int j=0;j<8*b/a;j++)
	  {
	  	  px1[i*8*b/a+j]=px[(i+line)*b+(colume+36)*b/a+j];
	  }
  
   s2=s2+character(project1(px1,a,b));
   if ( (s1.Left(5)).Right(1)!=" " && (s1.Left(3)).Right(1)!=" ")
       curr_price=s1;
   else
	   curr_price=s2;





   if (fabs(price5-atof(curr_price.GetBuffer(0)))>=0.0009)
   {

      price1=price2;
      price2=price3;
      price3=price4;
      price4=price5;
      price5=atof(curr_price.GetBuffer(0));
      time1=time2;
	  time2=time3;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -