|
Hi,
When coding an initializer list for a base contructer e.g.
using the example below
where does c " int c " have to be declared somewhere in derived class "a" ???
Class a : public b
a() : b(int c)
thankx
|
|
|
|
|
Do you mean something similar to:
class B
{
int _b;
public:
B(int b):_b(b){}
};
class A: public B
{
public:
A(int c):B(c){}
};
void main()
{
A a(7);
} ?
What's your trouble about?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
If you want to initialize member variables of class b , you'd need something like:
class b
{
int num;
public:
b( int n )
{
num = n;
}
};
class a : public b
{
public:
a( int c ) : b(c)
{
}
};
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
In other words it has to be in the derived
class constructer paramter list BTW can
I pass "this" pointer in the derived class
paramter list e.g. a(this) : b(this)
Thankx
|
|
|
|
|
please look into the below code block.
HBRUSH CTestApplnDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
int nId = pWnd->GetDlgCtrlID();
CString sData;
if (nCtlColor==CTLCOLOR_EDIT)
{
switch(nId)
{
case IDC_EDIT1:
{
m_EditCtrl.FmtLines(FALSE);
m_EditCtrl.GetWindowText( sData );
}
break;
default:
break;
}
}
return hbr;
}
The m_EditCtrl.FmtLines(FALSE) causes crash in my application.
Please help me to sove this problem.
|
|
|
|
|
KASR1 wrote: The m_EditCtrl.FmtLines(FALSE) causes crash in my application.
What is a "crash?" Is an exception thrown? Was an assertion fired? Have you used the debugger to verify that the edit control exists yet? If you comment that line, does the "crash" still occur (on the next line, perhaps)?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have investigated with a test application and found that when including the following manifest definition in stdafx.h i am getting crash.
Crash occured in m_EditCtrl.FmtLines(TRUE);
However if i remove m_EditCtrl.FmtLines(TRUE); from OnCtlColor everything is ok.
What should i do?
#if _MSC_VER >= 1400
#if defined _M_IX86
#define PROCESSOR_ARCH "x86"
#define CC_PROCESSOR_ARCH "x86"
#endif
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='" CC_PROCESSOR_ARCH "' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif // _MSC_VER >= 1400
|
|
|
|
|
KASR1 wrote: What should i do?
You've not answered any of my questions.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Sorry.
Yes it says
"Unhandled exception at 0x7866f5f0 (mfc90d.dll) in TestAppln.exe: 0xC0000005: Access violation writing location 0x00030f7c."
when i comment below line it did not crash.
m_EditCtrl.FmtLines(FALSE);
|
|
|
|
|
Use the debugger.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Does your edit box have the multi-line property set? FmtLines only applies if it is.
Quoting MSDN:
Windows will only respond if the CEdit object is a multiple-line edit control.
FmtLines only affects the buffer returned by GetHandle and the text returned by WM_GETTEXT.
It has no impact on the display of the text within the edit control.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
krmed wrote: Does your edit box have the multi-line property set?
Whether it did or didn't, that would not cause a "crash." The edit control will simply ignore the EM_FMTLINES message if the ES_MULTILINE style is not set.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have found that calling FmtLines() inside OnCtlColor causes recurrsive call to OnCtlColor. This causes stack overflow and crashes the application.
Is there any possiblity to control this?
|
|
|
|
|
KASR1 wrote: Is there any possiblity to control this?
Why are you calling FmtLines() and GetWindowText() from within the WM_CTLCOLOREDIT handler?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Yes i have multi-line property set.
|
|
|
|
|
Are you using UNICODE in your build? There are some items within the CommonControl 6.0 that are only capable of operating with a unicode build, so perhaps that is your problem.
Try a simple test app - set for unicode - and see if it works, then modify to MBCS instead of unicode and try again.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
I tried with test application.
It crashes in unicode build and in MBCS its ok.
However if add the following manifest then it crashes in MBCS also.
#if _MSC_VER >= 1400
#if defined _M_IX86
#define PROCESSOR_ARCH "x86"
#define CC_PROCESSOR_ARCH "x86"
#endif
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='" CC_PROCESSOR_ARCH "' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif // _MSC_VER >= 1400
|
|
|
|
|
Hi All,
I have created one DLL using C programming language.there i have used putenv().Now i wanna give input for putenv() in Runtime.What are all the possible ways to achieve this.
Mohan
|
|
|
|
|
Possibly exporting a function?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Need More information Please.
Mohan t working for N.I.C
|
|
|
|
|
See here [^], please.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
mohant$.net wrote: Now i wanna give input for putenv() in Runtime.
This is a bit unclear. Please elaborate.
mohant$.net wrote: What are all the possible ways to achieve this.
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
The following manifest entry causes some problem in common controls like list control, edit box. etc (Vc++ appln).
Its getting added when i use some third party libraries.
How do i solve this problem?
#if defined _M_IX86
#define PROCESSOR_ARCH "x86"
#define CC_PROCESSOR_ARCH "x86"
#endif
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='" CC_PROCESSOR_ARCH "' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
|
|
|
|
you can also use external manifests, so in the project settings the manifest will be changed.
is _M_IX86 defined?
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
_M_IX86 is defined.
i want to remove 'Microsoft.Windows.Common-Controls' manifest from the manifest file programetically.
|
|
|
|