Click here to Skip to main content
15,887,256 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: RichEdit control in Dialog: "Retrun" does'nt Work ! Pin
stephen_young1-Aug-10 12:26
stephen_young1-Aug-10 12:26 
GeneralRe: RichEdit control in Dialog: "Retrun" does'nt Work ! Pin
Code-o-mat1-Aug-10 21:54
Code-o-mat1-Aug-10 21:54 
QuestionHow do I dock panes stacked on top of each other? Pin
Mattias G1-Aug-10 3:11
Mattias G1-Aug-10 3:11 
AnswerRe: How do I dock panes stacked on top of each other? Pin
Mattias G1-Aug-10 3:15
Mattias G1-Aug-10 3:15 
GeneralRe: How do I dock panes stacked on top of each other? Pin
Iain Clarke, Warrior Programmer3-Aug-10 2:12
Iain Clarke, Warrior Programmer3-Aug-10 2:12 
QuestionPlugin Abstract Interface idea Pin
saiyuk6=731-Jul-10 23:23
saiyuk6=731-Jul-10 23:23 
AnswerRe: Plugin Abstract Interface idea PinPopular
Moak1-Aug-10 0:55
Moak1-Aug-10 0:55 
GeneralRe: Plugin Abstract Interface idea Pin
saiyuk6=71-Aug-10 8:47
saiyuk6=71-Aug-10 8:47 
I shall take a look at the Polymorphism, i had planned on eventually making a large class factory. I wanted to implement a hash library.

example

class IHashAlgo {
public:
   virtual void Init() = 0;
   virtual void Update(PBYTE pData, INT nLength) = 0;
   virtual void Final() = 0;
   virtual void GetResults(PBYTE pData) = 0;
};


Abstract Class 1, would be MD5, the results would be the digest
Abstract Class 2, would be SHA1 ..... etc

I wanted to make a cleaner class library because it got really ugly when i was doing this
I hope you understand what i am trying to describe at least

class CHashAlgo {
public:
   void Init(INT nType) {
      m_Type = nType;
      switch (nType) {
         case HASHTYPE_MD5:
            MD5Init(&m_md5);
            break;
         case HASHTYPE_SHA1:
            SHA1Init(&m_sha1);
            break;
         default:
            break;
      }
   }
   void Update(PBYTE pData, INT nLength) {
      switch (nType) {
         case HASHTYPE_MD5:
            MD5Update(&m_md5, pData, nLength);
            break;
         case HASHTYPE_SHA1:
            SHA1Update(&m_sha1, pData, nLength);
            break;
         default:
            break;
      }
   }
   void Final() {
      switch (nType) {
         case HASHTYPE_MD5:
            MD5Final(&m_md5);
            break;
         case HASHTYPE_SHA1:
            SHA1Final(&m_sha1);
            break;
         default:
            break;
      }
   }
   void GetResults(PBYTE pData) {
      switch (nType) {
         case HASHTYPE_MD5:
            memcpy(pData, m_md5.digest, MD5_DIGEST_SIZE);
            break;
         case HASHTYPE_SHA1:
            memcpy(pData, m_sha1.digest, SHA1_DIGEST_SIZE);
            break;
         default:
            break;
      }
   }
   int m_Type;
   MD5_CONTEXT m_md5;
   SHA1_CONTEXT m_sha1;
};

GeneralRe: Plugin Abstract Interface idea Pin
Aescleal1-Aug-10 11:40
Aescleal1-Aug-10 11:40 
AnswerRe: Plugin Abstract Interface idea Pin
Aescleal1-Aug-10 6:58
Aescleal1-Aug-10 6:58 
GeneralRe: Plugin Abstract Interface idea Pin
saiyuk6=71-Aug-10 8:34
saiyuk6=71-Aug-10 8:34 
GeneralRe: Plugin Abstract Interface idea Pin
Aescleal1-Aug-10 11:24
Aescleal1-Aug-10 11:24 
AnswerRe: Plugin Abstract Interface idea Pin
KarstenK1-Aug-10 20:51
mveKarstenK1-Aug-10 20:51 
GeneralRe: Plugin Abstract Interface idea Pin
saiyuk6=71-Aug-10 22:43
saiyuk6=71-Aug-10 22:43 
QuestionChild Dialog Pin
john563231-Jul-10 0:31
john563231-Jul-10 0:31 
AnswerRe: Child Dialog Pin
Cool_Dev31-Jul-10 0:54
Cool_Dev31-Jul-10 0:54 
AnswerRe: Child Dialog Pin
Richard MacCutchan31-Jul-10 0:55
mveRichard MacCutchan31-Jul-10 0:55 
GeneralRe: Child Dialog Pin
Cool_Dev31-Jul-10 1:11
Cool_Dev31-Jul-10 1:11 
GeneralRe: Child Dialog Pin
Richard MacCutchan31-Jul-10 1:57
mveRichard MacCutchan31-Jul-10 1:57 
GeneralRe: Child Dialog Pin
Cool_Dev31-Jul-10 2:06
Cool_Dev31-Jul-10 2:06 
GeneralRe: Child Dialog Pin
Richard MacCutchan31-Jul-10 3:06
mveRichard MacCutchan31-Jul-10 3:06 
GeneralRe: Child Dialog Pin
Gary R. Wheeler31-Jul-10 10:25
Gary R. Wheeler31-Jul-10 10:25 
GeneralRe: Child Dialog Pin
Richard MacCutchan31-Jul-10 21:23
mveRichard MacCutchan31-Jul-10 21:23 
GeneralRe: Child Dialog Pin
Gary R. Wheeler31-Jul-10 23:43
Gary R. Wheeler31-Jul-10 23:43 
AnswerRe: Child Dialog Pin
Sauro Viti31-Jul-10 22:25
professionalSauro Viti31-Jul-10 22:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.