07-11-2014, 04:01 PM
I have a simple dialog box which has 1 listbox and 1 edit box
In the listbox I fill it with a list of exe files
I would like to select one of them and calculate its MD5 Hash value.
The result will be showed in the edit box.
So far
- I could populate the listbox with exe files.
- I could find the MD5 hash value for that exe file.
But I could not show it in the edit box, I did try this
s.setwintext(id(3, hDlg))
but I still don't see it appear on the edit box
I did verify by this
e3.getwintext(id(3, hDlg))
out e3
and see it there.
any suggestion?
Besides I would like the dialog to stay open not close after I press the OK button. What should I do?
Function dlg_MD5_Hash
In the listbox I fill it with a list of exe files
I would like to select one of them and calculate its MD5 Hash value.
The result will be showed in the edit box.
So far
- I could populate the listbox with exe files.
- I could find the MD5 hash value for that exe file.
But I could not show it in the edit box, I did try this
s.setwintext(id(3, hDlg))
but I still don't see it appear on the edit box
I did verify by this
e3.getwintext(id(3, hDlg))
out e3
and see it there.
any suggestion?
Besides I would like the dialog to stay open not close after I press the OK button. What should I do?
Function dlg_MD5_Hash
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str e3
if(!ShowDialog("dlg_MD5_Hash" &dlg_MD5_Hash &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 230 196 "Dialog"
;3 Edit 0x54030080 0x200 66 144 158 16 ""
;5 ListBox 0x54230109 0x200 6 9 218 128 ""
;4 Static 0x54000200 0x0 6 144 54 16 "MD5 Hash Value"
;1 Button 0x54030001 0x0 147 168 48 14 "OK"
;2 Button 0x54030000 0x0 87 168 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040108 "" "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,,ARRAY(str) exeList; int i
,,str initdir="$my qm$"
,,if(!BrowseForFolder(_s initdir 4)) ret
,,GetFilesInFolder exeList _s "*.exe"
,,for i 0 exeList.len-1
,,,LB_Add id(5 hDlg) exeList[i]
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 1
,,str item
,,LB_SelectedItem(id(5 hDlg) item)
,,str s.FileMD5(item 1)
,,s.setwintext(id(3, hDlg))
,,e3.getwintext(id(3, hDlg))
,,out e3
,,3
,case 2 end
,case IDOK
,case IDCANCEL
ret 1