When to execute hashing function in Win32 app
-
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.
-
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.
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
-
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.
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++) -
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++)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
-
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++) -
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