BCB让用户访问指定微博或公众号文章的办法:字符串数组随机洗牌,形成每天幸运词组,测试用户的选择;正确后才能使用指定的功能

该博客介绍了如何为【轻松电脑伴侣】的特殊功能设置安全防护,用户需在微信公众号【自然的大千世界】找到每日指定文章中的幸运词组,正确输入后方能使用。这一措施增强了软件的安全性,同时也增加了用户参与互动的趣味性。

目标:为【轻松电脑伴侣】等黑科技功能加上一层保护罩,只有访问微信公众号【自然的大千世界】的指定文章才能继续使用。

使用标准词组列表集合的所有词组形成总集合,然后打乱顺序,生成未来一段时间内的幸运词组。

首先,点击Button2,然后点击Button3,最后点击Button4生成wordok.txt,保存号作为底牌次序。

然后,根据日期及时在微信公众号文章或微博文章中设置幸运词组,用户只有看过指定的微博或微信找到幸运词组后做出正确选择后,才能使用程序员设定的特别功能。

最后在【轻松电脑伴侣】工程内部,指定入口处添加幸运词组测试,如果词组正确则通过测试可以继续使用。

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include <stdlib.h>
#include "wxpassUnit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TListBox *mlist[24];
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
   TDateTime dd,dn;

   AnsiString mdate;

   mdate="2021-07-30";
   dd=StrToDate(mdate);

   AnsiString tt;
   int nr1,nr2;
   for(int i=0;i<365;i++)
   {
     tt=dd.FormatString("yyyymmdd");
     ListBox1->Items->Add(tt);
     dd=dd+1;
   }

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
   TDateTime dd,dn;

   AnsiString mdate;

   mdate="2021-07-29";
   dd=StrToDate(mdate);
   for(int k=0;k<23;k++)
   {
     for(int i=0;i<10;i++)
     {
       ListBox1->Items->Add(AnsiString(k)+" "+AnsiString(i)+" "+mlist[k]->Items->Strings[i]);
     }
   }

   ListBox1->Items->SaveToFile("wordall.txt");
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormCreate(TObject *Sender)
{

   for(int k=0;k<24;k++)
   {
     mlist[k]=new TListBox(Form1);
   }
   mlist[0]=ListBox2;
   mlist[1]=ListBox3;
   mlist[2]=ListBox4;
   mlist[3]=ListBox5;
   mlist[4]=ListBox6;
   mlist[5]=ListBox7;
   mlist[6]=ListBox8;
   mlist[7]=ListBox9;
   mlist[8]=ListBox10;
   mlist[9]=ListBox11;
   mlist[10]=ListBox12;
   mlist[11]=ListBox13;
   mlist[12]=ListBox14;
   mlist[13]=ListBox15;
   mlist[14]=ListBox16;
   mlist[15]=ListBox17;
   mlist[16]=ListBox18;
   mlist[17]=ListBox19;
   mlist[18]=ListBox21;
   mlist[19]=ListBox22;
   mlist[20]=ListBox23;
   mlist[21]=ListBox24;
   mlist[22]=ListBox25;

}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button3Click(TObject *Sender)
{
  int ns,lth;
  AnsiString ss,tt;
  lth=ListBox1->Items->Count;


  do
  {
    randomize();
    ns=random(lth);
    ss=ListBox1->Items->Strings[ns];
    ListBox20->Items->Add(ss);
    ListBox1->Items->Delete(ns);
    lth=ListBox1->Items->Count;
  }while(lth>0);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button4Click(TObject *Sender)
{
  int ns,lth;
  AnsiString ss,tt;
  lth=ListBox20->Items->Count;
  for(int k=0;k<lth;k++)
  {
    tt=ListBox1->Items->Strings[k];
    ss=ListBox20->Items->Strings[k];
    ListBox26->Items->Add(tt+" "+ss);
  }
  ListBox26->Items->SaveToFile("wordok.txt");
}
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------

#ifndef wxpassUnit1H
#define wxpassUnit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
        TListBox *ListBox1;
        TListBox *ListBox2;
        TListBox *ListBox3;
        TListBox *ListBox4;
        TListBox *ListBox5;
        TListBox *ListBox6;
        TListBox *ListBox7;
        TListBox *ListBox8;
        TListBox *ListBox9;
        TListBox *ListBox10;
        TListBox *ListBox11;
        TListBox *ListBox12;
        TListBox *ListBox13;
        TListBox *ListBox14;
        TListBox *ListBox15;
        TListBox *ListBox16;
        TListBox *ListBox17;
        TListBox *ListBox18;
        TListBox *ListBox19;
        TListBox *ListBox21;
        TListBox *ListBox22;
        TListBox *ListBox23;
        TListBox *ListBox24;
        TListBox *ListBox25;
        TButton *Button1;
        TButton *Button2;
        TListBox *ListBox20;
        TButton *Button3;
        TListBox *ListBox26;
        TButton *Button4;
        void __fastcall Button1Click(TObject *Sender);
        void __fastcall Button2Click(TObject *Sender);
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall Button3Click(TObject *Sender);
        void __fastcall Button4Click(TObject *Sender);
private:	// User declarations
public:		// User declarations
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

moneytree

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值