|
template <class beingcounted="">
class Counted
{
public:
class TooManyObjects{};
static int getObjectNum()
{
return m_ObjectNum;
};
protected:
Counted();
Counted(const Counted& count);
~Counted() { --m_ObjectNum; };
private:
static int m_ObjectNum;
static const size_t m_MaxObjectNum;
void init();
};
template <class beingcounted=""> Counted<beingcounted>::Counted()
{
init();
}
template <class beingcounted=""> Counted<beingcounted>::Counted(const Counted& count)
{
init();
}
template <class beingcounted=""> Counted<beingcounted>::init()
{
if(m_ObjectNum > m_MaxObjectNum)
{
throw TooManyObjects();
}
++m_ObjectNum;
}
class Printer: private Counted<printer>
{
public:
static Printer* makePrinter();
static Printer* makePrinter(const Printer& rhs);
~Printer();
void reset();
void performSelfTest();
using Counted<printer>::getObjectNum;
using Counted<printer>::TooManyObjects;
private:
Printer();
Printer(const Printer& rhs);
};
int Counted<printer>::m_ObjectNum = 0;
const size_t Counted<printer>::m_MaxObjectNum = 5;
Printer::Printer()
{
}
Printer::Printer(const Printer &rhs)
{
}
Printer::~Printer()
{
}
Printer* Printer::makePrinter()
{
return new Printer();
}
when I compile it, an unresolved symbol
"protected _thiscall":Counted<class printer="">:Counted<class printer="">(void)" are function
"private: _thiscall Printer:Printer(void)" reference
I don't know its meaning. How can I resolv it link error?
Many thanks.
|
|
|
|
|
Your code is almost unreadable, see point 5 here[^].
You should also replace the < and > characters by the symbols that are just above the emoticons otherwise they will be eaten (and for template, that will be quite difficult to understand).
And please, post the exact error message.
|
|
|
|
|
Why did you not preview your post prior to submitting it? Had you done so, you would have noticed a lot of important code has been hidden (it's not actually removed). Modify your post and surround the code with <pre> tags, and use the < above the smileys instead of the actual < character.
With one small change, your code compiled fine for me.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
template <class BeingCounted>
class Counted
{
public:
class TooManyObjects{};
static int getObjectNum()
{
return m_ObjectNum;
};
protected:
Counted();
Counted(const Counted& count);
~Counted() { --m_ObjectNum; };
private:
static int m_ObjectNum;
static const size_t m_MaxObjectNum;
void init();
};
template <class BeingCounted> Counted<BeingCounted>::Counted()
{
init();
}
template <class BeingCounted> Counted<BeingCounted>::Counted(const Counted& count)
{
init();
}
template <class BeingCounted> Counted<BeingCounted>::init()
{
if(m_ObjectNum > m_MaxObjectNum)
{
throw TooManyObjects();
}
++m_ObjectNum;
}
class Printer: private Counted<Printer>
{
public:
static Printer* makePrinter();
static Printer* makePrinter(const Printer& rhs);
~Printer();
void reset();
void performSelfTest();
using Counted<Printer>::getObjectNum;
using Counted<Printer>::TooManyObjects;
private:
Printer();
Printer(const Printer& rhs);
};
int Counted<Printer>::m_ObjectNum = 0;
const size_t Counted<Printer>::m_MaxObjectNum = 5;
Printer::Printer()
{
}
Printer::Printer(const Printer &rhs)
{
}
Printer::~Printer()
{
}
Printer* Printer::makePrinter()
{
return new Printer();
}
error LNK2019 unresolved symbol
|
|
|
|
|
richardye wrote: error LNK2019 unresolved symbol
Which means nothing out of context.
My guess is the following line is in error:
template <class BeingCounted> Counted<BeingCounted>::Counted(const Counted& count)
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi!
I m working on a Access project in which i want to create and execute a module
programiticaly in VC++.
I also try to use OLE function of Access bt in the Access class there is no function to create module. How i can do this.
Pls help me...regrading this.
_
ansh
|
|
|
|
|
I added WM_CTLCOLOR and coded the following lines in it.
HBRUSH DlgTest::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hBrush = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (pWnd->GetDlgCtrlID() == IDC_CHECK1)
{
pDC->SetTextColor(m_checkBoxColor);
pDC->SetBkMode(TRANSPARENT);
}
return(hBrush);
}
and in onInitdialog i added the following lines
m_checkBoxColor = RGB(255,255,255);
GetDlgItem(IDC_CHECK1)->Invalidate();
where m_checkBoxColor is COLORREF variable.
This works fine when XP themes service off. When it is on it is not working. How to make it work when themes service is on
|
|
|
|
|
well you could try handling the NM_CUSTOMDRAW for when XP themes are enabled...
|
|
|
|
|
Can we access contents of history folder?
Thanks in Advance
|
|
|
|
|
TCHAR szPath[_MAX_PATH];<br />
SHGetFolderPath(NULL, CSIDL_HISTORY, NULL, SHGFP_TYPE_CURRENT, szPath);
|
|
|
|
|
Thanks for your reply but i want to access the contents of the history folder.How can i do it?
|
|
|
|
|
FindFirstUrlCacheEntry("visited:",...) and FindNextUrlCacheEntry(...)
|
|
|
|
|
|
Try using SHGetFolderLocation and CSIDL_HISTORY .
Regards,
Paresh.
|
|
|
|
|
I have used the FindFirstUrlCacheEntry("visited:",...) and FindNextUrlCacheEntry(...) functions to display the history in my application.But,some times the history which i display is different form the history which is displayed in the explorer(Ctrl+h).What i came to know is that the above two functions access contents from "Internet Cache's index.dat located at %userprofile%\Local Settings\Temporary Internet Files\Content.IE5".But the history which is displayed in the explorer when we press Ctrl+h key word will be accessed from "Internet History's index.dat located at %userprofile%\Local Settings\History\History.IE5".so,to maintain unifromity in my application i want to extract the contents of "History.IE5" folder.But i am not able to access data form it.Can any one help me out in this ?
Thanks.
-- modified at 2:36 Tuesday 20th November, 2007
|
|
|
|
|
Will this[^] give you some pointer ?
Regards,
Paresh.
|
|
|
|
|
revanth1985 wrote: Can we access contents of history folder?
Yes, assuming you have permission. Just access the contents like you would any other folder.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
I have a CString and I want to store part of it into a buffer. My buffer is in fix size,
char fixBuffer[24];
Every CString is more than 24 in size. That mean I only need to store the initial 24bytes only. How can I do that.
I appreciate your help all the time...
Eranga
|
|
|
|
|
_tcsncpy(fixBuffer,yourstring,23);<br />
fixBuffer[23] = 0;
CString has an operator LPCTSTR() which means you can avoid messing about with GetBuffer(). the fixBuffer[23] = 0; ensures that for those CStrings which are longer than 24 characters they get NULL terminated correctly, for CStrings shorter than 24 characters _tcsncpy will NULL terminate them at the correct point anyway.
|
|
|
|
|
Thanks. I have a question, no luck on MSDN at all.
Say according to the above code I red the string. Now where is pointed on the CString, at the beginning or the 24th character? I'm confusing it.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Sorry I am not understanding that at all. The operator LPCTSTR() of CString always points to the 1st character. You tell the _tcsncpy() to copy only 23 characters with the last parameter to it. Then you ensure that the 24th character of your fixBuffer contains a NULL.
|
|
|
|
|
Ya thats true, I got the point. What I'm asking is, after reading the first 24 characters, where the operator LPCTSTR() points to the CString. Either on 1st character or 24ht character.
In other words, if I use the same operator to read the CStrign from where it begins.
Hope it is clear to you.
I appreciate your help all the time...
Eranga
|
|
|
|
|
The operator LPCTSTR() of CString always points to the 1st character.
If you want to read out sequential 24 character chunks, you will have to use a different mechanism. One suggestion:
char fixBuffer[25]; // note use of 25 to allow for a terminating NULL
int nLength = yourstring.GetLength();
int nStart;
for(nStart = 0;nStart<nLength;nStart+=24)
{
_tcsncpy(fixBuffer,&yourstring[nStart],24);
fixBuffer[24] = 0;
// do something with fixBuffer
}
|
|
|
|
|
That is interesting. I'll try it and back to here if I got any issue.
Thanks again.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Roger Broomfield wrote: _tcsncpy(fixBuffer,&yourstring[nStart],24);
You can't do that with a CString . You have to use (with care) GetBuffer method.
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.
|
|
|
|