该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
线程代码:扫拍卖的关键代码了。AfxBeginThread线程,注意别用API线程,很难与主界面沟通
UINT Dlog1::Mythread1(LPVOID lparam) {BEGING: dlg1=(Dlog1*)lparam;CFile log1;CString rizhi;SYSTEMTIME mytime;GetLocalTime(&mytime);rizhi.Format("日志%d年%d月%d日.txt",mytime.wYear,mytime.wMonth,mytime.wDay);
dlg1->m_edit=rizhi;dlg1->UpdateData(FALSE);
log1.Open(rizhi.GetBuffer(0),CFile::modeReadWrite);log1.SeekToEnd();char * welcom="开始执行新一轮扫描";log1.Write(welcom,strlen(welcom)+1);log1.Close();
/* AfxMessageBox(XunHuanCishu);*/kaishi:for (int x=0;x
if (myPAIMAI.isFrist ==TRUE){lei.UseDM_DLL(&dm);dm.BindWindow((long)myPAIMAI.DNFhandle,"dx2","normal","normal",1);dm.DownCpu(100);Guanbi_CHUANGKOU();
AAAASleep(100);DaKai_PaiMai_AND_SHURUFA();myPAIMAI.isFrist=FALSE;}
//开始扫dianjiCuoWu_SUDU();::Sleep(100);BOOL ISqingchu=QingChu_SUDU();if (ISqingchu==FALSE){myPAIMAI.isFrist=true;goto BEGING;}
dm.SetDict(0,"C:\\MYRES\\D1.TXT");dm.UseDict(0);
///开始搜索//需要再次点击输入框 因为焦点没了。。。//输入要搜索的东西//*::Sleep(timecout);*/BOOL isshurukuang= DijiShuRuKuang_SUDU();if (isshurukuang==FALSE){myPAIMAI.isFrist=true;goto BEGING;}
shuruzifu.MakeUpper();//添加的//不对就还原dm.KeyPress(shuruzifu.GetAt(0));添加的dm.KeyPress(shuruzifu.GetAt(1));//添加的dm.KeyPress(VK_SPACE);dianjiCuoWu_SUDU();dm.KeyPress(VK_RETURN);sousuo:dianjiCuoWu_SUDU();Sleep(100);//必须有查找单价//单价坐标 Y=价格金币的位置到+30 X=价格金币的位置开始到+100FindJiage_toMYJILV_XY();int zongjia=0,shuliang=0,danjia=0;//总价和数量数量dm.SetDict(0,"C:\\MYRES\\D1.TXT");dm.UseDict(0);CString s = dm.Ocr(myjilv.jiageX.lVal,myjilv.jiageY.lVal,myjilv.jiageX.lVal+100,myjilv.jiageY.lVal+30,"ffb100-000000|ff3232-000000",1.0);if(s.IsEmpty()==TRUE || s=="" ){CString tofileA;tofileA.Format("总价为0 重复扫描1次+\r\n");dlg1->m_edit=tofileA;dlg1->UpdateData(FALSE);log1.Open(rizhi.GetBuffer(0),CFile::modeReadWrite);log1.SeekToEnd();log1.Write(tofileA.GetBuffer(0) ,tofileA.GetLength());log1.Close();goto kaishi2;}zongjia=lei.NeiCun_Asm_ZhuanHuan.CStringToInt(s);if (zongjia<=0){AfxMessageBox("zongjia<=0");goto kaishi2;}
dm.SetDict(1,"C:\\MYRES\\D2.TXT");dm.UseDict(1);VARIANT lingshiA,lingshiB;if (dm.FindStr(myjilv.jiageX.lVal-100,myjilv.jiageY.lVal,myjilv.jiageX.lVal+30,myjilv.jiageY.lVal+30,"当前竞拍", "ffb100-000000|ff3232-000000|ddc593-000000",1.0,&lingshiA,&lingshiB)!=-1){char* TiaoguoStr="当前是竞拍,跳过";dlg1->m_edit=TiaoguoStr;dlg1->UpdateData(FALSE);log1.Open(rizhi.GetBuffer(0),CFile::modeReadWrite);log1.SeekToEnd();log1.Write(TiaoguoStr,strlen(TiaoguoStr));log1.Close();x=0;goto kaishi;}
CString ss2;ss2 = dm.Ocr(myjilv.jiageX.lVal-380,myjilv.jiageY.lVal,myjilv.jiageX.lVal-280,myjilv.jiageY.lVal+30,"ffffff-000000|b36bff-000000",0.9);int xyz=0;int is1;is1=0;
if (ss2.IsEmpty()==TRUE){if (zongjia>=panduanjiage){is1=1;goto shuliangzhengque;}else{
goto kaishi2;} }
shuliangzhengque:shuliang=lei.NeiCun_Asm_ZhuanHuan.CStringToInt(ss2);if (is1==1){CString tofileb;tofileb.Format("数量为1: "+myPAIMAI.CaiLiaoMing_di1hang[x]+"\r\n");log1.Open(rizhi.GetBuffer(0),CFile::modeReadWrite);log1.SeekToEnd();log1.Write(tofileb.GetBuffer(0) ,tofileb.GetLength());log1.Close();
shuliang=1;}if (shuliang==0){//isFrist=TRUE;goto kaishi2;}
danjia=zongjia/shuliang;下面就是买了///随便点个正确的Y 都能出现按钮///CString LOgStr;if (danjia<=panduanjiage){__asm{nopnop}zhijiemai:SYSTEMTIME time1;GetLocalTime(&time1);CString timestr;timestr.Format("%d点%d分%d秒",time1.wHour,time1.wMinute,time1.wSecond);LOgStr.Format(timestr+" : 已买下:"+myPAIMAI.CaiLiaoMing_di1hang[x] +" 价格%d 总价:%d 数量:%d"+ " \r\n",danjia,zongjia,shuliang);log1.Open(rizhi.GetBuffer(0),CFile::modeReadWrite);log1.SeekToEnd();log1.Write(LOgStr.GetBuffer(0),LOgStr.GetLength());dlg1->m_edit=LOgStr;dlg1->UpdateData(FALSE);log1.Close();/*m_tab2.SetTextMatrix(0,1,LOgStr.GetBuffer(0));*/dm.MoveTo(myjilv.jiageX.lVal,myjilv.jiageY.lVal+20);dm.LeftDoubleClick();//弹出购买选项::Sleep(100);选择一口价//点击之VARIANT yikoujiaX,yikoujiaY;if (dm.FindStr(myjilv.jiageX.lVal,myjilv.jiageY.lVal,myjilv.jiageX.lVal+100,myjilv.jiageY.lVal+100,"一口价","bd9f7e",1.0,&yikoujiaX,&yikoujiaY)!=-1){dm.MoveTo(yikoujiaX.lVal,yikoujiaY.lVal);::Sleep(50);dm.LeftClick();::Sleep(50);dm.MoveR(0,18);dm.KeyPress(VK_RETURN);dm.KeyPress(VK_RETURN);dm.KeyPress(VK_RETURN);::Sleep(300);dianjiCuoWu();goto sousuo;}}else{SYSTEMTIME time2;GetLocalTime(&time2);CString timestr2;timestr2.Format("%d点%d分%d秒 :",time2.wHour,time2.wMinute,time2.wSecond);log1.Open(rizhi.GetBuffer(0),CFile::modeReadWrite);log1.SeekToEnd();LOgStr.Format(timestr2+myPAIMAI.CaiLiaoMing_di1hang[x]+"价格%d,过高,不买"+"\r\n",danjia);dlg1->m_edit=LOgStr;dlg1->UpdateData(FALSE);log1.Write(LOgStr.GetBuffer(0),LOgStr.GetLength());log1.Close();}dianjiCuoWu();Sleep(30);if (myPAIMAI.ISTUICHU==TRUE){
goto end;}x=x+1;} goto BEGING;end:__asm{mov eax,eax}return 0;}