Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 8th, 2005, 1:58 PM   #1
lord_nemesis
Newbie
 
Join Date: Aug 2005
Location: India
Posts: 3
Rep Power: 0 lord_nemesis is on a distinguished road
How can I differentiate Modal and Modeless Dialogs

I have the HWND of a Dialog Box and I have to find out whether it is Modal or modeless dialog. I have to do this using only the Win32 API's. I am not using MFC in my program. How can this be done. Another thing to note is that the modeless dialogs do not follow any perticular standard or style. Some have title bars, some dont etc.
lord_nemesis is offline   Reply With Quote
Old Aug 8th, 2005, 6:43 PM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Well, what determines whether it's modal or not? Is there a variable that you set? Do you define a macro? I don't know how dialogs work, but there must be something.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Aug 8th, 2005, 6:49 PM   #3
stevengs
Professional Programmer
 
stevengs's Avatar
 
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4 stevengs is on a distinguished road
Quote:
Originally Posted by Ooble
Well, what determines whether it's modal or not? Is there a variable that you set? Do you define a macro? I don't know how dialogs work, but there must be something.
wow... ooble is actually trying to splutter out a technical comment (however helpful) on a programming topic, ...

valiant effort ooble

-Or was that just some "razzle-dazzle" postcount fluff to awe and bewilder those seeking wisdom and score another point?
__________________
-Steven
"Is this a piece of your brain?" - Basil Fawlty
stevengs is offline   Reply With Quote
Old Aug 8th, 2005, 7:00 PM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
I'm just trying to get back into the swing of things. Leave me be, cursed one!
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Aug 9th, 2005, 3:47 AM   #5
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
Still doesn't help the OP though
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity."

- Albert Einstein
Berto is offline   Reply With Quote
Old Aug 9th, 2005, 7:58 AM   #6
lord_nemesis
Newbie
 
Join Date: Aug 2005
Location: India
Posts: 3
Rep Power: 0 lord_nemesis is on a distinguished road
We have different API for creating Modal and Modeless Dialogs. So thats not a problem. But How can we differentiate after they are made and we have just the Handle of the Window.
lord_nemesis is offline   Reply With Quote
Old Aug 9th, 2005, 8:10 AM   #7
prolog
Programmer
 
Join Date: Jul 2005
Location: Germany
Posts: 69
Rep Power: 4 prolog is on a distinguished road
Hi,

i'm not a win32 expert but there is a GetWindowStyleA or similar API .. and i believe whether a dialog is modeless or modal is controled via the style.
__________________
-= C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do succeed, you will blow away your whole leg. =- Bjarne Stroustrup
prolog is offline   Reply With Quote
Old Aug 9th, 2005, 12:29 PM   #8
EverLearning
Hobbyist Programmer
 
EverLearning's Avatar
 
Join Date: May 2005
Location: Indiana
Posts: 130
Rep Power: 4 EverLearning is on a distinguished road
I have been searching for a while and didn't see it for win32 API (may want to look here ), however QT designer does have a IsModal() method in QDialog class, so next time forget win32, go QT Designer!
__________________
got math? yumm...

"All men by nature desire to know" -Aristotle, Metaphysics
EverLearning is offline   Reply With Quote
Old Aug 9th, 2005, 12:45 PM   #9
prolog
Programmer
 
Join Date: Jul 2005
Location: Germany
Posts: 69
Rep Power: 4 prolog is on a distinguished road
Quote:
Originally Posted by EverLearning
I have been searching for a while and didn't see it for win32 API, however QT designer does have a IsModal() method in QDialog class, so next time forget win32, go QT Designer!
Did you read what he posted ? Sure you can ask a dialog-class whether it is modeless or not, even on win32 . The actual method-name depends on the wrapper used. But the problem is , that he has just a handle to a window, not an object.

I searched myself. There is no GetWindowStyle but there is a GetWindowInfo

Prototype:
BOOL GetWindowInfo(HWND h,PWINDOWINFO pwi);

And then you get the WINDOWINFO structur holding both style and styleEX es members. Again, i dunno if this is the right way to go .. but i think it is sth to start from.
__________________
-= C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do succeed, you will blow away your whole leg. =- Bjarne Stroustrup
prolog is offline   Reply With Quote
Old Aug 9th, 2005, 11:39 PM   #10
stevengs
Professional Programmer
 
stevengs's Avatar
 
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4 stevengs is on a distinguished road
If nothing else works, you may just have to store the information in a table when you instantiate a dialog. Something along the lines of a container as a static class variable, mapping HWNDs to bools.
__________________
-Steven
"Is this a piece of your brain?" - Basil Fawlty
stevengs is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:47 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC