Click to See Complete Forum and Search --> : Dialog Questions?!?


vittal
May 4th, 1999, 05:43 AM
Hi All,
I want some help on Dialog Based Application.
Please help me out.....
My questions....
1) How to make a dialog based application to stay always on top...I have set the system modal property in the dialog property...still my dialog does not stay on top.
2)How to make the dialog immovable..(Please dont say remove the title and it becomes immovable becos I want the title to be on)
3)How to detect the font used by the system(Large fonts OR small fonts) and change them, since my dialog based app gets changed when ever I change the font settings in the display properties.
4)How to stop the dialog from getting closed when Enter key OR ESC key is Pressed.

Thanks in Advance....
Waiting for positive replies...
Vittal

M.Anand
May 4th, 1999, 07:02 AM
For Q3. Use GetSystemMetrics to get the Font details .
For Q1. I tried with the System Modal property here and it works . How did you create the dialog ?
Are you creating through resource or Run-Time ?



M.Anand
Development - Lead ,
Satyam Infoway Limited,
Chennai - 600034
India

Ramkumar Ganesan
May 4th, 1999, 02:54 PM
For Q1. and Q2, u may want to look into SetWindowPos() function to change the z-order and movability of the window at run-time. Pls check the options for the parameters.

For Q4, u have to handle OK and CANCEL buttons irrespective of whether they're there on Ur dialog box or not. That will solve Ur problem.

Regards
Ram

vittal
May 5th, 1999, 11:46 PM
Hi Guys,
Thanks for your reply.
Most of my problems are solved.

Hi Anand,
About the system modal stuff, I have created it using the resource editor. I tried using SetWindowPos with wndTopMost also, even then It does not work, may be becos I am popping up one more dialog on this at the start itself and this might have made the main dialog to lose the TopMost Property.
Any Ideas....

Vittal

May 6th, 1999, 10:40 AM
Hello, I have no specific answers to your questions, but one thing that might help in the future is using a CFormView-based application instead of a dialog-based one. I think you get the best of both worlds with CFormView. You create an SDI or MDI as usual in the wizard, but in one of the final wizard screens, you can change what your view class inherits from from CView to CFormView.

Just a suggestion.

Devin

July 15th, 1999, 06:17 AM
You can set the a dialog to be topmost by editting the resource file as text and inserting STYLEEX WS_EX_TOPMOST in to the dialog definition.

Hope this helps.