Re: Modal and AOT exit dialog
Harold, I just checked in a framework for you to display the number of connected clients in the Exit box. All that is left for you to do is to go to windialogs.c/winExitDlgProc/WM_INITDIALOG and set the value to iConnectedClients to whatever the number of connected clients is. :) Thank you for the great help, I utilized the framework with a slight change that took iConnectedClients into ScreenPriv. (A file scope variable could be preferable since it is referenced only within windialog.c.) I also added the silent exit feature (actually the above feature is a by-product of this). If a user adds the line (just 1 word) SilentExit the Exit dialog won't appear when no client is connected. Of course, this is off by default not to confuse users. The single word preference is the easiest to implement with lexer and parser, but you might want to change it to more readable ones such as SilentExit = yes before the release. Takuma Murakami
Modal and AOT exit dialog
I have been considering to change the exit confirmation dialog to a modal and always-on-top one (shown by MessageBox()). The benefits of this change are: - We can easily change the message at runtime. I want to print the number of connected clients each time it is shown. - We won't lose the dialog since it remains on the top. - We can let Windows place it instead of winCenterDialog(). The position will be intrinsically correct (winCenterDialog() gives different position in multi-monitor settings). I ask this because I don't know the reason why it was implemented as a separate non-modal window. I will start this change if there is no particular reason. Takuma Murakami
Re: Modal and AOT exit dialog
Takuma, Takuma Murakami wrote: I have been considering to change the exit confirmation dialog to a modal and always-on-top one (shown by MessageBox()). I know that a MessageBox won't work well because it interrupts our message processing and blocks our main thread until the user clicks the box. Think if they clicked it on accident then went to get coffe. They would come back and XWin.exe would be terminated because its message queue overflowed. Not good :) The benefits of this change are: - We can easily change the message at runtime. I want to print the number of connected clients each time it is shown. This can easily be done in the curent dialog box. It is easy to set text in a control on a dialog box. You would do it in windialogs.c/winExitDlgProc/WM_INITDIALOG using the function SetDlgItemInt() from the Win32 API. It is really easy. - We won't lose the dialog since it remains on the top. This can be done already with the dialog too... we just have to change the style of the window. - We can let Windows place it instead of winCenterDialog(). The position will be intrinsically correct (winCenterDialog() gives different position in multi-monitor settings). I think we can tweak winCenterDialog to make it show the same position as MessageBox would put it in. Shouldn't be hard. In fact, it might be really easy. I ask this because I don't know the reason why it was implemented as a separate non-modal window. I will start this change if there is no particular reason. Well, it was originally done with a MessageBox (I don't know if I ever released it that way) and the shortcomings became apparent quite quickly. Please don't make this change, lets just modify the current dialog box and other functions to achieve your goals. Harold
Re: Modal and AOT exit dialog
Takuma, I just checked in a framework for you to display the number of connected clients in the Exit box. All that is left for you to do is to go to windialogs.c/winExitDlgProc/WM_INITDIALOG and set the value to iConnectedClients to whatever the number of connected clients is. :) Harold