dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: What class is used to create the messagebox with the Details button?

  1. #1
    Join Date
    May 1999
    Location
    SF Bay
    Posts
    51

    What class is used to create the messagebox with the Details button?

    I've been searching for info here and on the MSDN to find out what class in MFC or Win32 SDK is used to create something similiar to ::MessageBox() but with a "Details" button that, when pressed, extends the bottom of the message box and shows some text inside a read-only edit control. Microsoft uses that for its error message box when there's a page fault. I'm wondering if that's built in somewhere or would I need to create that manually.

    Thanks for any input.


  2. #2
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: What class is used to create the messagebox with the Details button?

    Hi ,
    am not aware of any class that does this kinda thing . But one can do it quite easily ..

    What u need to do is this :
    Put all controls to be hidden in the lower half of the dialog template and show / hide the lower half when u click on the details button .

    Also , u need to take care to see that , when u hide the lower half , u also disable all controls in the lower half so that tabbing , hitting the hot key etc doesn't take focus to those controls .

    U can start by doing this in the WM_INITDIALOG handler of ur dialog Proc :

    RECT oRect;
    GetWindowRect(&oRect);
    SetWindowPos(NULL,0,0,(oRect.right- oRect.left),(oRect.bottom - oRect.top)/2,SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW );
    + disable all controsl in tthe lower half

    This will make only the upper portion to appear .

    followed by :

    if(false == details already clicked)
    {
    RECT oRect;
    GetWindowRect(&oRect);
    SetWindowPos(NULL,0,0,(oRect.right - oRect.left),2*(oRect.bottom - oRect.top),SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW);
    GetDlgItem(IDDETAILS)->EnableWindow(FALSE);
    + enable all controls in lower half
    //CDialog::OnOK();
    }

    in teh handler for the details command button .

    All the best .

    Kiran


  3. #3
    Join Date
    May 1999
    Location
    SF Bay
    Posts
    51

    Re: What class is used to create the messagebox with the Details button?

    I'm surprised that MS doesn't have a class for this considering how often they use it in their software.....Thanks for the tip!


  4. #4
    Join Date
    Dec 1999
    Location
    Israel
    Posts
    2,851

    Re: What class is used to create the messagebox with the Details button?

    Microsoft has many classes/code that they use internally they are part of the applications, and not part of the OS itself. Did microsoft give the source or a class for the tabs excel & visual studio use? did they give the source for the special toolbars Visual studio uses? No, since microsoft isn't only an OS company, they also develop applications. Besides, it isn't that hard to implement the details dialog.

    Have a look at the following links for classes that do what you need.
    http://www.codeguru.com/dialog/ExpandDialog.shtml
    http://www.codeguru.com/dialog/ExpandDlg.html
    http://www.codeguru.com/dialog/expanding_dialog.shtml

    Got a question? try looking it up in MSDN first. Msdn comes with the Visual Studio, and can be found at http://msdn.microsoft.com
    ---===---
    I'm not here for the rates, but rating a post is a good way for me to know how much i helped.
    ---===---
    Daniel

  5. #5
    Join Date
    May 1999
    Location
    SF Bay
    Posts
    51

    Re: What class is used to create the messagebox with the Details button?

    What you say is all true. However, ::MessageBox() is even easier to implement than an extended dialog yet Microsoft decided to make it available to the developer community. Why not the extended dialog then? Only Microsoft can answer that.

    Thanks for the tips.


  6. #6
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: What class is used to create the messagebox with the Details button?

    Yes !! But sometimes it tends to be fun to implement our own classes to implement a functionality .. Call it re-inventing the wheel ... but it sure is fun when u get messed up in pesky details and how u find out that ur design is indeed very bad !!!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)