-
August 2nd, 2015, 12:48 PM
#1
[RESOLVED] win32 - how can i add more flags to messagebox?
i'm changind the standard messagebox and seems to work greate
my question is: the messagebox() return is from 1 to 11. how can i change the return value for check if the checkbox is checked?
i did these:
Code:
int a=::MessageBox(parent,text.c_str(),title.c_str(), flags);
if(blnMessageBoxCheckBox==true)
a|=16;
when i do:
Code:
int a = MessageBox("hi",to_string(blnMessageBoxCheckBox), MB_OK, MB_EX_TEXTCENTER | MB_EX_MODAL| MB_EX_PARENTCENTER | MB_EX_CHECKEDBOX);
if(a & 16 )
MessageBox("Checked");
else
MessageBox("UnChecked");
i, always, recive 'UnChecked'. what i'm doing wrong with flag?
-
August 3rd, 2015, 07:14 AM
#2
Re: win32 - how can i add more flags to messagebox?
Unless you really really need this in code you can't control.
Why not simply create your own Dialog that does everything you want rather than making it difficult by having hooks and trying to make it return things it's not designed for, These sort of "hacks" or "mods" can seriously bite you in the rear end.
- if windows decides to add stuff in a new version that is not compatible with what you're doing
- if the user is using disabilities tools (zooming, screen reading, braile device etc).
-
August 3rd, 2015, 07:52 AM
#3
Re: win32 - how can i add more flags to messagebox?
Originally Posted by OReubens
Unless you really really need this in code you can't control.
Why not simply create your own Dialog that does everything you want rather than making it difficult by having hooks and trying to make it return things it's not designed for, These sort of "hacks" or "mods" can seriously bite you in the rear end.
- if windows decides to add stuff in a new version that is not compatible with what you're doing
- if the user is using disabilities tools (zooming, screen reading, braile device etc).
doing a const variable:
Code:
const int IDCHECKED=0x10;
//..............................
int a=::MessageBox(parent,text.c_str(),title.c_str(), flags);
if(blnMessageBoxCheckBox==true)
a|=IDCHECKED;
///testing:
int a = MessageBox("hello world\nhello mom... hello dear angel... how are you?\n\n\thehehehehe","hi" , MB_OKCANCEL, MB_EX_MODAL| MB_EX_PARENTCENTER | MB_EX_CHECKEDBOX,"check me, please...");
if(a & IDCHECKED)
MessageBox("checked");
else if(a&IDCANCEL)
MessageBox("cancel");
else if (a&IDOK)
MessageBox("OK");
but maybe you have right. if they change the ID consts or add more, my code will not work correctly. unless i use a number more big than 0x10?
-
August 3rd, 2015, 09:31 AM
#4
Re: win32 - how can i add more flags to messagebox?
Why take a risk that the OS will make a change and break your code?
-
August 3rd, 2015, 10:09 AM
#5
Re: win32 - how can i add more flags to messagebox?
Originally Posted by Arjay
Why take a risk that the OS will make a change and break your code?
you, both, have wright. but, without create my own messagebox, how can i avoid it?
-
August 3rd, 2015, 10:42 AM
#6
Re: win32 - how can i add more flags to messagebox?
Originally Posted by Cambalinho
you, both, have wright. but, without create my own messagebox, how can i avoid it?
I am with OReubens on that: don't use MessageBox() function if you need customization. Just create your own DialogBox and make it as flexible as you need.
There is only one feature of the MessageBox that doesn't come for free with the dialog: it auto-size the static text box and the window itself. This is NOT a very big deal.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
August 3rd, 2015, 11:40 AM
#7
Re: win32 - how can i add more flags to messagebox?
please someone correct these(if is confused, please tell me):
- i have 3 forms(parent windows, not childs). i'm close them by it's ZOrder. my question is: after close the 1st, why the other 2 forms ZOrder is automatic changed?
-
August 3rd, 2015, 11:52 AM
#8
Re: win32 - how can i add more flags to messagebox?
Originally Posted by Cambalinho
please someone correct these(if is confused, please tell me):
- i have 3 forms(parent windows, not childs). i'm close them by it's ZOrder. my question is: after close the 1st, why the other 2 forms ZOrder is automatic changed?
In general please post a new question for a different topic.
As far as the question, wouldn't you expect the z-order to change by the system as windows get added and removed and brought into the foreground? If the system didn't do this, z-order values would be meaningless.
-
August 3rd, 2015, 12:15 PM
#9
Re: win32 - how can i add more flags to messagebox?
Originally Posted by Arjay
In general please post a new question for a different topic.
As far as the question, wouldn't you expect the z-order to change by the system as windows get added and removed and brought into the foreground? If the system didn't do this, z-order values would be meaningless.
sorry about that. i did the same question, before, without an answer
see these ZOrder(it's a little diferent from what i said... but you see what i mean):
codeBlocks IDE - form1 - form2 - messagebox
now close the messagebox and form2. why the codeblocks IDE comes to front automatic after close form2?
-
August 3rd, 2015, 01:22 PM
#10
Re: win32 - how can i add more flags to messagebox?
Originally Posted by Cambalinho
why the codeblocks IDE comes to front automatic after close form2?
I have to ask, "Why do you care?" Besides the academic question, it would be a mistake in my opinion to code your app based on how you think the system sets the z-order.
-
August 3rd, 2015, 02:26 PM
#11
Re: win32 - how can i add more flags to messagebox?
Originally Posted by Arjay
I have to ask, "Why do you care?" Besides the academic question, it would be a mistake in my opinion to code your app based on how you think the system sets the z-order.
i'm sorry, i thot the ZOrder was only changed when i click on window. else the windows that win focus will be the next on back and not the otherone. but thanks for correct me.. thanks to all
-
August 3rd, 2015, 03:25 PM
#12
Re: [RESOLVED] win32 - how can i add more flags to messagebox?
anotherthing: these problem only happens when i use the messagebox()(standard ou mixed), after close the messagebox() and 1 form.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|