添加二维码自动打开

master
Kirigaya Kazuto 2018-01-18 01:26:07 +08:00
parent 2582249a57
commit 1b7588a98f
4 changed files with 22 additions and 2 deletions

View File

@ -314,6 +314,11 @@ int HTTPConnection::setPostData(const std::string& data)
return setPostData(data.c_str(),data.size());
}
int HTTPConnection::setFollowLocation(bool enable)
{
return invokeLib(curl_easy_setopt,_p->c,CURLOPT_FOLLOWLOCATION,enable?1:0);
}
int HTTPConnection::setMethod(Method m)
{
switch(m)

View File

@ -62,6 +62,7 @@ public:
int setOrigin(const std::string& origin);
int setPostData(const void* data,int sz);
int setPostData(const std::string& data);
int setFollowLocation(bool enable);/// disabled by default
enum class Method
{

View File

@ -9,6 +9,7 @@ using namespace nlohmann;
void Delay(int second);
string UTF8ToGBK(string UTF8String);
string GBKToUTF8(string GBKString);
void OpenQRCode();
const string USERAGENT="Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36";
@ -17,7 +18,6 @@ string qrsig;
int GetQRCode()
{
HTTPConnection t;
t.setVerbos(true);
t.setUserAgent(USERAGENT);
t.setURL("https://ssl.ptlogin2.qq.com/ptqrshow?appid=501004106&e=0&l=M&s=5&d=72&v=4&t=0.1");
t.setDataOutputFile("qrcode.png");
@ -32,6 +32,9 @@ int GetQRCode()
}
}
OpenQRCode();
printf("二维码已打开. 请使用手机扫描二维码进行登录.\n");
return 0;
}
@ -175,7 +178,8 @@ int GetVfWebQQ()
printf("VfWebQQBuff: %s\n",buff);
json j(buff);
/// 修复exception
json j=json::parse(buff);
vfwebqq=j["vfwebqq"];
return 0;
@ -201,6 +205,11 @@ int GetUinPsessionid()
return 0;
}
class Client
{
};
int main()
{
GetQRCode();

View File

@ -87,3 +87,8 @@ string GBKToUTF8(string GBKString)
delete[] utf8str;
return s;
}
void OpenQRCode()
{
ShellExecute(NULL,"open","qrcode.png",NULL,NULL,SW_SHOWMAXIMIZED);
}