Click here to Skip to main content
15,895,256 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: which design is better to wrap another class instance Pin
CPallini12-Apr-08 2:33
mveCPallini12-Apr-08 2:33 
GeneralRe: which design is better to wrap another class instance Pin
George_George12-Apr-08 3:46
George_George12-Apr-08 3:46 
GeneralRe: which design is better to wrap another class instance Pin
Blake Miller14-Apr-08 5:56
Blake Miller14-Apr-08 5:56 
GeneralRe: which design is better to wrap another class instance Pin
George_George14-Apr-08 22:41
George_George14-Apr-08 22:41 
GeneralRe: which design is better to wrap another class instance Pin
Blake Miller15-Apr-08 7:03
Blake Miller15-Apr-08 7:03 
GeneralRe: which design is better to wrap another class instance Pin
George_George16-Apr-08 0:52
George_George16-Apr-08 0:52 
Generalre-entrancy pattern issue setbacks Pin
George_George11-Apr-08 22:24
George_George11-Apr-08 22:24 
QuestionHow can remove button of Property Sheet? Pin
Le@rner11-Apr-08 21:44
Le@rner11-Apr-08 21:44 
Hi all,

i m create a property sheet and show property pages in this property sheet.
When i run the application the Property Sheet Show Three Buttons "OK","CANCEL",and "APPLY" at the bottom .and the apply button is Disabled.

How can Remove all these buttons from Property Sheet.


this is my Code::

class CMyPropertySheet : public CPropertySheet
{
DECLARE_DYNAMIC(CMyPropertySheet)

public:
CMyPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
virtual ~CMyPropertySheet();
static int CALLBACK XmnPropSheetCallback(HWND hWnd, UINT message, LPARAM lParam);

DECLARE_MESSAGE_MAP()
public:
virtual BOOL OnInitDialog();
HICON m_hIcon;

CPropertyPage1 m_Page1;
CPropertyPage2 m_Page2;
CPropertyPage3 m_Page3;
CPropertyPage4 m_Page4;
CPropertyPage5 m_Page5;

protected:
BOOL m_bNeedInit;
CRect m_rCrt;
int m_nMinCX;
int m_nMinCY;

public:
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
virtual INT_PTR DoModal();
//////////////////////////////////////////////////////////////////////
CMyPropertySheet::CMyPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
, m_bNeedInit(TRUE)
, m_nMinCX(0)
, m_nMinCY(0)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
AddPage(&m_Page1);
AddPage(&m_Page2);
AddPage(&m_Page3);
AddPage(&m_Page4);
AddPage(&m_Page5);

}

CMyPropertySheet::~CMyPropertySheet()
{
}


BEGIN_MESSAGE_MAP(CMyPropertySheet, CPropertySheet)
ON_WM_SIZE()
ON_WM_GETMINMAXINFO()
ON_WM_CLOSE()
END_MESSAGE_MAP()


// CMyPropertySheet message handlers

BOOL CMyPropertySheet::OnInitDialog()
{
this->SetIcon(m_hIcon,TRUE);

BOOL bResult = CPropertySheet::OnInitDialog();

// Adjust property sheet size to account for the new menu.
CRect r; GetWindowRect(&r);
r.bottom += GetSystemMetrics(SM_CYMENU);
MoveWindow(r);

// ...
// Init m_nMinCX/Y
m_nMinCX = r.Width();
m_nMinCY = r.Height();
// After this point, the resize code runs.
m_bNeedInit = FALSE;
GetClientRect(&m_rCrt);


return bResult;
}
// This function must be a STATIC method.
// Callback to allow you to set the default window styles
// for the property sheet.
int CALLBACK CMyPropertySheet::XmnPropSheetCallback(HWND hWnd, UINT message, LPARAM lParam)
{
extern int CALLBACK AfxPropSheetCallback(HWND, UINT message, LPARAM lParam);
// XMN: Call MFC's callback.
int nRes = AfxPropSheetCallback(hWnd, message, lParam);

switch (message)
{
case PSCB_PRECREATE:
// Set your own window styles.
((LPDLGTEMPLATE)lParam)->style |= (DS_3DLOOK | DS_SETFONT
| WS_OVERLAPPEDWINDOW | WS_POPUP | WS_VISIBLE | WS_CAPTION);
break;
}
return nRes;
}
void CMyPropertySheet::OnSize(UINT nType, int cx, int cy)
{
CPropertySheet::OnSize(nType, cx, cy);
CRect r1;

if (m_bNeedInit)
return;

CTabCtrl *pTab = GetTabControl();
ASSERT(NULL != pTab && IsWindow(pTab->m_hWnd));

int dx = cx - m_rCrt.Width();
int dy = cy - m_rCrt.Height();
GetClientRect(&m_rCrt);

HDWP hDWP = ::BeginDeferWindowPos(5);

pTab->GetClientRect(&r1);
r1.right += dx; r1.bottom += dy;
::DeferWindowPos(hDWP, pTab->m_hWnd, NULL,
0, 0, r1.Width(), r1.Height(),
SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);

// Move all of the buttons with the lower and right sides.
for (CWnd *pChild = GetWindow(GW_CHILD);
pChild != NULL;
pChild = pChild->GetWindow(GW_HWNDNEXT))

{

if (pChild->SendMessage(WM_GETDLGCODE) & DLGC_BUTTON)
{
pChild->GetWindowRect(&r1); ScreenToClient(&r1);
r1.top += dy; r1.bottom += dy; r1.left+= dx; r1.right += dx;
::DeferWindowPos(hDWP, pChild->m_hWnd, NULL,
r1.left, r1.top, 0, 0,
SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER);
}
// Resize everything else.
else
{
pChild->GetClientRect(&r1);
r1.right += dx; r1.bottom += dy;
::DeferWindowPos(hDWP, pChild->m_hWnd, NULL, 0, 0,
r1.Width(), r1.Height(),
SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
}

}

::EndDeferWindowPos(hDWP);

}

void CMyPropertySheet::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
{
lpMMI->ptMinTrackSize.x = m_nMinCX;
lpMMI->ptMinTrackSize.y = m_nMinCY;


CPropertySheet::OnGetMinMaxInfo(lpMMI);
}

INT_PTR CMyPropertySheet::DoModal()
{
// Hook into property sheet creation code
m_psh.dwFlags |= PSH_USECALLBACK;
m_psh.pfnCallback = XmnPropSheetCallback;

return CPropertySheet::DoModal();
}


Thanks in advance.
AnswerRe: How can remove button of Property Sheet? Pin
Blake Miller14-Apr-08 5:58
Blake Miller14-Apr-08 5:58 
Generalcall one dialog box from another in sdk Pin
Pankaj Kothawade11-Apr-08 21:00
Pankaj Kothawade11-Apr-08 21:00 
AnswerRe: call one dialog box from another in sdk Pin
Hamid_RT12-Apr-08 7:19
Hamid_RT12-Apr-08 7:19 
GeneralMenu On RButtonDown of Mouse. Pin
Le@rner11-Apr-08 20:39
Le@rner11-Apr-08 20:39 
GeneralRe: Menu On RButtonDown of Mouse. Pin
enhzflep12-Apr-08 7:14
enhzflep12-Apr-08 7:14 
GeneralRe: Menu On RButtonDown of Mouse. Pin
Hamid_RT12-Apr-08 7:19
Hamid_RT12-Apr-08 7:19 
Generalfiles present in folder Pin
neha.agarwal2711-Apr-08 19:41
neha.agarwal2711-Apr-08 19:41 
GeneralRe: files present in folder Pin
CPallini11-Apr-08 21:34
mveCPallini11-Apr-08 21:34 
GeneralUnlock Process Pin
john563211-Apr-08 17:58
john563211-Apr-08 17:58 
GeneralRe: Unlock Process Pin
Schehaider_Aymen11-Apr-08 23:11
Schehaider_Aymen11-Apr-08 23:11 
GeneralMIME Spec Pin
Bram van Kampen11-Apr-08 11:46
Bram van Kampen11-Apr-08 11:46 
GeneralPrevent active controls under child window to overwhelm it Pin
428811-Apr-08 8:02
428811-Apr-08 8:02 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
Mark Salsbery11-Apr-08 8:20
Mark Salsbery11-Apr-08 8:20 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
428811-Apr-08 9:22
428811-Apr-08 9:22 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
Moak12-Apr-08 1:34
Moak12-Apr-08 1:34 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
Mark Salsbery12-Apr-08 4:41
Mark Salsbery12-Apr-08 4:41 
GeneralRe: Prevent active controls under child window to overwhelm it Pin
428812-Apr-08 10:47
428812-Apr-08 10:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.