Hello ;) Another time I scratch my head in :::confusion::: I have a dialog box... but while this dialog displays the code invoking this dialog keeps on running... Why's that? I'm tired it's 1:33am... what did I forgot as the code running after depends on flags I set up in this dialog.. #whoosh#
Posted on 2001-03-22 18:56:00 by JimmyClif
Sorry, I had posted a message, but totally misread your question. :) It's probably because you're stuck in an infinite (or nearly infinite) loop. Without any code to see, though, there's no way to make a diagnosis of exactly what's wrong with your programming. :) I would say, go through it step by step, keeping track of data and whatnot until you find the cause. Sometimes, it's a simple slip up (like using a local variable and thinking it's a global) that'll kill you. :) This message was edited by Racso, on 3/22/2001 9:13:13 PM
Posted on 2001-03-22 20:06:00 by Racso
"..the code invoking this dialog keeps on running" Do you mean you wanted a Modal box? "HEY, YOU DUMB USER THERE! Answer this box before you do anything else to my lovely program!" That sort of thing? You create a MODELESS dialog box by using the CreateDialog function. You create a MODAL dialog box by using the DialogBox function. Which one did you use? -------------------------- "Now, son, you donít want to drink beer. Thatís for daddys, and kids with fake I.D.s."
Posted on 2001-03-22 22:53:00 by Ernie
Yes.. I need a "Hey you DUMB User, set the Flags before the flow who invoked this Dialog can continue" Basically a Modal one... which sounds easy. I'll post what I tried... If called in the main window loop

invoke DialogBoxParam,hInstance,ADDR JimmyDLGName,hwnd,ADDR JimmyDLGProc,NULL
invoke MessageBox,0,ADDR AppName,ADDR AppName,0
it first displays the dialog, then after closing - it displays the MessageBox.. exactly how I want it to be. If I call the same in a procedure where I need it it continues happily it's code... Here is the DialogProc:

JimmyDLGProc proc hDlg:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

     .IF uMsg==WM_INITDIALOG
          invoke SetDlgItemText,hDlg,IDC_EDIT,ADDR szTemp
          
     .ELSEIF uMsg==WM_CLOSE
          mov GlobalFlag,FALSE
          invoke EndDialog,hDlg,0
          
     .ELSEIF uMsg==WM_COMMAND
          mov eax,wParam
          .IF eax==IDC_DoThis
               mov GlobalFlag,0
               invoke EndDialog,hDlg,0
          .ELSEIF eax==IDC_DoThat
               mov GlobalFlag,1
               invoke EndDialog,hDlg,0
          .ELSEIF eax==IDC_CANCEL
               mov GlobalFlag,FALSE
               invoke EndDialog,hDlg,0
          .ENDIF
     .ELSE
          mov eax,FALSE
          ret
     .ENDIF
     mov eax,TRUE
     ret
JimmyDLGProc endp

(I know it's not really good looking right now with these EndDialogs but I tried to reduce it now as my Dialog proc is huge) I see that it continues in the code as szTemp has always a different string in it which gets displayed at the EditField when getting the WM_INITDIALOG. So, for the moment my App continues running lightning fast thru the code after invoking DialogBoxParam and popping up dialog boxes one after another. Before I forget.. this is my DialogBox.rc

JimmyDlg DIALOG LOADONCALL PURE 9, 15, 171, 96
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_CENTER
CAPTION "Choose Wisely My Friend..."
FONT 10, "Times New Roman"
{
 PUSHBUTTON "DoThis", IDC_DoThis, 9, 62, 50, 11, WS_TABSTOP
 PUSHBUTTON "DoThat", IDC_DoThat,  108, 62, 50, 11, WS_TABSTOP
 CTEXT "What ya want to do today with it?", -1, 4, 9, 163, 8
 EDITTEXT IDC_EDIT, 9, 26, 153, 15,  ES_CENTER | WS_VISIBLE | WS_BORDER | ES_READONLY
 CTEXT "Pushing Cancel will ignore options for now.", -1,  7, 48, 155, 8
 PUSHBUTTON "CANCEL", IDC_CANCEL, 12, 80, 145, 11, WS_TABSTOP
}
I wonder why it works how I want it to be when invoked in the mainloop from a Menu (testing purposes) but acts completely different when invoked in my proc far far away from the mainloop. This message was edited by JimmyClif, on 3/23/2001 9:50:49 AM (I just made the lines smaller-ernie) This message was edited by Ernie, on 3/23/2001 12:32:55 PM
Posted on 2001-03-23 07:28:00 by JimmyClif