Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to encrypt a dialog?
#1
What is the correct way to encrypt a dialog? I did this before ver 2.3.2.8 without problems - maybe 2.3.2.6. Now the encrypted dialog gives the error message,
Quote:Error (RT) in IDB_D_Dlg_Report: cannot create dialog. Macro not found or is encrypted.
First argument of ShowDialog must be name of macro or function that contains dialog definition (text that begins with BEGIN DIALOG). Or it can be variable that contains dialog definition.
But the unencrypted dialog runs fine. I see in help, the note...
Quote:Note 1: If you encrypt a macro that contains a dialog definition, the dialog will not work, unless the text is assigned to a variable which is passed to ShowDesktop (also use flag 2).
Is there guidelines for using ShowDesktop?
This is the initialization portion of my dialog. IDB_D_CanRun is from the shareware sample, with the key obscured.
Function IDB_D_Dlg_Report
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
;#exe addfunction "IDB_output_simulator"
#exe addfunction "IDB_D_UpdateCurrentPrices"
if(IDB_D_CanRun!=XXXXXXXXXX) end
if(hDlg) goto messages

str controls = "3"
str e3
if(!ShowDialog("IDB_D_Dlg_Report" &IDB_D_Dlg_Report &controls)) ret

;BEGIN DIALOG
;0 "" 0x90CA0AC8 0x0 0 0 353 295 "IDB Update Report"
;1 Button 0x54030001 0x4 300 274 48 14 "OK"
;5 msctls_progress32 0x54030000 0x20000 4 258 346 12 ""
;3 Edit 0x542308C4 0x200 4 2 346 254 ""
;4 Button 0x54032000 0x0 248 274 48 14 "Start"
;END DIALOG
;DIALOG EDITOR: "" 0x2030109 "" "" ""

ret
;messages
#2
Well, as usual, I figured it out after I posted my question. ShowDesktop should be ShowDialog in the Options: Security section of help, where there is adequate documentation under Dialog Editor -> Encrypted macros. One minor difference, keep the dlgproc parameter to ShowDialog, not 0 like in help. Out of curiosity, did something change about this behavior since the last release?

Function IDB_D_Dlg_Report
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
;#exe addfunction "IDB_output_simulator"
#exe addfunction "IDB_D_UpdateCurrentPrices"
;ShowDesktop()
if(IDB_D_CanRun!=XXXXXXXXXX) end
if(hDlg) goto messages

str dd =
;BEGIN DIALOG
;0 "" 0x90CA0AC8 0x0 0 0 353 295 "IDB Update Report"
;1 Button 0x54030001 0x4 300 274 48 14 "OK"
;5 msctls_progress32 0x54030000 0x20000 4 258 346 12 ""
;3 Edit 0x542308C4 0x200 4 2 346 254 ""
;4 Button 0x54032000 0x0 248 274 48 14 "Start"
;END DIALOG
;DIALOG EDITOR: "" 0x2030109 "" "" ""

str controls = "3"
str e3
if(!ShowDialog(dd &IDB_D_Dlg_Report &controls 0 2)) ret

ret
;messages
#3
Yes, ShowDialog, not ShowDesktop. Smile

Didn't change.


Forum Jump:


Users browsing this thread: 1 Guest(s)