Solved

Wizards in MFC

Posted on 1998-11-06
7
503 Views
Last Modified: 2013-11-20
I am creating one wizard like application using CPropertyPage and CPropertySheet classes from MFC.

Those gives me a dialog box with the HELP button
Because of this button (i think) i can´t place text, controls or whatever close to the right margin.

So my guess is that if i remove the help button from the template the dialog will be smaller ( without the big right margin) .

Two questions:
Am i thinking well?
How can i remove the help button?
0
Comment
Question by:jmartins71
  • 3
  • 2
  • 2
7 Comments
 
LVL 8

Accepted Solution

by:
Answers2000 earned 20 total points
ID: 1324297
To remove the help button, set the flag in the m_psh member of your property sheet, before calling DoModal :-

oMySheet.m_psh.dwFlags &= ~PSH_HASHELP ;

In my experience, the property sheet class still makes space for all the buttons even if you turn off buttons (you can turn off apply on non-wizard property sheets using - oMySheet.m_psh.dwFlags |= PSH_NOAPPLYNOW).  The property sheet is automatically sized to accommodate space for all potential buttons (including ones that might be turned off) or the largest property page - whichever is larger

To size your property sheet - do it like any other window - saying using SetWindowPos

There is are a couple of articles at this URL you might find useful
http://www.codeguru.com/propertysheet/index.shtml

"Resizing the Property Sheet - Zafir Anjum (1998/08/06) "
"Moving and Resizing the Property Pages - Zafir Anjum (1998/08/06)"
0
 

Author Comment

by:jmartins71
ID: 1324298
thanks Answers2000
0
 

Author Comment

by:jmartins71
ID: 1324299
"To remove the help button, set the flag in the m_psh member of your property sheet, before calling DoModal :-

oMySheet.m_psh.dwFlags &= ~PSH_HASHELP ; "

it does not work!

From codeguru, i have seen one similiar solution that affects one flag in each property page.
But even this solution does not hide the button. It simple disable it.
I also try with ShowWindow but the ID i use for the help button (i think is IDHELP) crush the application.

Could you give me more details of your solution?
 
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 8

Expert Comment

by:Answers2000
ID: 1324300
oops you're right, I misunderstood your question - sorry

I have done a bit of work with spy++

The help button is a child of the property sheet (not the property page) and has ID of 9

Therefore you should be able to use ShowWindow on it if you find it.

To find it from a property page (in a message handler for CPropertyPage derived class)

HWND hWndSheet = ::GetParent( this->m_hWnd ) ;
HWND hWndButton = ::GetDlgItem( hWndSheet, 9 ) ;

To find if from property sheet (in message handler for CPropertySheet derived class)

HWND hWndSheet = this->m_hWnd ;
HWND hWndButton = ::GetDlgItem( hWndSheet, 9 ) ;

Hide the button using
::ShowWindow( hWndButton, SW_HIDE ) ; /* SW_SHOW to show */

Disable button using EnableWindow
::EnableWindow( hWndButton, FALSE ) ; /* TRUE to enable */


0
 

Author Comment

by:jmartins71
ID: 1324301
It works just fine.
Thanks Answers2000.
Now i will try to resize it.
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 14731069
>> void MyClass::f1(base&  b)//

changed to

>> void MyClass::f1(base*  b)//

Why the change there ?

Also, could this problem not be solved using double dispatch, or is that a different kettle of fish altogether ?

TIA
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 14731073
LOL sorry, this comment was posted in the wrong question :)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now