{"id":28533,"date":"2024-11-25T14:35:16","date_gmt":"2024-11-25T06:35:16","guid":{"rendered":"https:\/\/fwq.ai\/blog\/28533\/"},"modified":"2024-11-25T14:35:16","modified_gmt":"2024-11-25T06:35:16","slug":"%e5%ae%9e%e7%8e%b0mfc%e7%ae%80%e5%8d%95%e7%9a%84%e5%8a%a0%e5%af%86%e8%a7%a3%e5%af%86%e5%b0%8f%e7%a8%8b%e5%ba%8f%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/28533\/","title":{"rendered":"\u5b9e\u73b0MFC\u7b80\u5355\u7684\u52a0\u5bc6\u89e3\u5bc6\u5c0f\u7a0b\u5e8f\u4ecb\u7ecd"},"content":{"rendered":"<p>\u7b80\u5355\u7684\u52a0\u5bc6\u89e3\u5bc6\u7b97\u6cd5<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u8fd9\u4e2a\u5c0f\u7a0b\u5e8f\u662f\u7528\u6765\u4f5c\u4e3a\u4e00\u4e2a\u975e\u5e38\u7b80\u5355\u7684\u5bf9\u79f0\u52a0\u5bc6\u7b97\u6cd5\uff0c\u6bd4\u79fb\u4f4d\u52a0\u5bc6\u7a0d\u5fae\u5f3a\u90a3\u4e48\u4e00\u70b9\u70b9\u3002<\/p>\n<p>seed\u7684\u8bdd\u5927\u5bb6\u53ef\u4ee5\u81ea\u5df1\u6765\u8bbe\u7f6e\uff0cseed\u5927\u6982\u4e3a60\u4f4d\uff0c\u7a0b\u5e8f\u6ca1\u6709\u8fb9\u754c\u68c0\u67e5\uff0c\u5f88\u7b80\u964b\uff0c\u5e0c\u671b\u770b\u5b98\u4eec\u522b\u89c1\u7b11\u3002<\/p>\n<pre>\/\/&nbsp;Code.h:&nbsp;interface&nbsp;for&nbsp;the&nbsp;CCode&nbsp;class.&nbsp;\r\n\/\/&nbsp;\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&nbsp;\r\n\r\n#if&nbsp;!defined(AFX_CODE_H__D5B90563_053E_4256_A61D_7D56F8FB20CF__INCLUDED_)&nbsp;\r\n#define&nbsp;AFX_CODE_H__D5B90563_053E_4256_A61D_7D56F8FB20CF__INCLUDED_&nbsp;\r\n\r\n#if&nbsp;_MSC_VER&nbsp;&amp;gt;&nbsp;1000&nbsp;\r\n#pragma&nbsp;once&nbsp;\r\n#endif&nbsp;\/\/&nbsp;_MSC_VER&nbsp;&amp;gt;&nbsp;1000&nbsp;\r\n\r\nclass&nbsp;CCode&nbsp;&nbsp;&nbsp;\r\n{&nbsp;\r\npublic:&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;CString&nbsp;Decode(CString&nbsp;strCode);&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;CString&nbsp;Encode(CString&nbsp;strCode);&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;CCode();&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;virtual&nbsp;~CCode();&nbsp;\r\n\r\nprivate:&nbsp;\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;CString&nbsp;EnDeCode(CString&nbsp;strCode);&nbsp;\r\n\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;iLength;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;char*&nbsp;&nbsp;&nbsp;&nbsp;szSeed2;&nbsp;\r\n};&nbsp;\r\n\r\n#endif&nbsp;\/\/&nbsp;!defined(AFX_CODE_H__D5B90563_053E_4256_A61D_7D56F8FB20CF__INCLUDED_)<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    <\/p>\n<pre>\/\/&nbsp;Code.cpp:&nbsp;implementation&nbsp;of&nbsp;the&nbsp;CCode&nbsp;class.&nbsp;\r\n\/\/&nbsp;\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&nbsp;\r\n\r\n#include&nbsp;\"stdafx.h\"&nbsp;\r\n#include&nbsp;\"DecodeEncode.h\"&nbsp;\r\n#include&nbsp;\"Code.h\"&nbsp;\r\n\r\n#ifdef&nbsp;_DEBUG&nbsp;\r\n#undef&nbsp;THIS_FILE&nbsp;\r\nstatic&nbsp;char&nbsp;THIS_FILE[]=__FILE__;&nbsp;\r\n#define&nbsp;new&nbsp;DEBUG_NEW&nbsp;\r\n#endif&nbsp;\r\n\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&nbsp;\r\n\/\/&nbsp;Construction\/Destruction&nbsp;\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&nbsp;\r\n\r\nCCode::CCode()&nbsp;\r\n{&nbsp;\r\n&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;iLength&nbsp;=&nbsp;0;&nbsp;\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;strTemp[60]&nbsp;={0x04,0x02,0x06,0x05,0x01,0x09,0x03,0x07,0x08,0x02,&nbsp;\r\n&nbsp;&nbsp;0x04,0x02,0x06,0x05,0x01,0x09,0x03,0x07,0x08,0x02,&nbsp;\r\n&nbsp;&nbsp;0x04,0x02,0x06,0x05,0x01,0x09,0x03,0x07,0x08,0x02,&nbsp;\r\n&nbsp;&nbsp;0x04,0x02,0x06,0x05,0x01,0x09,0x03,0x07,0x08,0x02,&nbsp;\r\n&nbsp;&nbsp;0x04,0x02,0x06,0x05,0x01,0x09,0x03,0x07,0x08,0x02,&nbsp;\r\n&nbsp;&nbsp;0x04,0x02,0x06,0x05,0x01,0x09,0x03,0x07,0x08,0x02};&nbsp;\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;szSeed2&nbsp;=&nbsp;new&nbsp;char[60];&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;memcpy(szSeed2,strTemp,60);&nbsp;\r\n&nbsp;&nbsp;\r\n}&nbsp;\r\n\r\nCCode::~CCode()&nbsp;\r\n{&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;delete[]&nbsp;szSeed2;&nbsp;\r\n}&nbsp;\r\n\r\nCString&nbsp;CCode::Encode(CString&nbsp;strCode)&nbsp;\r\n{&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;EnDeCode(strCode);&nbsp;\r\n}&nbsp;\r\n\r\nCString&nbsp;CCode::Decode(CString&nbsp;strCode)&nbsp;\r\n{&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;EnDeCode(strCode);&nbsp;\r\n}&nbsp;\r\n\r\nCString&nbsp;CCode::EnDeCode(&nbsp;CString&nbsp;strCode&nbsp;)&nbsp;\r\n{&nbsp;\r\n&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;LPCTSTR&nbsp;szSource&nbsp;=&nbsp;(LPCTSTR)&nbsp;strCode;&nbsp;\r\n&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;iLength&nbsp;=&nbsp;strCode.GetLength();&nbsp;\r\n\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;*szSeed&nbsp;=&nbsp;new&nbsp;char[iLength];&nbsp;\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;memcpy(szSeed,szSeed2,iLength);&nbsp;\r\n&nbsp;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;*&nbsp;szSr&nbsp;=&nbsp;new&nbsp;char[iLength];&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;*szDes&nbsp;=&nbsp;new&nbsp;char[iLength&nbsp;+&nbsp;1];&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;memcpy(szSr,szSource,iLength);&nbsp;\r\n&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;for(int&nbsp;i&nbsp;=&nbsp;0;i&nbsp;&lt;p&gt;\u6574\u4e2a\u7a0b\u5e8f\u4f7f\u7528\u8d77\u6765\u5f88\u7b80\u5355\uff0c\u5c31\u662f\u8c03\u7528\u4e00\u4e0b\u52a0\u5bc6\u89e3\u5bc6\u5c31\u884c\u4e86\u3002&lt;\/p&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5b9e\u73b0MFC\u7b80\u5355\u7684\u52a0\u5bc6\u89e3\u5bc6\u5c0f\u7a0b\u5e8f\u4ecb\u7ecd\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u5355\u7684\u52a0\u5bc6\u89e3\u5bc6\u7b97\u6cd5 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u8fd9\u4e2a\u5c0f\u7a0b\u5e8f\u662f\u7528\u6765\u4f5c\u4e3a\u4e00\u4e2a\u975e\u5e38\u7b80\u5355\u7684\u5bf9\u79f0\u52a0\u5bc6\u7b97\u6cd5\uff0c\u6bd4\u79fb\u4f4d\u52a0\u5bc6\u7a0d\u5fae\u5f3a\u90a3\u4e48\u4e00\u70b9\u70b9\u3002 seed\u7684\u8bdd\u5927\u5bb6\u53ef\u4ee5\u81ea\u5df1\u6765\u8bbe\u7f6e\uff0cseed\u5927\u6982\u4e3a60\u4f4d\uff0c\u7a0b\u5e8f\u6ca1\u6709\u8fb9\u754c\u68c0\u67e5\uff0c\u5f88\u7b80\u964b\uff0c\u5e0c\u671b\u770b\u5b98\u4eec\u522b\u89c1\u7b11\u3002 \/\/&nbsp;Code.h:&nbsp;interface&nbsp;for&nbsp;the&nbsp;CCode&nbsp;class.&nbsp; \/\/&nbsp; \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&nbsp; #if&nbsp;!defined(AFX_CODE_H__D5B90563_053E_4256_A61D_7D56F8FB20CF__INCLUDED_)&nbsp; #define&nbsp;AFX_CODE_H__D5B90563_053E_4256_A61D_7D56F8FB20CF__INCLUDED_&nbsp; #if&nbsp;_MSC_VER&nbsp;&amp;gt;&nbsp;1000&nbsp; #pragma&nbsp;once&nbsp; #endif&nbsp;\/\/&nbsp;_MSC_VER&nbsp;&amp;gt;&nbsp;1000&nbsp; class&nbsp;CCode&nbsp;&nbsp;&nbsp; {&nbsp; public:&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;CString&nbsp;Decode(CString&nbsp;strCode);&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;CString&nbsp;Encode(CString&nbsp;strCode);&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;CCode();&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;virtual&nbsp;~CCode();&nbsp; private:&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;CString&nbsp;EnDeCode(CString&nbsp;strCode);&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;iLength;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;char*&nbsp;&nbsp;&nbsp;&nbsp;szSeed2;&nbsp; };&nbsp; #endif&nbsp;\/\/&nbsp;!defined(AFX_CODE_H__D5B90563_053E_4256_A61D_7D56F8FB20CF__INCLUDED_) \u767b\u5f55\u540e\u590d\u5236 \/\/&nbsp;Code.cpp:&nbsp;implementation&nbsp;of&nbsp;the&nbsp;CCode&nbsp;class.&nbsp; \/\/&nbsp; \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&nbsp; #include&nbsp;&#8220;stdafx.h&#8221;&nbsp; #include&nbsp;&#8220;DecodeEncode.h&#8221;&nbsp; #include&nbsp;&#8220;Code.h&#8221;&nbsp; #ifdef&nbsp;_DEBUG&nbsp; #undef&nbsp;THIS_FILE&nbsp; static&nbsp;char&nbsp;THIS_FILE[]=__FILE__;&nbsp; #define&nbsp;new&nbsp;DEBUG_NEW&nbsp; #endif&nbsp; \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&nbsp; \/\/&nbsp;Construction\/Destruction&nbsp; \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&nbsp; CCode::CCode()&nbsp; {&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;iLength&nbsp;=&nbsp;0;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;strTemp[60]&nbsp;={0x04,0x02,0x06,0x05,0x01,0x09,0x03,0x07,0x08,0x02,&nbsp; &nbsp;&nbsp;0x04,0x02,0x06,0x05,0x01,0x09,0x03,0x07,0x08,0x02,&nbsp; &nbsp;&nbsp;0x04,0x02,0x06,0x05,0x01,0x09,0x03,0x07,0x08,0x02,&nbsp; &nbsp;&nbsp;0x04,0x02,0x06,0x05,0x01,0x09,0x03,0x07,0x08,0x02,&nbsp; &nbsp;&nbsp;0x04,0x02,0x06,0x05,0x01,0x09,0x03,0x07,0x08,0x02,&nbsp; &nbsp;&nbsp;0x04,0x02,0x06,0x05,0x01,0x09,0x03,0x07,0x08,0x02};&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;szSeed2&nbsp;=&nbsp;new&nbsp;char[60];&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;memcpy(szSeed2,strTemp,60);&nbsp; &nbsp;&nbsp; }&nbsp; CCode::~CCode()&nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-28533","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=28533"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28533\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=28533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=28533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=28533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}