×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Enabling a Child Window with a Disabled Parent......

Enabling a Child Window with a Disabled Parent......

Enabling a Child Window with a Disabled Parent......

(OP)
Hi all,

I am writing a utility app which has a parent window and a child editbox window.

For educational purposes I have written the whole thing from ground up.

I have something like :

class myparentclass
 { public:
      blah blah....
   private:
      class EDITBOX *myeditbox;
      blah blah....
 };

as my parent class header.

My editbox is created as follows :

edithwnd = CreateWindowEx ( WS_EX_CLIENTEDGE,"edit",text,
                            WS_CHILD|WS_DISABLED|WS_BORDER,
                            x, y, w, h,parent,
                            (HMENU)ID_EDITBOX,dllinstance,
                            NULL
                           );
(Initially created disabled and invisible)
This all works as planned until I realised that I didn't want the user messing around with the app. while the editbox
was active.

I first of all tried EnableWindow(parenthwnd,FALSE);
only to discover that this also disables the editbox window
(because it's a child ??).

Next, I tried to hook the WM_ENABLE message sent following the EnableWindow() call in order to force the editbox to be enabled but this didn't work either.

Finally, I tried changing the editbox type to WS_POPUP but this caused a UAE (probably because of some difference in the window styles that I am unaware of).

I feel that I'm missing the obvious here - can anyone shed some light on how to make an editbox modal ?

Thanks.

RE: Enabling a Child Window with a Disabled Parent......

(OP)
As an addendum to the above :

I have managed to achieve the desired effect by capturing the mouse to the Edit Window when active and throwing away the mouse messages.

This works but I would still be interested to know if there is a 'correct' way of acheiving the same ends ?

RE: Enabling a Child Window with a Disabled Parent......


I think you MIGHT be able to emulate DialogBox().  From what little I've read, DialogBox first calls CreateDialog, then enters a message polling loop within itself.  It throws away any messages addressed to the parent window, but dispatches messages to the dialog box.  Perhaps after creating the edit box you can make another message polling loop which first checks msg.hwnd if it is the edit box window, then dispatches the message if so.  Can't really be sure of course, better back up your hard drive first.

Or better yet disassemble windows and look at the DialogBox procedure so you can be much more sure of what to do.

"Information has a tendency to be free.  Which means someone will always tell you something you don't want to know."

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close