Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. When to execute hashing function in Win32 app

When to execute hashing function in Win32 app

Scheduled Pinned Locked Moved C / C++ / MFC
cryptographyhelpquestion
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Patcher32
    wrote on last edited by
    #1

    Hello, I have a little Win32 Windows app in C. It accepts filename as argument and calculates MD5 hash for the file. The dialog based app should show up with MD5 calculated. When I put hashing function to be executed under WM_INITDIALOG it fails and MD5 hash is not calculated. When should I execute it? I have tried WM_PAINT but md5 hashing gets executed all time then. Please help when should I begin hashing in this app. I have VB6 background I remember I used to place all start up code under Form - OnLoad function. But in Win32 it is getting so hard. Please help a newbie.

    D _ 2 Replies Last reply
    0
    • P Patcher32

      Hello, I have a little Win32 Windows app in C. It accepts filename as argument and calculates MD5 hash for the file. The dialog based app should show up with MD5 calculated. When I put hashing function to be executed under WM_INITDIALOG it fails and MD5 hash is not calculated. When should I execute it? I have tried WM_PAINT but md5 hashing gets executed all time then. Please help when should I begin hashing in this app. I have VB6 background I remember I used to place all start up code under Form - OnLoad function. But in Win32 it is getting so hard. Please help a newbie.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      You can still do the processing in response to WM_INITDIALOG, but only indirectly. Consider something like:

      LRESULT CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
      {
      switch (uMsg)
      {
      case WM_INITDIALOG:
      PostMessage(hDlg, user_defined_message);
      break;
      case user_defined_message:
      // do MD5 processing
      break;
      default:
      return FALSE;
      }

      return TRUE;
      

      }

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      P 1 Reply Last reply
      0
      • P Patcher32

        Hello, I have a little Win32 Windows app in C. It accepts filename as argument and calculates MD5 hash for the file. The dialog based app should show up with MD5 calculated. When I put hashing function to be executed under WM_INITDIALOG it fails and MD5 hash is not calculated. When should I execute it? I have tried WM_PAINT but md5 hashing gets executed all time then. Please help when should I begin hashing in this app. I have VB6 background I remember I used to place all start up code under Form - OnLoad function. But in Win32 it is getting so hard. Please help a newbie.

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        Further to David's reply, take a look at how to send user defined message here - User Defined Messages in Visual C++[^]

        «_Superman_» I love work. It gives me something to do between weekends.
        Microsoft MVP (Visual C++)

        R L 2 Replies Last reply
        0
        • _ _Superman_

          Further to David's reply, take a look at how to send user defined message here - User Defined Messages in Visual C++[^]

          «_Superman_» I love work. It gives me something to do between weekends.
          Microsoft MVP (Visual C++)

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          Ugh... The dude is using things like WM_USER+1 to define a "unique message" and such 'technique' is bound to break some day. I'd use RegisterWindowMessage [^] instead...

          “Follow your bliss.” – Joseph Campbell

          1 Reply Last reply
          0
          • _ _Superman_

            Further to David's reply, take a look at how to send user defined message here - User Defined Messages in Visual C++[^]

            «_Superman_» I love work. It gives me something to do between weekends.
            Microsoft MVP (Visual C++)

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            No, very bad. Read Petzod and Richter for Win32 basics about messages

            1 Reply Last reply
            0
            • D David Crow

              You can still do the processing in response to WM_INITDIALOG, but only indirectly. Consider something like:

              LRESULT CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
              {
              switch (uMsg)
              {
              case WM_INITDIALOG:
              PostMessage(hDlg, user_defined_message);
              break;
              case user_defined_message:
              // do MD5 processing
              break;
              default:
              return FALSE;
              }

              return TRUE;
              

              }

              "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              P Offline
              P Offline
              Patcher32
              wrote on last edited by
              #6

              Thank you and others who took time to respond. Its working now :-)

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups