|
rwilmink wrote:
The pages are first created on the heap...
Why? Can you not just use something like:
class MySheet : CPropertySheet
{
CMyPage page1;
CMyPage page2;
CMyPage page3;
};
MySheet::MySheet()
{
AddPage(&page1);
AddPage(&page1);
AddPage(&page1);
} No heap and no memory allocation/cleanup to mess with.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
No, I can't, all kinds of problems with cyclic includes.
|
|
|
|
|
Ok, then if the property sheet is allocating memory for the pages, it should also free up that memory. Something like:
class MySheet : public CPropertySheet
{
MyPage *page1;
MyPage *page2;
MyPage *page3;
};
MySheet::MySheet()
{
page1 = new MyPage;
AddPage(page1);
page2 = new MyPage;
AddPage(page2);
page3 = new MyPage;
AddPage(page3);
}
MySheet::~MySheet()
{
delete page1;
delete page2;
delete page3;
}
BOOL MySheet::OnCommand( WPARAM wParam, LPARAM lParam )
{
WORD wNotifyCode,
wId;
wId = LOWORD(wParam);
wNotifyCode = HIWORD(wParam);
if (BN_CLICKED == wNotifyCode)
{
if (IDOK == wId)
{
if (! ProcOk())
return TRUE;
}
}
return CPropertySheet::OnCommand(wParam, lParam);
}
BOOL MySheet::ProcOk( void )
{
if (::IsWindow(page1->m_hWnd))
{
if (! page1->OnKillActive())
return FALSE;
}
if (::IsWindow(page1->m_hWnd))
page1->OnOK();
return TRUE;
}
void MyPage::OnOK()
{
CPropertyPage::OnOK();
}
BOOL MyPage::OnKillActive()
{
return CPropertyPage::OnKillActive();
}
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
does setcretiontime in c++, .net frames work works in mfc ?
ditty grail
|
|
|
|
|
|
I don't see why not. What reservations are you having about it?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi!
I'm trying to add a menu to my dialog based program.
In one of the submenus and submenuitem can be checked/unchecked.
I don't know what I'm doing wrong but I can't make it to do this.
No sign of it being checked appears.
Here's the part where I think should do this but I don't know what to add.
void CTestProgramForTestWATH2cppDlg::OnUpdateHelpCheckthis(CCmdUI *pCmdUI)
{
// TODO: Add your command update UI handler code here
CWnd* pBar;
if ((pBar = GetDlgItem(pCmdUI->m_nID)) == NULL)
{
pCmdUI->ContinueRouting();
return; // not for us
}
pCmdUI->m_pSubMenu->CheckMenuItem(ID_HELP_CHECKTHIS, MF_CHECKED);
}
BOOL CTestProgramForTestWATH2cppDlg::OnHelpCheckthis(UINT nID)
{
// TODO: Add your command handler code here
return TRUE;
}
Does the function CheckMenuItem do what I request??
|
|
|
|
|
Hachaso wrote:
pCmdUI->m_pSubMenu->CheckMenuItem(ID_HELP_CHECKTHIS, MF_CHECKED);
What value does this return ?
~RaGE();
|
|
|
|
|
use pCmdUI->SetCheck(); instead of pCmdUI->m_pSubMenu->CheckMenuItem(ID_HELP_CHECKTHIS, MF_CHECKED);
|
|
|
|
|
How to find the selected date from Month Calendar Control
in vc++
Praveen Chowdam Kumar
|
|
|
|
|
parims wrote:
selected date from Month Calendar Control
Use CMonthCalCtrl::GetCurSel
TO Set date in month ctrl use:-
Use CMonthCalCtrl::SetCurSel
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I am new to MFC.
I added CMonthCalCtrl and set the variable ,,
m_month -- to CMonthCalCtrl
and write the below code in MCM_SELCHANGE in message handler.
void CTabOne::OnSelchangeMonthcalendar1(NMHDR* pNMHDR, LRESULT* pResult)
{
CString m_strDate;
CTime ct;
m_month.GetCurSel(ct);
m_strDate.Format("%2d-%2d-%2d",ct.GetDay(),ct.GetMonth(),ct.GetYear());
MessageBox(m_strDate);
UpdateData(FALSE);
*pResult = 0;
}
=============
Plz Help me ., I am getting Date field error.
Aelected date is coming with 12 adding to real date.
Praveen Chowdam Kumar
|
|
|
|
|
I tested your code. But I don't get any error.
Can you specify any other symptoms?
Or did i failed to understand your problem?
parims wrote:
and write the below code in MCM_SELCHANGE in message handler.
I think MCM_SELCHANGE is actually MCN_SELCHANGE!
|
|
|
|
|
parims wrote:
UpdateData(FALSE);
This is unnecessary and will likely cause you grief in the future. Interacting with the control using m_month is all that's necessary.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi,
I'm trying to link a Visual C++ project after successfully compiling it.
The project is a PC-side application for PC-DSP communication. Thus, I use a provided library that I received
with the hardware.The project is a win32 application (not a console application)
When I try to link, I get these errors:
Linking...
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _malloc already defined in LIBCMTD.lib(dbgheap.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/PC_LVC.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
PC_LVC.dll - 4 error(s), 1 warning(s)
Any suggestions?
Thanks,
Idan.
|
|
|
|
|
are you sure you inserted conditional inclusions ?
#ii !defined(__MY_HEADER_H_INCLUDED__)
#define __MY_HEADER_H_INCLUDED__
#endif //__MY_HEADER_H_INCLUDED__
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
Hi Idan,
It is really good to have a problem.
The possible reason could be, your hardware library might use different code generator(Multi threaded). To resolve this open your Project Setting, C/C++ Tab, check "Use run-time library" combobox. Try to change the threading model selected. I think, by default it could be a single threaded.. Change it to multithreaded..
If it doesn't workout let me know..
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
I need to keep the first column of my view hidden. so I created the column with size zero & used OnNotify to disable tracking. But now when I press “ctrl , + “ keys together the hidden column is shown. How to solve this problem?
Thanks..
sourabh
|
|
|
|
|
study.sourabh wrote:
I need to keep the first column of my view hidden
No offense, but this seems a weird design.
study.sourabh wrote:
How to solve this problem?
I think you will have to derive a class from the CListCtrl and handle the keyboardinputs in the ::PreTranslateMsg function (not call the base class if the key combination is ctrl, +
~RaGE();
|
|
|
|
|
It sounds like you need this column to store some values in it, and you don't want the user to see these values. It would probably be a better design to use the item data for each entry in the list view to store these information.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
I agree with Rage's "odd design" comment. Please elaborate on why you need this. Would it fit within your requirements to add the column to the right of all other columns instead, and then not provide a horizontal scroll bar? This would keep that column from being seen.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hi..
ya i should have used the item data . but its difficult to change it now.
i cant put the hidden data in right side cos this column is used in find item .i was not able to use ant other column other than 0th one.
how can know i know "ctrl +" was pressed in OnNotify.
what is called after OnNotify? calling OnUpdate after "ctrl +" will solve the problem. is there any other solution ....
thanks
sourabh
-- modified at 6:53 Monday 29th August, 2005
|
|
|
|
|
hi...
as it will take more time to change the hidden column for the time being I am not changing it , will try to do it later.
I got a solution for the problem
A small change in the OnNotify will do it the sample code is
BOOL CMyView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
HD_NOTIFY *pHDN=(HD_NOTIFY*)lParam;
if ( (pHDN->iItem == 0) && \
(pHDN->hdr.code == HDN_BEGINTRACK ||
pHDN->hdr.code == HDN_ITEMCHANGING )
)
{
*pResult = TRUE; // disable tracking
return TRUE;
}
return CListView::OnNotify(wParam, lParam, pResult);
}
OnNOtify can be used for disabling the tracking..
Thanks…
|
|
|
|
|
how we can get the caption of a button controls in a YESNOCANCEL messagebox dialog when the button controls get keyboard focus.
|
|
|
|