搜索

查看: 3231|回复: 11

[VC] 什么值得买提醒源码 企业微信 WxPusher 钉钉 推送

[复制链接]
发表于 2022-6-25 22:55:58 | 显示全部楼层 |阅读模式
Editor 2022-6-25 22:55:58 3231 11 看全部
什么值得买提醒源码 企业微信 WxPusher 钉钉 推送


  1. // SmzdmRemind.cpp : 定义应用程序的入口点。
  2. //
  3. #if defined _M_IX86
  4. #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'"")
  5. #elif defined _M_IA64
  6. #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'"")
  7. #elif defined _M_X64
  8. #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'"")
  9. #else
  10. #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"")
  11. #endif

  12. #include "framework.h"
  13. #include "SmzdmRemind.h"
  14. #include "shellapi.h"
  15. #include "commctrl.h"
  16. #include "psapi.h"

  17. typedef BOOL (WINAPI* pfnShowToast)(WCHAR* szTitle, WCHAR* szBody, WCHAR* szImagePath, WCHAR* szLink);
  18. pfnShowToast ShowToast;

  19. /*
  20. #include "wintoastlib.h"
  21. using namespace WinToastLib;
  22. class CustomHandler : public IWinToastHandler {
  23. public:
  24.     WCHAR szLink[128];
  25.     void toastActivated() const {
  26.         ShellExecute(NULL, L"open", szLink, NULL, NULL, SW_SHOW);
  27.         delete this;
  28.     }
  29.     void toastActivated(int actionIndex) const {
  30.         //click button
  31.         int t = actionIndex;
  32.         if (t == 0)
  33.             ShellExecute(NULL, L"open", szLink, NULL, NULL, SW_SHOW);
  34.     }

  35.     void toastDismissed(WinToastDismissalReason state) const {
  36.         //switch state
  37.     }

  38.     void toastFailed() const {
  39.     }
  40. };
  41. //初始化模板
  42. void ShowToast(WCHAR * szTitle, WCHAR * szBody, WCHAR * szImagePath, WCHAR * szLink)
  43. {
  44.     WinToastTemplate templ(WinToastTemplate::ImageAndText01);
  45.     templ.setTextField(szTitle, WinToastTemplate::FirstLine);
  46.     templ.setAttributionText(szBody);
  47.     templ.setAudioOption(WinToastTemplate::Default);
  48.     templ.setImagePath(szImagePath);
  49.     //    templ.setExpiration(3000);
  50.     CustomHandler* nch = new CustomHandler();
  51.     lstrcpy(nch->szLink, szLink);
  52.     templ.addAction(L"打开");
  53.     templ.addAction(L"关闭");
  54.     WinToast::instance()->showToast(templ, nch);
  55.     //  return templ;
  56. }
  57. */

  58. wchar_t* lstrstr(const wchar_t* str, const wchar_t* sub)
  59. {
  60.     int i = 0;
  61.     int j = 0;
  62.     while (str[i] && sub[j])
  63.     {
  64.         if (str[i] == sub[j])//如果相等
  65.         {
  66.             ++i;
  67.             ++j;
  68.         }
  69.         else             //如果不等
  70.         {
  71.             i = i - j + 1;
  72.             j = 0;
  73.         }
  74.     }
  75.     if (!sub[j])
  76.     {
  77.         return (wchar_t*)&str[i - lstrlen(sub)];
  78.     }
  79.     else
  80.     {
  81.         return (wchar_t*)0;
  82.     }
  83. }
  84. int winhttpDownload(WCHAR* wUrl, WCHAR* wFile)
  85. {
  86.     HANDLE hFile = CreateFile(wFile,  // creates a new file
  87.         FILE_APPEND_DATA,         // open for writing
  88.         0,          // allow multiple readers
  89.         NULL,                     // no security
  90.         CREATE_ALWAYS,            // creates a new file, always.
  91.         FILE_ATTRIBUTE_NORMAL,    // normal file
  92.         NULL);                    // no attr. template        
  93.     if (hFile == INVALID_HANDLE_VALUE)
  94.     {
  95.         return 2;
  96.     }
  97.     DWORD dwSize = 0;
  98.     DWORD dwSumSize = 0;
  99.     DWORD dwDownloaded = 0;
  100.     DWORD dwBuffer = 0,
  101.         dwBufferLength = sizeof(DWORD),
  102.         dwIndex = 0;
  103.     LPSTR pszOutBuffer;
  104.     BOOL  bResults = FALSE;
  105.     HINTERNET  hSession = NULL,
  106.         hConnect = NULL,
  107.         hRequest = NULL;
  108.     // Use WinHttpOpen to obtain a session handle.
  109.     hSession = WinHttpOpen(L"WinHTTP_Download Example/1.0",
  110.         WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
  111.         WINHTTP_NO_PROXY_NAME,
  112.         WINHTTP_NO_PROXY_BYPASS, 0);

  113.     // Specify an HTTP server.
  114.     //INTERNET_PORT nPort = (pGetRequest->fUseSSL) ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT;
  115.     WCHAR* wHost = lstrstr(wUrl, L":");
  116.     if (wHost)
  117.         wHost += 2;
  118.     else
  119.         wHost = wUrl;
  120.     WCHAR* wUrlPath = lstrstr(wHost, L"/");   
  121.     WCHAR szHost[128];
  122.     lstrcpyn(szHost, wHost, wUrlPath - wHost+1);
  123.     if (hSession)
  124.         hConnect = WinHttpConnect(hSession, szHost,
  125.             //hConnect = WinHttpConnect(hSession, L"avatar.csdn.net",
  126.             INTERNET_DEFAULT_HTTPS_PORT, 0);
  127.     // Create an HTTP request handle.
  128.     if (hConnect)
  129.         hRequest = WinHttpOpenRequest(hConnect, L"GET", wUrlPath,
  130.             L"HTTP/1.1", WINHTTP_NO_REFERER,
  131.             WINHTTP_DEFAULT_ACCEPT_TYPES,
  132.             WINHTTP_FLAG_SECURE);

  133.     // Send a request.
  134.     if (hRequest)
  135.         bResults = WinHttpSendRequest(hRequest,
  136.             WINHTTP_NO_ADDITIONAL_HEADERS,
  137.             0, WINHTTP_NO_REQUEST_DATA, 0,
  138.             0, 0);

  139.     // End the request.
  140.     if (bResults)
  141.         bResults = WinHttpReceiveResponse(hRequest, NULL);
  142.     WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_CONTENT_LENGTH | WINHTTP_QUERY_FLAG_NUMBER, NULL, &dwBuffer, &dwBufferLength, &dwIndex);
  143.     // Continue to verify data until there is nothing left.
  144.     if (bResults)
  145.     {
  146.         do
  147.         {
  148.             // Verify available data.
  149.             dwSize = 0;
  150.             WinHttpQueryDataAvailable(hRequest, &dwSize);
  151.             // Allocate space for the buffer.
  152.             pszOutBuffer = new char[dwSize + (size_t)1];
  153.             if (!pszOutBuffer)
  154.             {
  155.                 dwSize = 0;
  156.             }
  157.             else
  158.             {
  159.                 dwSumSize += dwSize;
  160.                 // Read the Data.
  161.                 ZeroMemory(pszOutBuffer, dwSize + (size_t)1);

  162.                 if (!WinHttpReadData(hRequest, (LPVOID)pszOutBuffer,
  163.                     dwSize, &dwDownloaded)) {
  164.                 }
  165.                 else {
  166.                     WriteFile(hFile, pszOutBuffer, dwDownloaded, &dwDownloaded, NULL);
  167.                 }
  168.                 // Free the memory allocated to the buffer.
  169.                 delete[] pszOutBuffer;
  170.             }

  171.         } while (dwSize > 0);

  172.         // Close files.
  173.         CloseHandle(hFile);

  174.         // Close open handles.
  175.         if (hRequest) WinHttpCloseHandle(hRequest);
  176.         if (hConnect) WinHttpCloseHandle(hConnect);
  177.         if (hSession) WinHttpCloseHandle(hSession);
  178.     }
  179.     return 0;
  180. }
  181. #define NETPAGESIZE 2097152
  182. #define MAX_LOADSTRING 100
  183. #define WM_IAWENTRAY WM_USER+199
  184. // 全局变量:
  185. RTL_OSVERSIONINFOW rovi;//WIN系统版本号
  186. WCHAR szAppName[] = L"SmzdmRemind";
  187. HINSTANCE hInst;                                // 当前实例
  188. HANDLE hMutex = NULL;
  189. HMODULE hWintoast;
  190. HWND hMain;
  191. HWND hSetting;
  192. HWND hList;
  193. HWND hListRemind;
  194. HWND hCombo;
  195. HWND hComboTime;
  196. HWND hComboPage;
  197. HANDLE hMap = NULL;
  198. HANDLE hGetDataThread;
  199. NOTIFYICONDATA nid;
  200. HICON iMain;
  201. //HICON iTray;
  202. BOOL bPost = FALSE;//社区文章
  203. BOOL bOpen = FALSE;//程序第一次获取数据
  204. BOOL bExit = FALSE;//退出线程
  205. BOOL bResetTime = FALSE;//重新设置时间
  206. BOOL bGetData = FALSE;//是否获取数据中
  207. BOOL bNewTrayTips = FALSE;//新的通知样式
  208. WCHAR szWxPusherToken[] = L"AT_YGOXF3ZtPSkz5lkxhFUZ5ZkHOgrkKSdG";
  209. WCHAR szReminSave[] = L"SmzdmRemind.sav";
  210. DWORD iTimes[] = { 1,3,5,10,15,30 };
  211. WCHAR szTimes[][5] = {L"1分钟",L"3分钟",L"5分钟",L"10分钟",L"15分钟",L"30分钟"};
  212. int mIDs[24] =          { 0,  183 ,   20057,  3949,       2537,       247,        241,      6753,               2897,       243,       8645,      257,       8912,        239,        4031,       20155,      269,           4033,           5108,       3981,        20383,      167 ,      153,    6255 };
  213. WCHAR szBus[24][9] =    { L"" , L"京东",L"京喜",L"京东国际",L"天猫超市",L"天猫精选",L"聚划算",L"天猫国际官方直营",L"天猫国际",L"淘宝精选",L"拼多多",L"唯品会", L"小米有品", L"苏宁易购",L"苏宁国际", L"抖音电商",L"亚马逊中国",L"亚马逊海外购",L"网易严选", L"考拉海购",L"微信小程序",L"真快乐",L"当当",L"什么值得买" };
  214. WCHAR szPage[9][2] = {L"1",L"2",L"3",L"4",L"5",L"6",L"7",L"8",L"9"};
  215. // 此代码模块中包含的函数的前向声明:
  216. BOOL                InitInstance(HINSTANCE, int);
  217. LRESULT CALLBACK    MainProc(HWND, UINT, WPARAM, LPARAM);
  218. typedef struct _REMINDITEM
  219. {
  220.     BOOL bNotUse;
  221.     WCHAR szKey[128];
  222.     WCHAR szFilter[128];
  223.     UINT uMinPrice;
  224.     UINT uMaxPrice;
  225.     int iBusiness;
  226.     UINT uid;//商品ID   
  227.     FILETIME ft;
  228.     WCHAR szID[10];
  229.     BYTE dReserve[256-20];
  230. }REMINDITEM;
  231. REMINDITEM* lpRemindItem = NULL;
  232. typedef struct _REMINDDATA
  233. {
  234.     BOOL bExit;
  235.     WCHAR szWeChatToken[512];
  236. }REMINDDATA;
  237. REMINDDATA* lpRemindData;
  238. DWORD riSize = 0;
  239. typedef struct _REMINDSAVE
  240. {
  241.     BOOL bDirectly;
  242.     BOOL bTips;
  243.     BOOL bWxPusher;   
  244.     BOOL bWeChat;
  245.     int iTime;
  246.     WCHAR szWxPusherUID[64];   
  247.     WCHAR szWeChatAgentId[8];
  248.     WCHAR szWeChatID[24];   
  249.     WCHAR szWeChatSecret[48];
  250.     WCHAR szWeChatUserID[64];
  251.     int iPage;
  252.     BOOL bDingDing;
  253.     WCHAR szDingDingToken[80];
  254.     BOOL bLastSort;//最新排序
  255.     BOOL bPost;//社区文章
  256.     BYTE dReserve[512-sizeof BOOL*3-160];
  257. }REMINDSAVE;
  258. REMINDSAVE RemindSave = {
  259.     TRUE,
  260.     FALSE,
  261.     FALSE,
  262.     FALSE,
  263.     1,
  264.     L"",
  265.     L"",
  266.     L"",
  267.     L"",
  268.     L"@all",
  269.     1,
  270.     FALSE,
  271.     {0},
  272.     FALSE,
  273.     {0}
  274. };
  275. BOOL LoadToast()
  276. {
  277.     HMODULE hWintoast = LoadLibrary(L"WinToast.dll");
  278.     if (hWintoast)
  279.     {
  280.         typedef BOOL(WINAPI* pfnInit)(WCHAR* szAppName);
  281.         pfnInit Init = (pfnInit)GetProcAddress(hWintoast, "Init");
  282.         if (Init)
  283.         {
  284.             if (Init(szAppName))
  285.             {
  286.                 ShowToast = (pfnShowToast)GetProcAddress(hWintoast, "ShowToast");
  287.                 bNewTrayTips = TRUE;
  288.             }
  289.         }
  290.     }
  291.     if (bNewTrayTips == FALSE && hWintoast)
  292.         FreeLibrary(hWintoast);
  293.     return bNewTrayTips;
  294. }
  295. void SetToCurrentPath()////////////////////////////////////设置当前程序为当前目录
  296. {
  297.     WCHAR szDir[MAX_PATH];
  298.     GetModuleFileName(NULL, szDir, MAX_PATH);
  299.     int len = lstrlen(szDir);
  300.     for (int i = len - 1; i > 0; i--)
  301.     {
  302.         if (szDir[i] == '\\')
  303.         {
  304.             szDir[i] = 0;
  305.             SetCurrentDirectory(szDir);
  306.             break;
  307.         }
  308.     }
  309. }
  310. BOOL bSort = TRUE;
  311. int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
  312. {
  313.     if (lParamSort == 2 || lParamSort == 4|| lParamSort == 5|| lParamSort == 6 || lParamSort == 7)
  314.     {
  315.         WCHAR sz1[129], sz2[129];
  316.         ListView_GetItemText(hList, lParam1, lParamSort, sz1, 128);
  317.         ListView_GetItemText(hList, lParam2, lParamSort, sz2, 128);
  318.         float l1 = my_wtof(sz1);
  319.         float l2 = my_wtof(sz2);
  320.         if (l1 == l2)
  321.             return 0;
  322.         else if (l1 > l2)
  323.         {
  324.             if (bSort)
  325.                 return 1;
  326.             else
  327.                 return -1;
  328.         }
  329.         else
  330.         {
  331.             if (bSort)
  332.                 return -1;
  333.             else
  334.                 return 1;
  335.         }
  336.     }
  337.     else
  338.     {
  339.         WCHAR sz1[129],sz2[129];
  340.         ListView_GetItemText(hList, lParam1, lParamSort, sz1, 128);
  341.         ListView_GetItemText(hList, lParam2, lParamSort, sz2, 128);
  342.         int s = lstrcmp(sz1, sz2);
  343.         if (bSort&&s!=0)
  344.             s = -s;
  345.         return s;
  346.     }
  347. }
  348. BOOL AutoRun(BOOL GetSet, BOOL bAutoRun, const WCHAR* szName)//读取、设置开机启动、关闭开机启动
  349. {
  350.     BOOL ret = FALSE;
  351.     WCHAR sFileName[MAX_PATH];
  352.     sFileName[0] = L'"';
  353.     GetModuleFileName(NULL, &sFileName[1], MAX_PATH);
  354.     int sLen = lstrlen(sFileName);
  355.     sFileName[sLen] = L'"';
  356.     sFileName[sLen + 1] = L' ';
  357.     sFileName[sLen + 2] = L't';
  358.     sFileName[sLen + 3] = L'\0';
  359.     HKEY pKey;
  360.     RegOpenKeyEx(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", NULL, KEY_ALL_ACCESS, &pKey);
  361.     if (pKey)
  362.     {
  363.         if (GetSet)
  364.         {
  365.             if (bAutoRun)
  366.             {
  367.                 RegSetValueEx(pKey, szName, NULL, REG_SZ, (BYTE*)sFileName, (DWORD)lstrlen(sFileName) * 2);
  368.             }
  369.             else
  370.             {
  371.                 RegDeleteValue(pKey, szName);
  372.             }
  373.             ret = TRUE;
  374.         }
  375.         else
  376.         {
  377.             WCHAR nFileName[MAX_PATH];
  378.             DWORD cbData = MAX_PATH * sizeof WCHAR;
  379.             DWORD dType = REG_SZ;
  380.             if (RegQueryValueEx(pKey, szName, NULL, &dType, (LPBYTE)nFileName, &cbData) == ERROR_SUCCESS)
  381.             {
  382.                 if (lstrcmp(sFileName, nFileName) == 0)
  383.                     ret = TRUE;
  384.                 else
  385.                     ret = FALSE;
  386.             }
  387.         }
  388.         RegCloseKey(pKey);
  389.     }
  390.     return ret;
  391. }
  392. void UrlUTF8(WCHAR* wstr,WCHAR * wout)
  393. {
  394.     char szUtf8[1024] = { 0 };
  395.     char szout[1024]={0};
  396.     WideCharToMultiByte(CP_UTF8, 0, wstr, -1, szUtf8, 1024, NULL, NULL);
  397.     int len = strlen(szUtf8);
  398.     for (int i = 0; i < len; i++)
  399.     {
  400.         if (_isalnum((BYTE)szUtf8[i])) //判断字符中是否有数组或者英文
  401.         {
  402.             char tempbuff[2] = { 0 };
  403.             wsprintfA(tempbuff, "%c", (BYTE)szUtf8[i]);
  404.             strcat(szout,tempbuff);
  405.         }
  406.         else if ((BYTE)szUtf8[i]==' ')
  407.         {
  408.             strcat(szout,"+");
  409.         }
  410.         else
  411.         {
  412.             char tempbuff[4];
  413.             wsprintfA(tempbuff, "%%%X%X", ((BYTE)szUtf8[i]) >> 4, ((BYTE)szUtf8[i]) % 16);
  414.             strcat(szout,tempbuff);
  415.         }
  416.     }
  417.     ::MultiByteToWideChar(CP_UTF8, NULL, szout, 1024, wout, 1024);
  418. }
  419. BOOL SetForeground(HWND hWnd)//激活窗口为前台
  420. {
  421.     bool bResult = false;
  422.     bool bHung = IsHungAppWindow(hWnd) != 0;
  423.     DWORD dwCurrentThreadId = 0, dwTargetThreadId = 0;
  424.     DWORD dwTimeout = 0;

  425.     dwCurrentThreadId = GetCurrentThreadId();
  426.     dwTargetThreadId = GetWindowThreadProcessId(hWnd, NULL);

  427.     if (IsIconic(hWnd)) {
  428.         //      ShowWindow(hWnd,SW_RESTORE);
  429.         SendMessage(hWnd, WM_SYSCOMMAND, SC_RESTORE, 0);
  430.     }

  431.     if (!bHung) {
  432.         for (int i = 0; i < 10 && hWnd != GetForegroundWindow(); i++) {
  433.             dwCurrentThreadId = GetCurrentThreadId();
  434.             dwTargetThreadId = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
  435.             AttachThreadInput(dwCurrentThreadId, dwTargetThreadId, true);
  436.             SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
  437.             BringWindowToTop(hWnd);
  438.             AllowSetForegroundWindow(ASFW_ANY);
  439.             bResult = SetForegroundWindow(hWnd) != 0;
  440.             AttachThreadInput(dwCurrentThreadId, dwTargetThreadId, false);
  441.             Sleep(10);
  442.         }
  443.     }
  444.     else {
  445.         BringWindowToTop(hWnd);
  446.         bResult = SetForegroundWindow(hWnd) != 0;
  447.     }
  448.     return bResult;
  449.     /*
  450.         int tIdCur = GetWindowThreadProcessId(GetForegroundWindow(), NULL);//获取当前窗口句柄的线程ID
  451.         int tIdCurProgram = GetWindowThreadProcessId(hWnd,NULL);//获取当前运行程序线程ID
  452.         BOOL ret=AttachThreadInput(tIdCur, tIdCurProgram, 1);//是否能成功和当前自身进程所附加的输入上下文有关;
  453.         SetForegroundWindow(hWnd);
  454.         AttachThreadInput(tIdCur, tIdCurProgram, 0);
  455.         return ret;
  456.     */
  457. }
  458. BOOL RunProcess(LPTSTR szExe, const WCHAR* szCommandLine, HANDLE* pProcess)/////////////////////////////////运行程序
  459. {
  460.     BOOL ret = FALSE;
  461.     STARTUPINFO StartInfo;
  462.     PROCESS_INFORMATION procStruct;
  463.     memset(&StartInfo, 0, sizeof(STARTUPINFO));
  464.     StartInfo.cb = sizeof(STARTUPINFO);
  465.     WCHAR* sz;
  466.     WCHAR szName[MAX_PATH];
  467.     if (szExe == (LPTSTR)1)
  468.         sz = NULL;
  469.     else if (szExe)
  470.         sz = szExe;
  471.     else
  472.     {
  473.         GetModuleFileName(NULL, szName, MAX_PATH);
  474.         sz = szName;
  475.     }
  476.     WCHAR szLine[MAX_PATH];
  477.     szLine[0] = L'\0';
  478.     if (szCommandLine)
  479.         lstrcpy(szLine, szCommandLine);
  480.     ret = CreateProcess(sz,// RUN_TEST.bat位于工程所在目录下
  481.         szLine,
  482.         NULL,
  483.         NULL,
  484.         FALSE,
  485.         NULL,// 这里不为该进程创建一个控制台窗口
  486.         NULL,
  487.         NULL,
  488.         &StartInfo, &procStruct);
  489.     if (pProcess == NULL)
  490.         CloseHandle(procStruct.hProcess);
  491.     else
  492.         *pProcess = procStruct.hProcess;
  493.     CloseHandle(procStruct.hThread);
  494.     //  SetTimer(hMain, 11, 1000, NULL);
  495.     return ret;
  496. }
  497. void EmptyProcessMemory(DWORD pID)
  498. {
  499.     HANDLE hProcess;
  500.     if (pID == NULL)
  501.         hProcess = GetCurrentProcess();
  502.     else
  503.     {
  504.         hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, pID);
  505.     }
  506.     SetProcessWorkingSetSize(hProcess, -1, -1);
  507.     EmptyWorkingSet(hProcess);
  508. }
  509. void ReadSet()
  510. {
  511.     SetToCurrentPath();
  512.     HANDLE hFile = CreateFile(szReminSave, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_ARCHIVE, NULL);
  513.     if (hFile!= INVALID_HANDLE_VALUE)
  514.     {
  515.         DWORD dwBytes;
  516.         ReadFile(hFile, &RemindSave, sizeof RemindSave, &dwBytes, NULL);

  517.         riSize = GetFileSize(hFile, NULL) - sizeof RemindSave;
  518.         if (riSize)
  519.         {            
  520.             if (lpRemindItem != NULL)
  521.                 delete[]lpRemindItem;
  522.             lpRemindItem = (REMINDITEM*)new BYTE[riSize];
  523.             ReadFile(hFile, lpRemindItem, riSize, &dwBytes, NULL);
  524.         }
  525.         CloseHandle(hFile);
  526.     }

  527. }
  528. void WriteSet(REMINDITEM*lpRI)
  529. {
  530.     SetToCurrentPath();
  531.     if (lpRI)
  532.     {
  533.         HANDLE hFile = CreateFile(szReminSave, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, NULL);
  534.         if (hFile != INVALID_HANDLE_VALUE)
  535.         {
  536.             DWORD dwBytes = NULL;
  537.             WriteFile(hFile, &RemindSave, sizeof RemindSave, &dwBytes, NULL);
  538.             SetFilePointer(hFile, 0, NULL, FILE_END);
  539.             WriteFile(hFile, lpRI, sizeof REMINDITEM, &dwBytes, NULL);
  540.             CloseHandle(hFile);
  541.         }
  542.     }
  543.     else
  544.     {
  545.         HANDLE hFile = CreateFile(szReminSave, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, NULL);
  546.         if (hFile!= INVALID_HANDLE_VALUE)
  547.         {
  548.             DWORD dwBytes = NULL;
  549.             WriteFile(hFile, &RemindSave, sizeof RemindSave, &dwBytes, NULL);
  550.             int n = riSize / sizeof REMINDITEM;
  551.             for (int i = 0; i < n; i++)
  552.             {
  553.                 if (lpRemindItem[i].szKey[0] != L'\0')
  554.                     WriteFile(hFile, &lpRemindItem[i], sizeof REMINDITEM, &dwBytes, NULL);
  555.             }
  556.             CloseHandle(hFile);

  557.         }
  558.     }
  559. }

  560. BOOL GetWeChatToken(wchar_t* corpid, wchar_t *corpsecret,wchar_t * access_token)
  561. {
  562.     access_token[0] = L'~';
  563.     DWORD dwSize = 0;
  564.     DWORD dwDownloaded = 0;
  565.     BOOL  bResults = FALSE;
  566.     HINTERNET  hSession = NULL, hConnect = NULL, hRequest = NULL;
  567.     // Use WinHttpOpen to obtain a session handle.
  568.     hSession = WinHttpOpen(L"WeChatPusher", WINHTTP_ACCESS_TYPE_NO_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, NULL);
  569.     // Specify an HTTP server.
  570.     if (hSession)
  571.         hConnect = WinHttpConnect(hSession, L"qyapi.weixin.qq.com", INTERNET_DEFAULT_HTTPS_PORT, 0);
  572.     WCHAR szGet[1024] = L"/cgi-bin/gettoken?corpid=";
  573.     lstrcat(szGet, corpid);
  574.     lstrcat(szGet, L"&corpsecret=");
  575.     lstrcat(szGet, corpsecret);
  576.     // Create an HTTP request handle.
  577.     if (hConnect)
  578.         hRequest = WinHttpOpenRequest(hConnect, L"GET", szGet, NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_SECURE);
  579.     // Send a request.
  580.     if (hRequest)
  581.     {
  582.         bResults = WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0);
  583.     }

  584.     // End the request.
  585.     if (bResults)
  586.         bResults = WinHttpReceiveResponse(hRequest, NULL);
  587.     char pszOutBuffer[2048];
  588.     int i = 0;
  589.     if (bResults)
  590.     {
  591.         do
  592.         {
  593.             dwSize = 0;
  594.             WinHttpQueryDataAvailable(hRequest, &dwSize);
  595.             if (!dwSize)
  596.                 break;
  597.             if (i + dwSize > 2048)
  598.                 dwSize = 2048 - i;
  599.             if (WinHttpReadData(hRequest, (LPVOID)&pszOutBuffer[i], dwSize, &dwDownloaded))
  600.             {
  601.                 i = strlen(pszOutBuffer);
  602.             }
  603.             if (!dwDownloaded)
  604.                 break;
  605.         } while (dwSize != 0);
  606.         WCHAR szOutBuffer[2048] = { 0 };
  607.         MultiByteToWideChar(CP_UTF8, 0, pszOutBuffer, -1, szOutBuffer, 2048);
  608.         WCHAR *cToken = lstrstr(szOutBuffer, L"access_token");
  609.         if (cToken)
  610.         {
  611.             WCHAR* cTokenLeft = lstrstr(cToken + 14, L""");
  612.             if (cTokenLeft)
  613.             {
  614.                 cTokenLeft += 1;
  615.                 WCHAR* cTokenRight = lstrstr(cTokenLeft, L""");
  616.                 if (cTokenRight)
  617.                 {
  618.                     cTokenRight[0] = L'\0';
  619.                     lstrcpy(access_token, cTokenLeft);
  620.                 }
  621.             }
  622.         }
  623.     }
  624.     if (hRequest) WinHttpCloseHandle(hRequest);
  625.     if (hConnect) WinHttpCloseHandle(hConnect);
  626.     if (hSession) WinHttpCloseHandle(hSession);
  627.     return TRUE;
  628. }

  629. BOOL SendWeChatPusher(wchar_t* uid, wchar_t* szTitle, wchar_t* szContent, wchar_t* szUrl,  wchar_t* szImg)
  630. {
  631.     DWORD dwSize = 0;
  632.     DWORD dwDownloaded = 0;
  633.     BOOL  bResults = FALSE;
  634.     HINTERNET  hSession = NULL, hConnect = NULL, hRequest = NULL;
  635.     // Use WinHttpOpen to obtain a session handle.
  636.     hSession = WinHttpOpen(L"DingDing", WINHTTP_ACCESS_TYPE_NO_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, NULL);
  637.     // Specify an HTTP server.
  638.     if (hSession)
  639.         hConnect = WinHttpConnect(hSession, L"qyapi.weixin.qq.com", INTERNET_DEFAULT_HTTPS_PORT, 0);
  640.     WCHAR szGet[1024] = L"/cgi-bin/message/send?access_token=";
  641.     lstrcat(szGet, lpRemindData->szWeChatToken);
  642.     // Create an HTTP request handle.
  643.     if (hConnect)
  644.         hRequest = WinHttpOpenRequest(hConnect, L"POST", szGet, NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_SECURE);
  645.     // Send a request.
  646.     if (hRequest)
  647.     {
  648.         LPCWSTR header = L"Content-Type:application/json";
  649.         DWORD ret = WinHttpAddRequestHeaders(hRequest, header, lstrlen(header), WINHTTP_ADDREQ_FLAG_ADD);
  650.         WCHAR szBody[2048] = L"{\n"touser": "";
  651.         lstrcat(szBody, RemindSave.szWeChatUserID);
  652.         lstrcat(szBody, L"",\n"msgtype": "news",\n "agentid": ");
  653.         lstrcat(szBody, RemindSave.szWeChatAgentId);
  654.         lstrcat(szBody, L",\n   "news" : {\n  "articles": [{\n  "title": "");
  655.         lstrcat(szBody, szTitle);
  656.         lstrcat(szBody, L"",\n "description": "");
  657.         lstrcat(szBody, szContent);
  658.         lstrcat(szBody, L"",\n "url": "");
  659. //        WCHAR surl[] = L"https://app.smzdm.com/xiazai/?json={%22url%22:%22[url]https://m.smzdm.com/p/54084912/%22[/url],%22channel_name%22:%22youhui%22,%22linkVal%22:%2254084912%22,%22article_id%22:%2254084912%22,%22open_from%22:%22youshangXZ%22,%22frompage%22:%22taoxi01%22,%22targetpage%22:%22youhui%22,%22zdm_cp%22:%22H5|%22}";
  660.         lstrcat(szBody, szUrl);
  661.         lstrcat(szBody, L"",\n "picurl": "https://");
  662.         lstrcat(szBody, szImg);
  663.         lstrcat(szBody, L""\n }]\n},\n}");
  664.         DWORD dwByte = 0;
  665.         char szUTF8[2048] = { 0 };
  666.         ::WideCharToMultiByte(CP_UTF8, NULL, szBody, int(lstrlen(szBody)), szUTF8, 2048, NULL, NULL);
  667.         bResults = WinHttpSendRequest(hRequest, 0, 0, szUTF8, strlen(szUTF8), strlen(szUTF8), 0);
  668.     }

  669.     // End the request.
  670.     if (bResults)
  671.         bResults = WinHttpReceiveResponse(hRequest, NULL);
  672.     char pszOutBuffer[2048];
  673.     int i = 0;
  674.     if (bResults)
  675.     {
  676.         do
  677.         {
  678.             dwSize = 0;
  679.             WinHttpQueryDataAvailable(hRequest, &dwSize);
  680.             if (!dwSize)
  681.                 break;
  682.             if (i + dwSize > 2048)
  683.                 dwSize = 2048 - i;
  684.             if (WinHttpReadData(hRequest, (LPVOID)&pszOutBuffer[i], dwSize, &dwDownloaded))
  685.             {
  686.                 i = strlen(pszOutBuffer);
  687.             }
  688.             if (!dwDownloaded)
  689.                 break;
  690.         } while (dwSize != 0);
  691.     }
  692.     if (hRequest) WinHttpCloseHandle(hRequest);
  693.     if (hConnect) WinHttpCloseHandle(hConnect);
  694.     if (hSession) WinHttpCloseHandle(hSession);
  695.     if (xstrstr(pszOutBuffer, "access_token"))
  696.     {
  697.         if (lpRemindData->szWeChatToken[0] != L'~')
  698.         {
  699.             GetWeChatToken(RemindSave.szWeChatID, RemindSave.szWeChatSecret, lpRemindData->szWeChatToken);
  700.             SendWeChatPusher(uid, szTitle, szContent, szUrl,szImg);
  701.         }
  702.         return FALSE;
  703.     }
  704.     else
  705.         return TRUE;
  706. }
  707. BOOL SendDingDing(wchar_t* access_token, wchar_t* szTitle, wchar_t* szContent, wchar_t* szUrl,wchar_t* szImg)
  708. {
  709.     DWORD dwSize = 0;
  710.     DWORD dwDownloaded = 0;
  711.     BOOL  bResults = FALSE;
  712.     HINTERNET  hSession = NULL, hConnect = NULL, hRequest = NULL;
  713.     // Use WinHttpOpen to obtain a session handle.
  714.     hSession = WinHttpOpen(L"DingDing", WINHTTP_ACCESS_TYPE_NO_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, NULL);
  715.     // Specify an HTTP server.
  716.     if (hSession)
  717.         hConnect = WinHttpConnect(hSession, L"oapi.dingtalk.com", INTERNET_DEFAULT_HTTPS_PORT, 0);
  718.     WCHAR szGet[1024] = L"/robot/send?access_token=";
  719.     lstrcat(szGet, access_token);
  720.     // Create an HTTP request handle.
  721.     if (hConnect)
  722.         hRequest = WinHttpOpenRequest(hConnect, L"POST", szGet, NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_SECURE);
  723.     // Send a request.
  724.     if (hRequest)
  725.     {
  726.         LPCWSTR header = L"Content-Type:application/json";
  727.         DWORD ret = WinHttpAddRequestHeaders(hRequest, header, lstrlen(header), WINHTTP_ADDREQ_FLAG_ADD);
  728.         WCHAR szBody[2048] = L"{\n "msgtype": "link",\n "link": {\n "text": "";
  729.         lstrcat(szBody, szContent);
  730.         lstrcat(szBody, L"",\n "title": "");
  731.         lstrcat(szBody, szTitle);
  732.         lstrcat(szBody, L"",\n "picUrl": "https://");
  733.         lstrcat(szBody, szImg);
  734.         lstrcat(szBody, L"",\n "messageUrl": "");
  735.         //        WCHAR surl[] = L"https://app.smzdm.com/xiazai/?json={%22url%22:%22[url]https://m.smzdm.com/p/54084912/%22[/url],%22channel_name%22:%22youhui%22,%22linkVal%22:%2254084912%22,%22article_id%22:%2254084912%22,%22open_from%22:%22youshangXZ%22,%22frompage%22:%22taoxi01%22,%22targetpage%22:%22youhui%22,%22zdm_cp%22:%22H5|%22}";
  736.         lstrcat(szBody, szUrl);            
  737.         lstrcat(szBody, L""\n }\n}");
  738.         DWORD dwByte = 0;
  739.         char szUTF8[2048]={0};
  740.         ::WideCharToMultiByte(CP_UTF8, NULL, szBody, int(lstrlen(szBody)), szUTF8, 2048, NULL, NULL);
  741.         bResults = WinHttpSendRequest(hRequest, 0, 0, szUTF8, strlen(szUTF8), strlen(szUTF8), 0);
  742.     }
  743.     // End the request.
  744.     if (bResults)
  745.         bResults = WinHttpReceiveResponse(hRequest, NULL);
  746.     if (hRequest) WinHttpCloseHandle(hRequest);
  747.     if (hConnect) WinHttpCloseHandle(hConnect);
  748.     if (hSession) WinHttpCloseHandle(hSession);
  749.     return TRUE;
  750. }

  751. BOOL SendWxPusher(wchar_t* uid, wchar_t* szTitle, wchar_t* szContent,wchar_t *szUrl,wchar_t *szImg)
  752. {
  753.     DWORD dwSize = 0;
  754.     DWORD dwDownloaded = 0;
  755.     BOOL  bResults = FALSE;
  756.     HINTERNET  hSession = NULL, hConnect = NULL, hRequest = NULL;
  757.     // Use WinHttpOpen to obtain a session handle.
  758.     hSession = WinHttpOpen(L"WxPusher", WINHTTP_ACCESS_TYPE_NO_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, NULL);
  759.     // Specify an HTTP server.
  760.     if (hSession)
  761.         hConnect = WinHttpConnect(hSession, L"wxpusher.zjiecode.com",INTERNET_DEFAULT_HTTPS_PORT, 0);
  762.     WCHAR szGet[1024] = L"/api/send/message";
  763. /*
  764.     lstrcat(szGet, L"?appToken=AT_YGOXF3ZtPSkz5lkxhFUZ5ZkHOgrkKSdG&content=");
  765.     lstrcat(szGet, szTitle);
  766.     lstrcat(szGet, L"&uid=UID_XdNax8pCAEVtiAYu0ZmHNGq9r1Ma&url=");
  767.     lstrcat(szGet, szUrl);
  768. */
  769.     // Create an HTTP request handle.
  770.     if (hConnect)
  771.         hRequest = WinHttpOpenRequest(hConnect, L"POST", szGet, NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_SECURE);

  772.     // Send a request.
  773.     if (hRequest)
  774.     {
  775.         LPCWSTR header = L"Content-Type:application/json";
  776.         DWORD ret =WinHttpAddRequestHeaders(hRequest, header, lstrlen(header), WINHTTP_ADDREQ_FLAG_ADD);
  777.         WCHAR szBody[2048] = L"\n{\n"appToken":"";
  778.         lstrcat(szBody, szWxPusherToken);
  779.         lstrcat(szBody, L"",\n"content":"");
  780.         lstrcat(szBody,L"<img src=https://");
  781.         lstrcat(szBody, szImg);
  782.         lstrcat(szBody, L" /> <font size=4> <br /> ");
  783.         lstrcat(szBody, szContent);
  784.         lstrcat(szBody, L" </font> ",\n"summary":"");
  785.         lstrcat(szBody, szTitle);        
  786.         lstrcat(szBody, L"",\n"contentType":2,\n"topicIds":[123],\n"uids":["");
  787.         lstrcat(szBody, uid);
  788.         lstrcat(szBody, L""],\n"url":"");
  789.         lstrcat(szBody, szUrl);
  790.         lstrcat(szBody, L""\n}\n");
  791.         DWORD dwByte=0;
  792.         char szUTF8[2048] = { 0 };
  793.         ::WideCharToMultiByte(CP_UTF8, NULL, szBody, int(lstrlen(szBody)), szUTF8, 2048, NULL, NULL);
  794.         bResults = WinHttpSendRequest(hRequest, 0, 0, szUTF8, strlen(szUTF8), strlen(szUTF8), 0);
  795.     }

  796.     // End the request.
  797.     if (bResults)
  798.         bResults = WinHttpReceiveResponse(hRequest, NULL);
  799.     if (hRequest) WinHttpCloseHandle(hRequest);
  800.     if (hConnect) WinHttpCloseHandle(hConnect);
  801.     if (hSession) WinHttpCloseHandle(hSession);
  802.     return TRUE;
  803. }
  804. BOOL SearchSMZDM(REMINDITEM * lpRI,BOOL bList,int iPage,BOOL bSmzdmSearch)
  805. {
  806.     WCHAR szGet[1024] = L"/?s=";
  807.     WCHAR szUrlCode[1024];
  808.     UrlUTF8(lpRI->szKey, szUrlCode);
  809.     //  lstrcat(szGet, lpRI->szKey);
  810.     lstrcat(szGet, szUrlCode);
  811.     if (!bList || !bPost)
  812.         lstrcat(szGet, L"&c=faxian");
  813.     else
  814.         lstrcat(szGet, L"&c=post&f_c=post");
  815.     if (lpRI->iBusiness&&(!bPost||!bList))
  816.     {
  817.         lstrcat(szGet, L"&mall_id=");
  818.         WCHAR sz[16];
  819.         wsprintf(sz, L"%d", mIDs[lpRI->iBusiness]);
  820.         lstrcat(szGet, sz);
  821.     }
  822.     if(RemindSave.bLastSort|| !bList)
  823.         lstrcat(szGet, L"&order=time&v=b");
  824.     else
  825.         lstrcat(szGet, L"&order=score&v=b");
  826.     if ((lpRI->uMaxPrice != 0||lpRI->uMinPrice!=0)&&(!bPost||!bList))
  827.     {
  828.         lstrcat(szGet, L"&min_price=");
  829.         if (lpRI->uMinPrice != 0)
  830.         {
  831.             WCHAR szPrice[16];
  832.             int p = lpRI->uMinPrice * 100;
  833.             wsprintf(szPrice, L"%d.%2.2d", p/100, p % 100);
  834.             lstrcat(szGet, szPrice);
  835.         }
  836.         lstrcat(szGet, L"&max_price=");
  837.         if (lpRI->uMaxPrice != 0)
  838.         {
  839.             WCHAR szPrice[16];
  840.             int p = lpRI->uMaxPrice * 100;
  841.             wsprintf(szPrice, L"%d.%2.2d", p / 100, p % 100);
  842.             lstrcat(szGet, szPrice);
  843.         }
  844.     }
  845.     if (bSmzdmSearch)
  846.     {
  847.         WCHAR szUrl[2048]=L"https://search.smzdm.com";
  848.         lstrcat(szUrl, szGet);
  849.         ShellExecute(NULL, L"open", szUrl, NULL, NULL, SW_SHOW);
  850.         return TRUE;
  851.     }
  852.     if (iPage)
  853.     {
  854.         WCHAR sz[8];
  855.         wsprintf(sz, L"&p=%d",iPage);
  856.         lstrcat(szGet, sz);
  857.     }
  858.     DWORD dwSize = 0;
  859.     DWORD dwDownloaded = 0;
  860.     char* pszOutBuffer = new char[NETPAGESIZE];
  861.     BOOL  bResults = FALSE;
  862.     HINTERNET  hSession = NULL, hConnect = NULL, hRequest = NULL;
  863.     // Use WinHttpOpen to obtain a session handle.
  864.     hSession = WinHttpOpen(L"Remind", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, NULL);
  865.     if (rovi.dwMajorVersion == 6 && rovi.dwMinorVersion == 1)//WIN 7 开启TLS1.2
  866.     {
  867.         DWORD flags = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
  868.         WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS, &flags, sizeof(flags));
  869.     }
  870.     // Specify an HTTP server.
  871.     if (hSession)
  872.         hConnect = WinHttpConnect(hSession, L"search.smzdm.com",
  873.             INTERNET_DEFAULT_HTTPS_PORT, 0);
  874.     // Create an HTTP request handle.
  875.     if (hConnect)
  876.         hRequest = WinHttpOpenRequest(hConnect, L"GET", szGet, NULL, L"", WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_SECURE);
  877.     if (rovi.dwMajorVersion == 6 && rovi.dwMinorVersion == 1)//WIN 7 开启TLS1.2
  878.     {
  879.         DWORD dwSecFlag = SECURITY_FLAG_IGNORE_CERT_CN_INVALID |
  880.             SECURITY_FLAG_IGNORE_CERT_DATE_INVALID |
  881.             SECURITY_FLAG_IGNORE_UNKNOWN_CA |
  882.             SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE;
  883.         WinHttpSetOption(hRequest, WINHTTP_OPTION_SECURITY_FLAGS, &dwSecFlag, sizeof(dwSecFlag));
  884.     }
  885.     // Send a request.
  886.     if (hRequest)
  887.     {
  888.         bResults = WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0);
  889.     }

  890.     // End the request.
  891.     if (bResults)
  892.         bResults = WinHttpReceiveResponse(hRequest, NULL);
  893.     DWORD dErr=GetLastError();
  894.     // Keep checking for data until there is nothing left.
  895.     size_t i = 0;
  896.     ZeroMemory(pszOutBuffer, NETPAGESIZE);
  897.     if (bResults)
  898.     {
  899.         do
  900.         {
  901.             dwSize = 0;
  902.             WinHttpQueryDataAvailable(hRequest, &dwSize);
  903.             if (!dwSize)
  904.                 break;
  905.             if (i + dwSize > NETPAGESIZE)
  906.                 dwSize = NETPAGESIZE - i;
  907.             if (WinHttpReadData(hRequest, (LPVOID)&pszOutBuffer[i], dwSize, &dwDownloaded))
  908.             {
  909.                 i = strlen(pszOutBuffer);
  910.             }
  911.             if (!dwDownloaded)
  912.                 break;
  913.         } while (dwSize != 0);
  914.         WCHAR* szOutBuffer = new WCHAR[NETPAGESIZE];
  915.         MultiByteToWideChar(CP_UTF8, 0, pszOutBuffer, -1, szOutBuffer, NETPAGESIZE);
  916.         DWORD sl=strlen(pszOutBuffer);
  917.         UINT iID = 0;
  918.         WCHAR wID[10]={0};
  919.         WCHAR szLink[64];
  920.         WCHAR szImg[128];
  921.         szImg[0] = L'\0';
  922.         WCHAR szTitle[128];
  923.         float fPrice = 0;
  924.         //    WCHAR szPrice[8];
  925.         WCHAR szDescripe[512];
  926.         szDescripe[0] = L'\0';
  927.         UINT lZhi = 0;
  928.         UINT lBuZhi=0;
  929.         UINT lStar=0;
  930.         UINT lTalk=0;
  931.         WCHAR szGoPath[512];
  932.         szGoPath[0] = L'\0';
  933.         //    WCHAR szTime[6];
  934.         SYSTEMTIME st;
  935.         ULONGLONG ft1, ft2;
  936.         GetLocalTime(&st);
  937.         SystemTimeToFileTime(&st, (LPFILETIME)&ft1);
  938.         if (bOpen == FALSE)
  939.         {
  940.             ft1 -= (ULONGLONG)3600 * 10000000;
  941.         }
  942.         else
  943.         {
  944.             ft2 = iTimes[RemindSave.iTime];
  945.             ft1 -= ft2 * 60 * 10000000;
  946.             ft1 -= 60 * 10000000;
  947.         }
  948.         SYSTEMTIME st2;
  949.         FileTimeToSystemTime((FILETIME*)&ft1, &st2);
  950.         WCHAR szBusiness[17];
  951.         WCHAR* cStart = lstrstr(szOutBuffer, L"feed-row-wide");
  952.         if (bList)
  953.         {
  954.             SendMessage(hList, WM_SETREDRAW, FALSE, FALSE);
  955.             if (iPage==0)
  956.             {
  957.                 ListView_DeleteAllItems(hList);
  958.                 ListView_SetItemCount(hList, 81);
  959.             }
  960.         }
  961. //          WCHAR szIYUU[] = L"IYUU12087Tbb1266ff7043661f3c1aafadf8952e8d406b9af6";
  962. //          SendIYUU(szIYUU, szTitle, szDescripe, szLink, fPrice, szBusiness, szImg);
  963.         while (cStart)
  964.         {
  965.             GetLocalTime(&st);
  966.             UINT tid = 0;
  967.             WCHAR* cGray = lstrstr(cStart, L"feed-row-grey");
  968.             if (cGray > cStart + 32 || cGray == NULL||bList)//不是灰色的继续
  969.             {
  970.                 cStart += 12;
  971.                 WCHAR* cID = lstrstr(cStart, L"article_id");
  972.                 if (cID)//////第一个商品ID
  973.                 {
  974.                     WCHAR* cIDLeft = lstrstr(cID, L":");
  975.                     if (cIDLeft)
  976.                     {
  977.                         cIDLeft += 2;
  978.                         tid = my_wtoi(cIDLeft);
  979.                         WCHAR* cIDRight = lstrstr(cIDLeft, L"'");
  980.                         if (cIDRight)
  981.                         {
  982.                             if(cIDRight-cIDLeft<10)
  983.                                 lstrcpyn(wID, cIDLeft, cIDRight - cIDLeft+1);
  984.                         }
  985.                         if (iID == 0)
  986.                             iID = tid;
  987.                         if (tid == lpRI->uid && lpRI->uid != 0 && !bList)
  988.                             break;
  989.                     }
  990.                 }
  991.                 WCHAR* cLink = lstrstr(cStart, L"href=");
  992.                 if (cLink)
  993.                 {
  994.                     WCHAR* cLinkLeft = lstrstr(cLink, L""");
  995.                     if (cLinkLeft)
  996.                     {
  997.                         cLinkLeft += 1;
  998.                         WCHAR* cLinkRight = lstrstr(cLinkLeft, L""");
  999.                         if (cLinkRight)
  1000.                         {
  1001.                             __int64 n = cLinkRight - cLinkLeft + 1;
  1002.                             if (n > 63)
  1003.                                 n = 63;
  1004.                             if (cLinkLeft[0] == L'/')
  1005.                             {
  1006.                                 if (n == 63)
  1007.                                     n -= 6;
  1008.                                 lstrcpy(szLink, L"https:");                                
  1009.                                 lstrcpyn(szLink+6, cLinkLeft,n);
  1010.                             }
  1011.                             else
  1012.                                 lstrcpyn(szLink, cLinkLeft, n);
  1013.                         }
  1014.                     }
  1015.                 }
  1016.                 WCHAR* cImg = lstrstr(cStart, L"img src");
  1017.                 if (cImg)
  1018.                 {
  1019.                     WCHAR* cImgLeft = lstrstr(cImg, L"//");
  1020.                     if (cImgLeft)
  1021.                     {
  1022.                         cImgLeft += 2;
  1023.                         WCHAR* cImgRight = lstrstr(cImgLeft, L""");
  1024.                         if (cImgRight)
  1025.                         {
  1026.                             __int64 n = cImgRight - cImgLeft + 1;
  1027.                             if (n > 127)
  1028.                                 n = 127;
  1029.                             lstrcpyn(szImg, cImgLeft, n);
  1030.                         }
  1031.                     }
  1032.                 }
  1033.                 BOOL bBreak = FALSE;
  1034.                 WCHAR* cTitle = lstrstr(cStart, L"alt=");
  1035.                 if (cTitle)
  1036.                 {
  1037.                     WCHAR* cTitleLeft = lstrstr(cTitle, L""");
  1038.                     if (cTitleLeft)
  1039.                     {
  1040.                         cTitleLeft += 1;
  1041.                         WCHAR* cTitleRight = lstrstr(cTitleLeft, L""");
  1042.                         if (cTitleRight)
  1043.                         {
  1044.                             __int64 n = cTitleRight - cTitleLeft+1;
  1045.                             if (n > 127)
  1046.                                 n = 127;
  1047.                             lstrcpyn(szTitle, cTitleLeft, n);
  1048.                             if (lstrlen(lpRI->szFilter) != 0)
  1049.                             {                                
  1050.                                 WCHAR* cFilterLeft = lpRI->szFilter;
  1051.                                 while (cFilterLeft)
  1052.                                 {
  1053.                                     WCHAR* cFilterRight = lstrstr(cFilterLeft, L" ");
  1054.                                     if (cFilterRight)
  1055.                                         cFilterRight[0] = L'\0';
  1056.                                     if (lstrstr(szTitle, cFilterLeft))
  1057.                                     {
  1058.                                         if (cFilterRight)
  1059.                                             cFilterRight[0] = L' ';
  1060.                                         bBreak = TRUE;
  1061.                                         break;
  1062.                                     }
  1063.                                     if (cFilterRight)
  1064.                                     {
  1065.                                         cFilterRight[0] = L' ';
  1066.                                         cFilterLeft = cFilterRight + 1;
  1067.                                         while (cFilterLeft[0] == L' ')
  1068.                                         {
  1069.                                             cFilterLeft++;
  1070.                                         }
  1071.                                     }
  1072.                                     else
  1073.                                         cFilterLeft = 0;
  1074.                                 }
  1075.                             }
  1076.                         }
  1077.                     }
  1078.                 }
  1079.                 if (bBreak)
  1080.                 {
  1081.                     cStart = lstrstr(cStart, L"feed-row-wide");
  1082.                     continue;
  1083.                 }
  1084.                 WCHAR* cTalk = lstrstr(cStart, L"z-icon-talk-o-thin");
  1085.                 if (cTalk)
  1086.                 {
  1087.                     WCHAR* cTalkLeft = lstrstr(cTalk, L"i>");
  1088.                     if (cTalkLeft)
  1089.                     {
  1090.                         cTalkLeft += 2;
  1091.                         lTalk = my_wtoi(cTalkLeft);
  1092.                     }
  1093.                 }
  1094.                 if (!bPost || !bList)
  1095.                 {
  1096.                     WCHAR* cPrice = lstrstr(cStart, L"z-highlight");
  1097.                     if (cPrice)
  1098.                     {
  1099.                         WCHAR* cPriceLeft = lstrstr(cPrice, L">");
  1100.                         if (cPriceLeft)
  1101.                         {
  1102.                             cPriceLeft += 1;
  1103.                             fPrice = my_wtof(cPriceLeft);
  1104.                         }
  1105.                     }

  1106.                     WCHAR* cDescripe = lstrstr(cStart, L"feed-block-descripe-top");
  1107.                     if (cDescripe)
  1108.                     {
  1109.                         WCHAR* cDescripeLeft = lstrstr(cDescripe, L">");
  1110.                         if (cDescripeLeft)
  1111.                         {
  1112.                             cDescripeLeft += 1;
  1113.                             while (cDescripeLeft[0] == L' ' || cDescripeLeft[0] == L'\r' || cDescripeLeft[0] == L'\n')
  1114.                             {
  1115.                                 cDescripeLeft += 1;
  1116.                             }
  1117.                             WCHAR* cDescripeRight = lstrstr(cDescripeLeft, L"</div");
  1118.                             if (cDescripeRight)
  1119.                             {
  1120.                                 size_t sCount = cDescripeRight - cDescripeLeft + 1;
  1121.                                 if (sCount >= 512)
  1122.                                     sCount = 511;
  1123.                                 lstrcpyn(szDescripe, cDescripeLeft, sCount);
  1124.                             }
  1125.                         }
  1126.                     }

  1127.                     WCHAR* cZhi = lstrstr(cStart, L"z-icon-zhi-o-thin");
  1128.                     if (cZhi)
  1129.                     {
  1130.                         WCHAR* cZhiLeft = lstrstr(cZhi, L"span");
  1131.                         if (cZhiLeft)
  1132.                         {
  1133.                             cZhiLeft += 5;
  1134.                             lZhi = my_wtoi(cZhiLeft);
  1135.                         }
  1136.                     }

  1137.                     WCHAR* cBuZhi = lstrstr(cStart, L"z-icon-buzhi-o-thin");
  1138.                     if (cBuZhi)
  1139.                     {
  1140.                         WCHAR* cBuZhiLeft = lstrstr(cBuZhi, L"span");
  1141.                         if (cBuZhiLeft)
  1142.                         {
  1143.                             cBuZhiLeft += 5;
  1144.                             lBuZhi = my_wtoi(cBuZhiLeft);
  1145.                         }
  1146.                     }

  1147.                     WCHAR* cStar = lstrstr(cStart, L"z-icon-star-o-thin");
  1148.                     if (cStar)
  1149.                     {
  1150.                         WCHAR* cStarLeft = lstrstr(cStar, L"i>");
  1151.                         if (cStarLeft)
  1152.                         {
  1153.                             cStarLeft += 2;
  1154.                             lStar = my_wtoi(cStarLeft);
  1155.                         }
  1156.                     }
  1157.                     WCHAR* cGoPath = lstrstr(cStart, L"go_path");
  1158.                     if (cGoPath)
  1159.                     {
  1160.                         WCHAR* cGoPathLeft = lstrstr(cGoPath, L":");
  1161.                         if (cGoPathLeft)
  1162.                         {
  1163.                             cGoPathLeft += 2;
  1164.                             WCHAR* cGoPathRight = lstrstr(cGoPathLeft, L"\'");
  1165.                             if (cGoPathRight)
  1166.                             {
  1167.                                 __int64 n = cGoPathRight - cGoPathLeft + 1;
  1168.                                 if (n > 511)
  1169.                                     n = 511;
  1170.                                 lstrcpyn(szGoPath, cGoPathLeft, n);
  1171.                             }
  1172.                         }
  1173.                     }
  1174.                 }
  1175.                 else
  1176.                 {
  1177.                     WCHAR* cZhi = lstrstr(cStart, L"z-icon-thumb-up-o-thin");
  1178.                     if (cZhi)
  1179.                     {
  1180.                         WCHAR* cZhiLeft = lstrstr(cZhi, L"number">");
  1181.                         if (cZhiLeft)
  1182.                         {
  1183.                             cZhiLeft += 8;
  1184.                             lZhi = my_wtoi(cZhiLeft);
  1185.                         }
  1186.                     }
  1187.                     WCHAR* cStar = lstrstr(cStart, L"z-icon-star-o-thin");
  1188.                     if (cStar)
  1189.                     {
  1190.                         WCHAR* cStarLeft = lstrstr(cStar, L"span>");
  1191.                         if (cStarLeft)
  1192.                         {
  1193.                             cStarLeft += 5;
  1194.                             lStar = my_wtoi(cStarLeft);
  1195.                         }
  1196.                     }
  1197.                     WCHAR* cBusiness = lstrstr(cStart, L"z-avatar-name");
  1198.                     if (cBusiness)
  1199.                     {
  1200.                         WCHAR* cBusinessLeft = lstrstr(cBusiness, L">");
  1201.                         if (cBusinessLeft)
  1202.                         {
  1203.                             cBusinessLeft += 1;
  1204.                             WCHAR* cBusinessRight = lstrstr(cBusinessLeft, L"</");
  1205.                             if (cBusinessRight)
  1206.                             {
  1207.                                 __int64 n = cBusinessRight - cBusinessLeft + 1;
  1208.                                 if (n > 16)
  1209.                                     n = 16;
  1210.                                 lstrcpyn(szBusiness, cBusinessLeft, n);
  1211.                             }
  1212.                         }
  1213.                     }
  1214.                 }
  1215.                 WCHAR* cTime = lstrstr(cStart, L"feed-block-extras");
  1216.                 if (cTime)
  1217.                 {
  1218.                     cTime = lstrstr(cTime, L">");
  1219.                     if (cTime)
  1220.                     {
  1221.                         WCHAR* cDateLeft = lstrstr(cTime, L"-");
  1222.                         WCHAR* cTimeLeft = lstrstr(cTime, L":");
  1223.                         if (cDateLeft && cDateLeft < cTimeLeft)
  1224.                         {
  1225.                             if (cDateLeft[3] == L'-')
  1226.                             {
  1227.                                 st.wYear = my_wtoi(cDateLeft - 4);
  1228.                                 cDateLeft += 3;
  1229.                                 cTimeLeft = NULL;
  1230.                                 st.wHour = 0;
  1231.                                 st.wMinute = 0;
  1232.                             }
  1233.                             WCHAR* cDateRight = cDateLeft + 1;
  1234.                             cDateLeft -= 2;
  1235.                             st.wMonth = my_wtoi(cDateLeft);
  1236.                             st.wDay = my_wtoi(cDateRight);
  1237.                         }
  1238.                         if (cTimeLeft)
  1239.                         {
  1240.                             WCHAR* cTimeRight = cTimeLeft + 1;
  1241.                             cTimeLeft -= 2;
  1242.                             st.wHour = my_wtoi(cTimeLeft);
  1243.                             st.wMinute = my_wtoi(cTimeRight);
  1244.                             /*
  1245.                                             while (cTimeRight[0] != L' ')
  1246.                                             {
  1247.                                                 cTimeRight += 1;
  1248.                                             }
  1249.                                             lstrcpyn(szTime, cTimeLeft, cTimeRight - cTimeLeft+1);
  1250.                             */
  1251.                         }
  1252.                         SystemTimeToFileTime(&st, (FILETIME*)&ft2);
  1253.                         if (ft1 > ft2 && !bList&& lpRI->uid != 0)
  1254.                             break;
  1255.                         if (lpRI->uid == 0)
  1256.                             lpRI->uid = iID;
  1257.                         if (!bPost || !bList)
  1258.                         {
  1259.                             WCHAR* cBusiness = lstrstr(cTime, L"<span");
  1260.                             if (cBusiness)
  1261.                             {
  1262.                                 WCHAR* cBusinessLeft = lstrstr(cBusiness, L">");
  1263.                                 if (cBusinessLeft)
  1264.                                 {
  1265.                                     cBusinessLeft += 1;
  1266.                                     while (cBusinessLeft[0] == L' ' || cBusinessLeft[0] == L'\r' || cBusinessLeft[0] == L'\n')
  1267.                                     {
  1268.                                         cBusinessLeft += 1;
  1269.                                     }
  1270.                                     WCHAR* cBusinessRight = cBusinessLeft;
  1271.                                     while (cBusinessRight[0] != L' ')
  1272.                                     {
  1273.                                         cBusinessRight += 1;
  1274.                                     }
  1275.                                     __int64 n = cBusinessRight - cBusinessLeft + 1;
  1276.                                     if (n > 16)
  1277.                                         n = 16;
  1278.                                     lstrcpyn(szBusiness, cBusinessLeft, n);
  1279.                                 }
  1280.                             }
  1281.                         }
  1282.                     }
  1283.                 }
  1284.                 if (bList)
  1285.                 {
  1286.                     WCHAR sz[64];
  1287.                     LVITEM li = { 0 };
  1288.                     int iSub = 0;
  1289.                     li.mask = LVIF_TEXT;
  1290.                     li.pszText = szTitle;
  1291.                     li.iSubItem = iSub++;
  1292.                     li.iItem = ListView_GetItemCount(hList);
  1293.                     li.iItem = ListView_InsertItem(hList, &li);
  1294.                     li.pszText = szDescripe;
  1295.                     li.iSubItem = iSub++;
  1296. //                    ListView_SetItem(hList, &li);
  1297.                     int p = fPrice * 100;
  1298.                     wsprintf(sz, L"%d.%2.2d", p / 100, p % 100);
  1299.                     li.pszText = sz;
  1300.                     li.iSubItem = iSub++;
  1301.                     ListView_SetItem(hList, &li);
  1302.                     li.pszText = szImg;
  1303.                     li.iSubItem = iSub++;
  1304. //                    ListView_SetItem(hList, &li);
  1305.                     wsprintf(sz, L"%d", lZhi);
  1306.                     li.pszText = sz;
  1307.                     li.iSubItem = iSub++;
  1308.                     ListView_SetItem(hList, &li);
  1309.                     wsprintf(sz, L"%d", lBuZhi);
  1310.                     li.pszText = sz;
  1311.                     li.iSubItem = iSub++;
  1312.                     ListView_SetItem(hList, &li);
  1313.                     wsprintf(sz, L"%d", lStar);
  1314.                     li.pszText = sz;
  1315.                     li.iSubItem = iSub++;
  1316.                     ListView_SetItem(hList, &li);
  1317.                     wsprintf(sz, L"%d", lTalk);
  1318.                     li.pszText = sz;
  1319.                     li.iSubItem = iSub++;
  1320.                     ListView_SetItem(hList, &li);
  1321.                     wsprintf(sz, L"%d-%2.2d-%2.2d %2.2d:%2.2d",st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute);
  1322.                     li.pszText = sz;
  1323.                     li.iSubItem = iSub++;
  1324.                     ListView_SetItem(hList, &li);
  1325.                     li.pszText = szBusiness;
  1326.                     li.iSubItem = iSub++;
  1327.                     ListView_SetItem(hList, &li);
  1328.                     li.pszText = szLink;
  1329.                     li.iSubItem = iSub++;
  1330.                     ListView_SetItem(hList, &li);
  1331.                     li.pszText = szGoPath;
  1332.                     li.iSubItem = iSub++;
  1333.                     ListView_SetItem(hList, &li);     
  1334. //                    WCHAR szToken[] = L"SCT152372TQlJTExCGuU63HYmj8Uargtjb";
  1335. //                    SendServerJ(szToken, szTitle, szDescripe, szLink, fPrice, szBusiness, szImg);
  1336.                      
  1337.                 }
  1338.                 else
  1339.                 {
  1340.                     WCHAR wTitle[192],wDescripe[666];
  1341.                     int p = fPrice * 100;
  1342.                     wsprintf(wTitle, L"%d.%2.2d元 %s %s", p / 100, p % 100, szTitle, szBusiness);
  1343.                     wsprintf(wDescripe, L"~%s~ %s", lpRI->szKey, szDescripe);
  1344.                     if (RemindSave.bTips)
  1345.                     {
  1346.                         if (bNewTrayTips)
  1347.                         {
  1348.                             CreateDirectory(L"cache", NULL);
  1349.                             WCHAR wImg[MAX_PATH];
  1350.                             GetCurrentDirectory(MAX_PATH, wImg);
  1351.                             lstrcat(wImg, L"\\cache\");
  1352.                             WCHAR* wFileLeft = lstrstr(szImg+2, L"/");;
  1353.                             while (true)
  1354.                             {
  1355.                                 wFileLeft += 1;
  1356.                                 WCHAR * wFileRight = lstrstr(wFileLeft, L"/");
  1357.                                 if (!wFileRight)
  1358.                                     break;
  1359.                                 else
  1360.                                     wFileLeft = wFileRight;
  1361.                             }
  1362.                             lstrcat(wImg, wFileLeft);
  1363.                             winhttpDownload(szImg, wImg);
  1364.                             ShowToast(wTitle, wDescripe, wImg, szLink);
  1365.                         }
  1366.                         else
  1367.                         {

  1368.                             nid.uFlags =NIF_MESSAGE | NIF_INFO|NIF_TIP|NIF_ICON;
  1369. //                            nid.dwState = NIS_SHAREDICON;
  1370. //                            nid.dwStateMask = NIS_SHAREDICON;
  1371. //                          nid.uVersion = NOTIFYICON_VERSION_4;
  1372. //                          nid.hBalloonIcon = iMain;
  1373.                             nid.dwInfoFlags = NIIF_NONE;
  1374. //                            nid.uID = tid;
  1375.                             nid.uTimeout = tid;
  1376.                             lstrcpyn(nid.szInfoTitle, wTitle, 63);
  1377.                             lstrcpyn(nid.szInfo, wDescripe, 255);
  1378.                             Shell_NotifyIcon(NIM_MODIFY, &nid);
  1379. //                            Shell_NotifyIcon(NIM_SETVERSION, &nid);
  1380.                         }
  1381.                     }
  1382.                     if (RemindSave.bDingDing)
  1383.                     {
  1384.                         SendDingDing(RemindSave.szDingDingToken, wTitle, wDescripe, szLink, szImg);
  1385.                     }
  1386.                     if (RemindSave.bWeChat)
  1387.                     {
  1388.                         SendWeChatPusher(RemindSave.szWeChatUserID, wTitle, wDescripe, szLink, szImg);
  1389.                     }
  1390.                     if (RemindSave.bWxPusher)
  1391.                     {
  1392.                         SendWxPusher(RemindSave.szWxPusherUID, wTitle, wDescripe, szLink, szImg);
  1393.                     }
  1394.                     if (RemindSave.bDirectly)
  1395.                         ShellExecute(NULL, L"open", szLink, NULL, NULL, SW_SHOWNOACTIVATE);

  1396.                 }
  1397.             }
  1398.             else
  1399.                 cStart += 2;
  1400.             cStart = lstrstr(cStart, L"feed-row-wide");
  1401.         }
  1402.         if (bList)
  1403.             SendMessage(hList, WM_SETREDRAW, TRUE, FALSE);
  1404.         if (iID != 0)
  1405.             lpRI->uid = iID;
  1406.         delete[] szOutBuffer;
  1407.     }
  1408.     delete[] pszOutBuffer;
  1409.     // Close any open handles.
  1410.     if (hRequest) WinHttpCloseHandle(hRequest);
  1411.     if (hConnect) WinHttpCloseHandle(hConnect);
  1412.     if (hSession) WinHttpCloseHandle(hSession);
  1413.     return bResults;
  1414. }
  1415. int iReset = 11;
  1416. #ifndef _DEBUG
  1417. extern "C" void WinMainCRTStartup()
  1418. {
  1419. #else
  1420. int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
  1421.                      _In_opt_ HINSTANCE hPrevInstance,
  1422.                      _In_ LPWSTR    lpCmdLine,
  1423.                      _In_ int       nCmdShow)
  1424. {
  1425.     UNREFERENCED_PARAMETER(hPrevInstance);
  1426.     UNREFERENCED_PARAMETER(lpCmdLine);
  1427. #endif
  1428. #ifdef NDEBUG
  1429.     if (OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, szAppName) == NULL)/////////////////////////创建守护进程
  1430.     {
  1431.         HANDLE hMap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(BOOL), szAppName);
  1432.         if (hMap)
  1433.         {
  1434.             lpRemindData = (REMINDDATA*)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(REMINDDATA));
  1435.             ZeroMemory(lpRemindData, sizeof(REMINDDATA));
  1436.             while (lpRemindData->bExit == FALSE&&iReset!=0)
  1437.             {
  1438.                 HANDLE hProcess;
  1439.                 RunProcess(0, 0, &hProcess);
  1440.                 EmptyProcessMemory(NULL);;
  1441.                 WaitForSingleObject(hProcess, INFINITE);
  1442.                 CloseHandle(hProcess);
  1443.                 iReset--;
  1444.             }
  1445.             UnmapViewOfFile(lpRemindData);
  1446.             CloseHandle(hMap);
  1447.             ExitProcess(0);
  1448.             return;
  1449.         }
  1450.     }
  1451. #endif
  1452.     hMap = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, szAppName);
  1453.     if (hMap)
  1454.     {
  1455.         lpRemindData = (REMINDDATA*)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(REMINDDATA));
  1456.     }
  1457. #ifdef NDEBUG
  1458. #else
  1459.     else
  1460.     {
  1461.         hMap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(BOOL), szAppName);
  1462.         lpRemindData = (REMINDDATA*)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(REMINDDATA));
  1463.         ZeroMemory(lpRemindData, sizeof(REMINDDATA));
  1464.     }
  1465. #endif // !DAEMON
  1466.     typedef WINUSERAPI DWORD WINAPI RTLGETVERSION(PRTL_OSVERSIONINFOW  lpVersionInformation);
  1467.     rovi.dwOSVersionInfoSize = sizeof(rovi);
  1468.     RTLGETVERSION* RtlGetVersion = (RTLGETVERSION*)GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "RtlGetVersion");
  1469.     if (RtlGetVersion)
  1470.         RtlGetVersion(&rovi);
  1471.     hMutex = CreateMutex(NULL, TRUE, L"_SmzdmRemind_");
  1472.     if (hMutex != NULL)
  1473.     {
  1474.         if (ERROR_ALREADY_EXISTS != GetLastError())
  1475.         {
  1476. /*
  1477.             INITCOMMONCONTROLSEX icce;
  1478.             icce.dwSize = sizeof INITCOMMONCONTROLSEX;
  1479.             icce.dwICC = ICC_LISTVIEW_CLASSES;
  1480.             InitCommonControlsEx(&icce);
  1481. */
  1482.             hInst = GetModuleHandle(NULL);
  1483.             // 执行应用程序初始化:
  1484.             if (!InitInstance(hInst, SW_SHOW))
  1485.             {
  1486.                 return;
  1487.             }


  1488.             MSG msg;

  1489.             // 主消息循环:
  1490.             while (GetMessage(&msg, nullptr, 0, 0))
  1491.             {
  1492.                 if (!IsDialogMessage(hMain, &msg))
  1493.                 {
  1494.                     TranslateMessage(&msg);
  1495.                     DispatchMessage(&msg);
  1496.                 }
  1497.             }
  1498.             bExit = TRUE;
  1499.             CloseHandle(hGetDataThread);
  1500.             Shell_NotifyIcon(NIM_DELETE, &nid);
  1501.             DestroyIcon(iMain);
  1502. //            DestroyIcon(iTray);
  1503.             CloseHandle(hMap);
  1504.             hMap = NULL;
  1505.             if (hMutex)
  1506.                 CloseHandle(hMutex);
  1507. //            return (int)msg.wParam;
  1508.         }
  1509.         else
  1510.         {
  1511.             LoadString(hInst, IDS_TIPS, nid.szTip, 88);
  1512.             HWND hWnd = FindWindow(NULL, nid.szTip);
  1513.             if (hWnd)
  1514.             {
  1515.                 ShowWindow(hWnd, SW_SHOW);
  1516.                 SetForeground(hWnd);
  1517.             }
  1518.         }
  1519.     }
  1520.     if (hMap)
  1521.         CloseHandle(hMap);
  1522.     ExitProcess(0);
  1523. }
  1524. DWORD WINAPI GetDataThreadProc(PVOID pParam)//获取网站数据线程
  1525. {
  1526.     while (!bExit)
  1527.     {
  1528.         DWORD dStart = GetTickCount();
  1529.         if (!bOpen)
  1530.         {
  1531.             dStart -= iTimes[RemindSave.iTime] * 60000;
  1532.             dStart += 8888;
  1533.         }
  1534.         while (true)
  1535.         {
  1536.             DWORD dTime = GetTickCount() - dStart;
  1537.             if (dTime > iTimes[RemindSave.iTime] * 60000)
  1538.                 break;
  1539.             else
  1540.                 Sleep(988);
  1541.             WCHAR sz[16];
  1542.             wsprintf(sz, L"%d秒后获取", (iTimes[RemindSave.iTime] * 60000 - dTime) / 1000);
  1543.             SetDlgItemText(hMain, IDC_STATIC_COUNTDOWN, sz);
  1544.             if (bResetTime)
  1545.             {
  1546.                 dStart = GetTickCount();
  1547.                 dStart -= iTimes[RemindSave.iTime] * 60000;
  1548.                 dStart += 8888;
  1549.                 bResetTime = FALSE;
  1550.             }
  1551.         }
  1552.         bGetData = TRUE;
  1553.         SetWindowText(hMain, L"正在从网站获取并处理数据请稍后...");
  1554.         int n = riSize / sizeof REMINDITEM;
  1555.         for (int i = 0; i < n; i++)
  1556.         {
  1557.             if (!lpRemindItem[i].bNotUse)
  1558.                 SearchSMZDM(&lpRemindItem[i], FALSE, FALSE,FALSE);
  1559.         }
  1560.         WriteSet(NULL);
  1561.         SetWindowText(hMain, nid.szTip);
  1562.         bOpen = TRUE;
  1563.         bGetData = FALSE;
  1564.     }
  1565.     return TRUE;
  1566. }
  1567. //
  1568. //   函数: InitInstance(HINSTANCE, int)
  1569. //
  1570. //   目标: 保存实例句柄并创建主窗口
  1571. //
  1572. //   注释:
  1573. //
  1574. //        在此函数中,我们在全局变量中保存实例句柄并
  1575. //        创建和显示主程序窗口。
  1576. //
  1577. BOOL bInit = TRUE;
  1578. BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
  1579. {
  1580.     hInst = hInstance; // 将实例句柄存储在全局变量中   
  1581.     hMain = ::CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, (DLGPROC)MainProc);
  1582.     if (!hMain)
  1583.     {
  1584.         return FALSE;
  1585.     }
  1586.     iMain = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SMZDMREMIND));
  1587. //    iTray = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TRAY));
  1588.     SetClassLongPtr(hMain, -14, (LONG_PTR)iMain);
  1589.     SetClassLongPtr(hMain, -34, (LONG_PTR)iMain);
  1590.     //////////////////////////////////////////////////////////////////////////////////设置通知栏图标
  1591.     nid.cbSize = sizeof NOTIFYICONDATA;
  1592.     nid.uID = WM_IAWENTRAY;
  1593.     nid.hWnd = hMain;
  1594.     nid.hIcon = iMain;
  1595.     nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
  1596.     nid.uCallbackMessage = WM_IAWENTRAY;   
  1597.     LoadString(hInst, IDS_TIPS, nid.szTip, 88);
  1598.     Shell_NotifyIcon(NIM_ADD, &nid);   
  1599.     Shell_NotifyIcon(NIM_SETVERSION, &nid);
  1600.     hList = GetDlgItem(hMain, IDC_LIST);
  1601.     hListRemind = GetDlgItem(hMain, IDC_LIST_REMIND);
  1602.     ListView_SetExtendedListViewStyle(hList, LVS_EX_FULLROWSELECT |LVS_EX_GRIDLINES|LVS_EX_INFOTIP);
  1603.     ListView_SetExtendedListViewStyle(hListRemind, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES|LVS_EX_CHECKBOXES);
  1604.     LVCOLUMN lc;
  1605.     lc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT;
  1606.     WCHAR szTitle[][6] = { L"标题" ,L"描述" ,L"价格",L"图片",L"值/赞",L"不值",L"收藏",L"评论",L"时间",L"平台/作者",L"链接",L"直达"};
  1607.     int iTitle[] = { 505,0,66,0,45,45,45,45,123,138,238,68 };
  1608.     for (int i = 0; i < 12; i++)
  1609.     {
  1610.         lc.cx = iTitle[i];
  1611.         if(i==2|| i == 4 || i == 5 || i == 6 || i == 7)
  1612.             lc.fmt = LVCFMT_RIGHT;
  1613.         else if(i==1 || i == 3 || i == 10 || i == 11)
  1614.             lc.fmt = LVCFMT_LEFT;
  1615.         else
  1616.             lc.fmt = LVCFMT_CENTER;
  1617.         lc.pszText = szTitle[i];
  1618.         lc.iSubItem = i;
  1619.         ListView_InsertColumn(hList, i, &lc);
  1620.     }
  1621.     WCHAR szKey[][5] = { L"关键词",L"过滤词",L"最小价格",L"最大价格",L"平台"};
  1622.     int iKey[] = { 150,100,60,60,90};
  1623.     for (int i=0;i<5;i++)
  1624.     {
  1625.         lc.cx = iKey[i];
  1626.         lc.fmt = LVCFMT_CENTER;
  1627.         lc.pszText = szKey[i];
  1628.         lc.iSubItem = i;
  1629.         ListView_InsertColumn(hListRemind, i, &lc);
  1630.     }
  1631.     hCombo = GetDlgItem(hMain, IDC_COMBO);
  1632.     for (int i=0;i<24;i++)
  1633.     {
  1634.         SendMessage(hCombo, CB_ADDSTRING, NULL, (LPARAM)szBus[i]);
  1635.     }
  1636.     hComboTime = GetDlgItem(hMain, IDC_COMBO_TIME);
  1637.     for (int i=0;i<6;i++)
  1638.     {
  1639.         SendMessage(hComboTime, CB_ADDSTRING, NULL, (LPARAM)szTimes[i]);
  1640.     }
  1641.     hComboPage = GetDlgItem(hMain, IDC_COMBO_PAGE);
  1642.     for (int i = 0; i < 9; i++)
  1643.     {
  1644.         SendMessage(hComboPage, CB_ADDSTRING, NULL, (LPARAM)szPage[i]);
  1645.     }   
  1646.     ReadSet();
  1647.     SendMessage(hComboTime, CB_SETCURSEL, RemindSave.iTime, NULL);
  1648.     SendMessage(hComboPage, CB_SETCURSEL, RemindSave.iPage, NULL);
  1649.     CheckDlgButton(hMain, IDC_CHECK_OPEN_LINK, RemindSave.bDirectly);
  1650.     CheckDlgButton(hMain, IDC_CHECK_WXPUSHER, RemindSave.bWxPusher);
  1651.     CheckDlgButton(hMain, IDC_CHECK_TIPS, RemindSave.bTips);
  1652.     SetDlgItemText(hMain,IDC_UID, RemindSave.szWxPusherUID);
  1653.     CheckDlgButton(hMain, IDC_CHECK_WECHAT, RemindSave.bWeChat);
  1654.     SetDlgItemText(hMain, IDC_WECHAT_AID, RemindSave.szWeChatAgentId);
  1655.     SetDlgItemText(hMain, IDC_WECHAT_CORPID, RemindSave.szWeChatID);
  1656.     SetDlgItemText(hMain, IDC_WECHAT_SECRET,RemindSave.szWeChatSecret);
  1657.     SetDlgItemText(hMain, IDC_WECHAT_UID, RemindSave.szWeChatUserID);
  1658.     CheckDlgButton(hMain, IDC_CHECK_DINGDING, RemindSave.bDingDing);
  1659.     SetDlgItemText(hMain, IDC_ACCESS_TOKEN, RemindSave.szDingDingToken);
  1660.     CheckDlgButton(hMain, IDC_RADIO_LAST_SORT, RemindSave.bLastSort);
  1661.     CheckDlgButton(hMain, IDC_RADIO_SCORE_SORT, !RemindSave.bLastSort);
  1662.     CheckDlgButton(hMain, IDC_CHECK_AUTORUN, AutoRun(FALSE, FALSE, szAppName));
  1663.     if (riSize)
  1664.     {
  1665.         //  ListView_DeleteAllItems(hListRemind);
  1666.         int n = riSize / sizeof REMINDITEM;
  1667.         for (int i = 0; i < n; i++)
  1668.         {
  1669.             WCHAR sz[128];
  1670.             LVITEM li = { 0 };
  1671.             int iSub = 0;
  1672.             li.mask = LVIF_TEXT;
  1673.             li.pszText = lpRemindItem[i].szKey;
  1674.             li.iSubItem = iSub++;
  1675.             li.iItem = ListView_GetItemCount(hListRemind);
  1676.             li.iItem = ListView_InsertItem(hListRemind, &li);
  1677.             ListView_SetCheckState(hListRemind, li.iItem, !lpRemindItem[i].bNotUse);
  1678.             li.pszText = lpRemindItem[i].szFilter;
  1679.             li.iSubItem = iSub++;
  1680.             ListView_SetItem(hListRemind, &li);
  1681.             wsprintf(sz, L"%d", lpRemindItem[i].uMinPrice);
  1682.             li.pszText = sz;
  1683.             li.iSubItem = iSub++;
  1684.             ListView_SetItem(hListRemind, &li);
  1685.             wsprintf(sz, L"%d", lpRemindItem[i].uMaxPrice);
  1686.             li.pszText = sz;
  1687.             li.iSubItem = iSub++;
  1688.             ListView_SetItem(hListRemind, &li);
  1689.             li.pszText = szBus[lpRemindItem[i].iBusiness];
  1690.             li.iSubItem = iSub++;
  1691.             ListView_SetItem(hListRemind, &li);
  1692. /*
  1693.             wsprintf(sz, L"%d", lpRemindItem[i].iBusiness);
  1694.             li.pszText = sz;
  1695.             li.iSubItem = iSub++;
  1696.             ListView_SetItem(hListRemind, &li);
  1697. */
  1698.         }        
  1699.     }
  1700.     else
  1701.         ShowWindow(hMain, SW_SHOW);
  1702.     hGetDataThread = CreateThread(NULL, 0, GetDataThreadProc, 0, 0, 0);   
  1703.     if (RemindSave.bTips)
  1704.         LoadToast();
  1705. /*
  1706.     WinToast::isCompatible();
  1707.     WinToast::instance()->setAppName(szAppName);
  1708.     WinToast::instance()->setAppUserModelId(szAppName);
  1709.     bNewTrayTips = WinToast::instance()->initialize();
  1710. */
  1711.     bInit = FALSE;
  1712.     return TRUE;
  1713. }

  1714. //
  1715. //  函数: WndProc(HWND, UINT, WPARAM, LPARAM)
  1716. //
  1717. //  目标: 处理主窗口的消息。
  1718. //
  1719. //  WM_COMMAND  - 处理应用程序菜单
  1720. //  WM_PAINT    - 绘制主窗口
  1721. //  WM_DESTROY  - 发送退出消息并返回
  1722. //
  1723. //
  1724. LRESULT CALLBACK MainProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  1725. {
  1726.     switch (message)
  1727.     {
  1728.     case WM_INITDIALOG:
  1729.     {
  1730.     }
  1731.     return TRUE;
  1732. /*
  1733.     case WM_TIMER:
  1734.         if (wParam==3||wParam==6)
  1735.         {
  1736.             if (wParam == 6)
  1737.                 KillTimer(hWnd, wParam);
  1738.             SetWindowText(hMain, L"正在从网站获取并处理数据请稍后...");
  1739.             if(IsWindowVisible(hMain))
  1740.                 SetCursor(LoadCursor(NULL,IDC_WAIT));
  1741.             int n = riSize / sizeof REMINDITEM;
  1742.             for (int i=0;i<n;i++)
  1743.             {
  1744.                 if(!lpRemindItem[i].bNotUse)
  1745.                     SearchSMZDM(&lpRemindItem[i], FALSE,FALSE);
  1746.             }
  1747.             WriteSet(NULL);
  1748.             SetWindowText(hMain,nid.szTip);
  1749.             SetCursor(LoadCursor(NULL, IDC_ARROW));
  1750.             bOpen = TRUE;
  1751.             return TRUE;
  1752.         }
  1753.         break;
  1754. */
  1755.     case WM_IAWENTRAY:
  1756. //        if (HIWORD(lParam) == nid.uID)
  1757.         {
  1758.             if (LOWORD(lParam) == WM_LBUTTONDOWN || LOWORD(lParam) == WM_RBUTTONDOWN)
  1759.             {
  1760.                 SetFocus(GetDlgItem(hMain, IDC_KEY));
  1761.                 ShowWindow(hMain, SW_SHOW);
  1762.                 SetForeground(hMain);
  1763.             }
  1764.             else if (LOWORD(lParam) == NIN_BALLOONUSERCLICK && !RemindSave.bDirectly)
  1765.             {
  1766.                 WCHAR sz[128];
  1767.                 wsprintf(sz, L"https://www.smzdm.com/p/%d", nid.uID);
  1768.                 ShellExecute(NULL, L"open", sz, NULL, NULL, SW_SHOW);
  1769.             }
  1770.         }
  1771.         return TRUE;
  1772.     case WM_NOTIFY:
  1773.     {
  1774.         if (bInit)
  1775.             return FALSE;
  1776. /*
  1777.         if (wParam == IDC_SYSLINK1||wParam==IDC_SYSLINK2)
  1778.         {
  1779.             LPNMHDR lpnh = (LPNMHDR)lParam;
  1780.             if (lpnh->code == NM_CLICK || lpnh->code == NM_RETURN)
  1781.             {
  1782.                 CloseHandle(ShellExecute(NULL, L"open", L"http://810619.xyz:888/index.php?share/folder&user=1&sid=Zk2Ecwbt", NULL, NULL, SW_SHOW));
  1783.             }
  1784.         }
  1785. */
  1786.         if (wParam == IDC_LIST)
  1787.         {
  1788.             LPNMITEMACTIVATE lnia = (LPNMITEMACTIVATE)lParam;
  1789.             if (lnia->iItem != -1)
  1790.             {
  1791.                 if (lnia->hdr.code == NM_RCLICK)
  1792.                 {
  1793.                     WCHAR sz[256];
  1794.                     if (lnia->iSubItem == 11)
  1795.                     {
  1796.                         ListView_GetItemText(hList, lnia->iItem, 11, sz, 256);
  1797.                     }
  1798.                     else
  1799.                     {
  1800.                         ListView_GetItemText(hList, lnia->iItem, 10, sz, 256);
  1801.                     }
  1802.                     ShellExecute(NULL, L"open", sz, NULL, NULL, SW_SHOW);
  1803.                 }
  1804.             }
  1805.             else
  1806.             {
  1807.                 if (lnia->hdr.code == LVN_COLUMNCLICK)
  1808.                 {
  1809.                     if (lnia->iSubItem == 4 || lnia->iSubItem == 6 || lnia->iSubItem == 7)
  1810.                         bSort = FALSE;
  1811.                     ListView_SortItemsEx(hList, CompareFunc, lnia->iSubItem);
  1812.                     bSort = !bSort;
  1813. //                  ListView_SortItems(hList, CompareFunc, lnia->iSubItem);
  1814.                 }
  1815.             }
  1816.         }
  1817.         else if (wParam == IDC_LIST_REMIND)
  1818.         {
  1819.             LPNMITEMACTIVATE lnia = (LPNMITEMACTIVATE)lParam;
  1820.             if (lnia->iItem == -1 || lnia->iItem > riSize / sizeof REMINDITEM)
  1821.                 return FALSE;
  1822.             if (lnia->hdr.code == LVN_ITEMCHANGED)
  1823.             {
  1824.                  
  1825.                 DWORD o = lnia->uOldState & 0x2000;
  1826.                 DWORD n = lnia->uNewState & 0x2000;
  1827.                 if (o!=n)
  1828.                 {
  1829.                     BOOL bCheck = ListView_GetCheckState(hListRemind, lnia->iItem);
  1830.                     if (lpRemindItem[lnia->iItem].bNotUse == bCheck)
  1831.                     {
  1832.                         lpRemindItem[lnia->iItem].bNotUse = !bCheck;
  1833.                         WriteSet(NULL);
  1834.                     }
  1835.                 }
  1836.             }           
  1837.             if (lnia->hdr.code == NM_RCLICK)
  1838.             {
  1839.                 if (!bGetData)
  1840.                 {
  1841.                     if (MessageBox(hMain, L"确定要删除此项?", L"提示", MB_OKCANCEL | MB_ICONWARNING) == IDOK)
  1842.                     {
  1843.                         lpRemindItem[lnia->iItem].szKey[0] = L'\0';
  1844.                         ListView_DeleteItem(hListRemind, lnia->iItem);
  1845.                         WriteSet(NULL);
  1846.                         ReadSet();
  1847.                     }
  1848.                 }
  1849.             }
  1850.             else if (lnia->hdr.code == NM_CLICK)
  1851.             {
  1852.                 WCHAR sz[128];
  1853.                 SetDlgItemText(hMain, IDC_KEY, lpRemindItem[lnia->iItem].szKey);
  1854.                 SetDlgItemText(hMain, IDC_FILTER, lpRemindItem[lnia->iItem].szFilter);
  1855.                 ListView_GetItemText(hListRemind, lnia->iItem, 2, sz, 32);
  1856.                 SetDlgItemText(hMain, IDC_EDIT_MIN_PRICE, sz);
  1857.                 ListView_GetItemText(hListRemind, lnia->iItem, 3, sz, 32);
  1858.                 SetDlgItemText(hMain, IDC_EDIT_MAX_PRICE, sz);
  1859.                 SendMessage(hCombo, CB_SETCURSEL, lpRemindItem[lnia->iItem].iBusiness, NULL);
  1860.             }
  1861.         }
  1862.     }
  1863.     break;
  1864.     case WM_COMMAND:
  1865.         {
  1866.             int wmId = LOWORD(wParam);
  1867.             // 分析菜单选择:
  1868.             switch (wmId)
  1869.             {
  1870.             case IDC_BUTTON_LINK1:
  1871.             case IDC_BUTTON_LINK2:
  1872.             case IDC_BUTTON_LINK3:
  1873.             case IDC_BUTTON_LINK4:
  1874.             case IDC_BUTTON_LINK5:
  1875.             case IDC_BUTTON_LINK6:
  1876.             case IDC_BUTTON_LINK7:
  1877.             case IDC_BUTTON_LINK8:
  1878.             {
  1879.                 WCHAR szLink[][64] = { L"https://faxian.smzdm.com/9kuai9/h4s0t0f0p1/#filter-block",L"https://faxian.smzdm.com/h2s0t0f0c0p1/#filter-block",L"https://faxian.smzdm.com/h3s0t0f0c0p1/#filter-block",L"https://faxian.smzdm.com/h4s0t0f0c0p1/#filter-block",L"https://post.smzdm.com/",L"https://post.smzdm.com/hot_7/",L"https://test.smzdm.com/",L"https://duihuan.smzdm.com/"};
  1880.                 ShellExecute(NULL, L"open", szLink[wmId-IDC_BUTTON_LINK1], NULL, NULL, SW_SHOW);
  1881.             }
  1882.                 break;
  1883.             case IDC_REMIND:
  1884.             case IDC_SEARCH:
  1885.             case IDC_SMZDM_SEARCH:
  1886.             {
  1887.                 bInit = TRUE;
  1888.                 REMINDITEM ri={0};
  1889.                 WCHAR sz[128];
  1890.                 GetDlgItemText(hWnd, IDC_KEY, sz, 128);
  1891.                 WCHAR *szKey = sz;
  1892.                 while (szKey[0] == L' ')
  1893.                 {
  1894.                     szKey++;
  1895.                 }
  1896.                 if (lstrlen(szKey) == 0)
  1897.                     return FALSE;
  1898.                 lstrcpy(ri.szKey, szKey);
  1899.                 GetDlgItemText(hWnd, IDC_FILTER, sz, 128);
  1900.                 WCHAR* szFilter = sz;
  1901.                 while (szFilter[0]==L' ')
  1902.                 {
  1903.                     szFilter++;
  1904.                 }
  1905.                 lstrcpy(ri.szFilter, sz);
  1906.                 ri.iBusiness = (int)SendMessage(hCombo, CB_GETCURSEL, NULL, NULL);
  1907.                 bPost = IsDlgButtonChecked(hWnd, IDC_CHECK_POST);
  1908.                 RemindSave.bLastSort = IsDlgButtonChecked(hWnd, IDC_RADIO_LAST_SORT);
  1909.                 if (ri.iBusiness == -1)
  1910.                     ri.iBusiness = 0;
  1911.                 ri.uMinPrice = GetDlgItemInt(hWnd, IDC_EDIT_MIN_PRICE, NULL, TRUE);
  1912.                 ri.uMaxPrice = GetDlgItemInt(hWnd, IDC_EDIT_MAX_PRICE, NULL, TRUE);
  1913.                 if (wmId == IDC_SMZDM_SEARCH)
  1914.                 {
  1915.                     SearchSMZDM(&ri, TRUE, 0, TRUE);
  1916.                 }
  1917.                 else if (wmId == IDC_SEARCH)
  1918.                 {
  1919.                     SearchSMZDM(&ri, TRUE, 0,FALSE);
  1920.                     int n = (int)SendMessage(hComboPage, CB_GETCURSEL, NULL, NULL);
  1921.                     for (int i = 1; i <= n; i++)
  1922.                     {
  1923.                         SearchSMZDM(&ri, TRUE, i + 1,FALSE);
  1924.                     }
  1925.                 }
  1926.                 else if (!bGetData)
  1927.                 {
  1928.                     LVITEM li = { 0 };
  1929.                     li.mask = LVIF_TEXT;
  1930.                     BOOL bOur = FALSE;
  1931.                     int cur = ListView_GetNextItem(hListRemind, -1, LVNI_SELECTED);
  1932.                     int iSub = 0;
  1933.                     if (cur != -1)
  1934.                     {
  1935.                         ListView_GetItemText(hListRemind, cur, 0, sz, 127);

  1936.                         if (lstrcmp(ri.szKey, sz) == 0)
  1937.                             bOur = TRUE;
  1938.                     }
  1939.                     if (bOur)
  1940.                     {
  1941.                         li.iItem = cur;
  1942.                     }
  1943.                     else
  1944.                     {
  1945.                         li.pszText = ri.szKey;
  1946.                         li.iSubItem = iSub;
  1947.                         li.iItem = ListView_GetItemCount(hListRemind);
  1948.                         li.iItem = ListView_InsertItem(hListRemind, &li);
  1949.                         ListView_SetCheckState(hListRemind, li.iItem, TRUE);
  1950.                     }
  1951.                     iSub++;
  1952.                     li.pszText = ri.szFilter;
  1953.                     li.iSubItem = iSub++;
  1954.                     ListView_SetItem(hListRemind, &li);
  1955.                     wsprintf(sz, L"%d", ri.uMinPrice);
  1956.                     li.pszText = sz;
  1957.                     li.iSubItem = iSub++;
  1958.                     ListView_SetItem(hListRemind, &li);
  1959.                     wsprintf(sz, L"%d", ri.uMaxPrice);
  1960.                     li.pszText = sz;
  1961.                     li.iSubItem = iSub++;
  1962.                     ListView_SetItem(hListRemind, &li);
  1963.                     li.pszText = szBus[ri.iBusiness];
  1964.                     li.iSubItem = iSub++;
  1965.                     ListView_SetItem(hListRemind, &li);
  1966.                     if (bOur)
  1967.                     {
  1968.                         ri.uid = lpRemindItem[cur].uid;
  1969.                         ri.bNotUse = lpRemindItem[cur].bNotUse;
  1970.                         lpRemindItem[cur] = ri;
  1971.                         WriteSet(NULL);
  1972.                     }
  1973.                     else
  1974.                     {
  1975.                         WriteSet(&ri);
  1976.                         ListView_SetItemState(hListRemind, li.iItem, LVIS_SELECTED, LVIS_SELECTED);
  1977.                     }
  1978.                     ReadSet();
  1979.                 }
  1980.                 else
  1981.                     MessageBox(hMain,L"请稍等正在获取数据,等获取好了请再试一次!", L"提示", MB_OK);
  1982.                 bInit = FALSE;
  1983.             }
  1984.             break;
  1985.             case IDC_SAVE:
  1986.                 RemindSave.bDirectly = IsDlgButtonChecked(hWnd, IDC_CHECK_OPEN_LINK);
  1987.                 RemindSave.bWxPusher = IsDlgButtonChecked(hWnd, IDC_CHECK_WXPUSHER);
  1988.                 RemindSave.bTips = IsDlgButtonChecked(hWnd, IDC_CHECK_TIPS);
  1989.                 if (RemindSave.bTips)
  1990.                 {
  1991.                     if (!hWintoast)
  1992.                         LoadToast();
  1993.                 }
  1994.                 else
  1995.                 {
  1996.                     if (hWintoast)
  1997.                     {
  1998.                         FreeLibrary(hWintoast);
  1999.                         bNewTrayTips = FALSE;
  2000.                     }
  2001.                 }
  2002.                 GetDlgItemText(hWnd, IDC_UID, RemindSave.szWxPusherUID, 63);
  2003.                 RemindSave.bWeChat = IsDlgButtonChecked(hWnd, IDC_CHECK_WECHAT);
  2004.                 GetDlgItemText(hWnd, IDC_WECHAT_AID, RemindSave.szWeChatAgentId, 8);
  2005.                 GetDlgItemText(hWnd, IDC_WECHAT_CORPID, RemindSave.szWeChatID, 24);
  2006.                 GetDlgItemText(hWnd, IDC_WECHAT_SECRET, RemindSave.szWeChatSecret, 48);
  2007.                 GetDlgItemText(hWnd, IDC_WECHAT_UID, RemindSave.szWeChatUserID, 64);
  2008.                 RemindSave.bDingDing = IsDlgButtonChecked(hWnd, IDC_CHECK_DINGDING);
  2009.                 GetDlgItemText(hWnd, IDC_ACCESS_TOKEN, RemindSave.szDingDingToken, 80);
  2010.                 RemindSave.bLastSort = IsDlgButtonChecked(hWnd, IDC_RADIO_LAST_SORT);               
  2011.                 RemindSave.iTime = (int)SendMessage(hComboTime, CB_GETCURSEL, NULL, NULL);
  2012.                 RemindSave.iPage = (int)SendMessage(hComboPage, CB_GETCURSEL, NULL, NULL);
  2013.                 WriteSet(NULL);
  2014. /*
  2015.                 KillTimer(hMain, 3);
  2016.                 SetTimer(hMain, 3, iTimes[RemindSave.iTime] * 60000, NULL);
  2017.                 SetTimer(hMain, 6, 8888, NULL);
  2018. */
  2019.                 bResetTime = TRUE;
  2020.                 break;
  2021.             case IDC_CHECK_AUTORUN:
  2022.                 AutoRun(TRUE, IsDlgButtonChecked(hWnd, IDC_CHECK_AUTORUN), szAppName);
  2023.                 break;
  2024.             case IDC_EXIT:
  2025.                 if (MessageBox(hMain, L"确定要退出?退出后将无法推送!", L"提示", MB_OKCANCEL | MB_ICONQUESTION) == IDOK)
  2026.                 {
  2027.                     DestroyWindow(hWnd);
  2028.                     lpRemindData->bExit = TRUE;
  2029.                 }
  2030.                 break;
  2031.             case IDCLOSE:
  2032.             case IDCANCEL:
  2033.                 EmptyProcessMemory(NULL);
  2034.                 ListView_DeleteAllItems(hList);
  2035.                 ShowWindow(hWnd, SW_HIDE);
  2036.                 break;
  2037.             default:
  2038.                 return FALSE;
  2039.             }
  2040.         }
  2041.         return TRUE;
  2042.     case WM_DESTROY:
  2043.         PostQuitMessage(0);
  2044.         break;
  2045.     }
  2046.     return (INT_PTR)FALSE;
  2047. }
复制代码


回复

使用道具 举报

发表于 2023-6-29 18:20:59 | 显示全部楼层
123456833 2023-6-29 18:20:59 看全部
这东西我收了!谢谢楼主!知鸟论坛真好!
回复

使用道具 举报

发表于 2023-6-29 18:28:23 | 显示全部楼层
风吹吹蛋蛋疼风w 2023-6-29 18:28:23 看全部
既然你诚信诚意的推荐了,那我就勉为其难的看看吧!知鸟论坛不走平凡路。
回复

使用道具 举报

发表于 2023-6-29 23:52:05 | 显示全部楼层
xinting_6ym 2023-6-29 23:52:05 看全部
楼主太厉害了!楼主,I*老*虎*U!我觉得知鸟论坛真是个好地方!
回复

使用道具 举报

发表于 2023-6-30 00:17:26 | 显示全部楼层
丁侦球 2023-6-30 00:17:26 看全部
其实我一直觉得楼主的品味不错!呵呵!知鸟论坛太棒了!
回复

使用道具 举报

发表于 2023-6-30 21:07:45 | 显示全部楼层
冀苍鸾 2023-6-30 21:07:45 看全部
论坛不能没有像楼主这样的人才啊!我会一直支持知鸟论坛
回复

使用道具 举报

发表于 2023-7-3 12:23:14 | 显示全部楼层
123456823 2023-7-3 12:23:14 看全部
楼主发贴辛苦了,谢谢楼主分享!我觉得知鸟论坛是注册对了!
回复

使用道具 举报

发表于 2023-7-4 01:12:56 | 显示全部楼层
贰十岁装成熟装s 2023-7-4 01:12:56 看全部
楼主,大恩不言谢了!知鸟论坛是最棒的!
回复

使用道具 举报

发表于 2023-7-4 07:20:50 | 显示全部楼层
123456868 2023-7-4 07:20:50 看全部
楼主,大恩不言谢了!知鸟论坛是最棒的!
回复

使用道具 举报

发表于 2023-7-5 14:41:13 | 显示全部楼层
知足常乐77 2023-7-5 14:41:13 看全部
我看不错噢 谢谢楼主!知鸟论坛越来越好!
回复

使用道具 举报

  • 您可能感兴趣
点击右侧快捷回复 【请勿灌水】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则 返回列表

RSS订阅| SiteMap| 小黑屋| 知鸟论坛
联系邮箱E-mail:zniao@foxmail.com
快速回复 返回顶部 返回列表