Pelles C forum

C language => Windows questions => Topic started by: gromit on May 15, 2011, 08:30:25 PM

Title: Direct RETID Return From Window
Post by: gromit on May 15, 2011, 08:30:25 PM
Hi Folks

If i write a messagebox question

Pseudo code something like this

RETID=MessageBox (" Want Yes or no","caption",MB_YES,MB_NO)
i can collect the RETID returned and do with it as i wish, within that line of code

If i create my own window (NOT A DIALOG BOX) and attempt the same with my own buttons

Is there a simple way to collect the  RETID returned without recieving it via WM_COMMAND or WM_NOTIFY etc

I would like to
retrieve the RETID directly in the same way as i would with messagebox
as in
if (MyMessageBoxButton==ID_YES) do something etc

I can disable all input to other windows in my app ( except the buttons on my MyMessageBox of course) and i can do it with a Bool but its complicated tying up the return with each message to each action

I have a good reason for wanting this so any advice would be great
I can supply more detail if that is not concise enough.
BTIA gromit

Title: Re: Direct RETID Return From Window
Post by: CommonTater on May 16, 2011, 01:27:15 AM
Short answer... no.

What you're not seeing is that the Message Box is a window.  It's just that the code to handle the buttons is internal, where you don't see it.

You can write Dialogs that return values, in much the fashion of a MessageBox(), but you're still going to have to write the button handling code yourself.

http://msdn.microsoft.com/en-us/library/ms645452(v=vs.85).aspx
Title: Re: Direct RETID Return From Window
Post by: gromit on May 16, 2011, 11:41:15 PM
Thanks Tater

I am aware of what i can do via a dialogbox but was looking for an easy way to react to a delete message through my own messagebox window and ok and cancel buttons .

as "Delete selected object YES or NO"

I have now found an easier way to do it than i was using

I have also introduced via a fortunate accident a concept
of adding a question mark to the end of any menu item that will throw up a confirmation dialog.
Thus giving the new user, the knowledge, that should they pick the menu item/button etc, with a question mark at the end. They will get a confirmation dialog before the action takes place for example in the delete case.
it may catch on!

Thanks again Tater  Gromit