// test.cpp : �������̨Ӧ�ó������ڵ㡣 // #include "stdafx.h" #include "test.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // Ψһ��Ӧ�ó������ CWinApp theApp; using namespace std; int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { int nRetCode = 0; // ��ʼ�� MFC ����ʧ��ʱ��ʾ���� if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) { // TODO: ���Ĵ�������Է���������Ҫ _tprintf(_T("����: MFC ��ʼ��ʧ��\n")); nRetCode = 1; } else { std::string bid = "DXM1900259"; // 0����ʼ������; if ( !ScbcInit(bid.c_str()) ) { printf("��ʼ��ʧ��\n"); return -1; } // ����1ǧ��; int i = 1000; while(i--){ printf("\n\n******************No.%ld******************\n", i); // 1����ѯ�����Ƿ������سɹ�; int nRet = QueryMidInfo(bid.c_str()); printf("QueryMidInfo��%d\n", nRet); if ( nRet != 2 ) { printf("����δ���سɹ�����ʼ����\n"); // δ���سɹ�����ʼ��̨����; nRet = DownloadMidData(bid.c_str()); printf("DownloadMidData��%d\n", nRet); if ( nRet == 0 ) { printf("������δ����ϵͳ�������أ������˳�\n"); continue; } } else printf("����������\n"); // 2���ȴ����سɹ�; while ( nRet != 2 ) { nRet = QueryMidInfo(bid.c_str()); printf("QueryMidInfo��%d\n", nRet); if ( nRet == 2 ) { printf("��ѯ���������سɹ�\n"); } Sleep(1000); } std::string sn = "TEST-TONY-5588"; // 3����ȡָ��sn��keys,���ڳ�дkey; SNKeys keys; nRet = QueryKeyInfo(sn.c_str(), keys); printf("QueryKeyInfo��%d\n", nRet); // 4����д�ɹ����泭д���; if ( true ) { nRet = UpdateKeyCopyStatus(sn.c_str()); printf("UpdateKeyCopyStatus��%d\n", nRet); } //Sleep(6000); // 5������sn��д����ϱ�; nRet = ReportKeyCopyResults(sn.c_str()); printf("ReportKeyCopyResults��%d, %s\n", nRet, nRet == 1 ? "�ϱ��ɹ�" : "�ϱ�ʧ��"); if ( nRet == -8 ) { nRet = UpdateKeyReportStatus(sn.c_str()); printf("UpdateKeyReportStatus��%d\n", nRet); } // 6��1000��sn��д����ϱ�; while((nRet = BatchReportKeyCopyResults()) == 1) printf("BatchReportKeyCopyResults��%d, %s\n", nRet, nRet == 1 ? "�ϱ��ɹ�" : "�ϱ�ʧ��"); // 7����ѯӦ����sn������ʵ������sn���ݡ���д�ɹ�sn�������ϱ��ɹ�sn����; BidInfo binfo; nRet = QueryBidInfo(bid.c_str(), binfo); printf("QueryBidInfo��%d\n", nRet, nRet == 1 ? "��ѯ�ɹ�": "��ѯʧ��"); printf("15���ʼɾ��������Ϣ\n"); Sleep(15000); // 8��ɾ��������ر����ݣ�ȫ���������� nRet = RemoveBidData(bid.c_str()); printf("RemoveBidData��%d\n", nRet); printf("ɾ��������Ϣ�ɹ�\n"); } } system("pause"); return nRetCode; }