|
Your question has been answered twice now.
Paul
|
|
|
|
|
Thanks a lot both of you guys!!
I overloaded the < operator and now i am able to compile it and its working!!
But i have anotehr small question to you.Is there a provision to pass only IEArg(key) by leaving string(value) to the insert function. If its the case,will it take any default value?? I asked this question as IKeySet's add method has a provision like that
|
|
|
|
|
is there any autodeletion of classes in WTL?
|
|
|
|
|
Asking such questions, followed by such conditional statements, kind of sucks.
--
Booohoo!
|
|
|
|
|
it was a question. unless you have the answer, dont post a follow-up.
thanks in advance,
yours sincerely Martin.
Bwaahaa.
|
|
|
|
|
Yo, Mr Retard Of The Year! If you had 2 working brain cells, you could lookup the answer in under 2 minutes, instead of having us deal with your attitude problems.
Furthermore, most of reading this forum aren't linux developers. That means you won't see us running to your rescue when you start dissing the technology. We'll just frown.
Now, act less like a retard and lookup OnFinalMessage() and utilize your knowledge in C++ and add auto deletion yourself.
--
Booohoo!
|
|
|
|
|
Jörgen Sigvardsson wrote:
Yo, Mr Retard Of The Year!
thanks for the award.
Jörgen Sigvardsson wrote:
If you had 2 working brain cells, you could lookup the answer in under 2 minutes, instead of having us deal with your attitude problems.
If i could have, i would have.
Jörgen Sigvardsson wrote:
Furthermore, most of reading this forum aren't linux developers.
This is a WTL question in the WTL part of the forum.
Jörgen Sigvardsson wrote:
Now, act less like a retard and lookup OnFinalMessage() and utilize your knowledge in C++ and add auto deletion yourself.
I don't want to mess around with the WTL headers.
|
|
|
|
|
If you want autodeletion of WTL common control wrappers (CButton et al), here's some code which will do what you want:
template <typename T>
class CSelfDeleteWindow : public CWindowImpl<CSelfDeleteWindow, T> {
typedef CSelfDeleteWindow<T> ThisClass;
public:
DECLARE_WND_SUPERCLASS(NULL, T::GetWndClassName())
BEGIN_MSG_MAP(ThisClass)
END_MSG_MAP()
CSelfDeleteWindow(T& wnd) {
ATLVERIFY(SubclassWindow(wnd));
wnd.Detach();
}
void OnFinalMessage(HWND hWnd) {
delete this;
}
}; Then use it like this:
CButton btn;
btn.Create(*this, CRect(0, 0, 100, 100), _T("Yo yo"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON);
new CSelfDeleteWindow<CButton>(btn); As you can see, no control data can be in the control which you are wrapping, since the original object is detached inside the constructor of CSelfDeleteWindow. This doesn't matter much in the common control case as you only get opaque handles to them anyway - nothing is lost.
In the case of non common control classes as defined in atlctrlx.h , all you need to do is add your own thin wrapper class. If you look at CBitmapButton , you'll see that it is only a very thin wrapper around CBitmapButtonImpl . In this case, provide your own CBitmapButton class, which overrides OnFinalMessage(HWND) and deletes this .
For everything else (stuff that you've written with the use of CWindowImpl somewhere in your inheritance hierarchy), you just have to override OnFinalMessage(HWND) and delete this .
--
Booohoo!
|
|
|
|
|
Jörgen Sigvardsson wrote:
For everything else (stuff that you've written with the use of CWindowImpl somewhere in your inheritance hierarchy), you just have to override OnFinalMessage(HWND) and delete this.
<br />
typedef CFrameWindowImpl<NoteWindow, ATL::CWindow, CMyWindowTraits> CMyFrameWindow;<br />
<br />
class NoteWindow : public CMyFrameWindow, <br />
publicCUpdateUI<NoteWindow>,<br />
public CMessageFilter, <br />
public CIdleHandler
that is my class inheritance. OnFinalMessage() causes an assert in WTL. that is the problem and it is by design, i need a way around it or i can't use WTL since it would cause memory leaks. these are supposed to be windows with you frequently open many of and close, and i don't want every object to be left in memory when the window is closed.
|
|
|
|
|
I assume you are using ATL3 (VC6). Have a look at this[^]. Basically you need to write your own window procedure to work around a bug in ATL3.
If you're using ATL7 there's something else going on which I'm unaware of. I successfully deleted this myself not too long ago.
--
Booohoo!
|
|
|
|
|
|
Dear All,
The sizeof keyword gives the amount of storage, in bytes, associated with a variable or a type.
Can any body suggest how to make our own function that operates like sizeof and gives the amount of storage in bytes.
Regards,
Rohit
|
|
|
|
|
|
What's wrong with:
template <typename T> size_t Sizeof() {
return sizeof T;
} For completeness I'd add
template <typename T> struct size_of : public std::generator<size_t> {
size_t operator()() {
return sizeof T;
}
}; and/or
template <typename T> struct size_of : public std::unary_function<size_t, T> {
size_t operator()(const T& v) {
return sizeof v;
}
};
--
Booohoo!
|
|
|
|
|
|
Hello All.
I'm have the next task:
I'm must to write an ActiveX component using C++ ATL.
This component must using SOAP client for working with WebService writed on C#.
For work with WebService from my component I must to use ASP.NET page SessionId.
This ID must be set as current SessionId(HINTERNET) handler for SOAP client.
But. C# SessionId it is string type. How I may convert C# SessionId to HINTERNET for using.
Thanks.
P.S. Sorry for my English.
|
|
|
|
|
Hi Dear...
I struck in a problem & I know you can help me..
I've a pro-merchant account in amazon..& I want to upload Inventory to amazon.. but getting problem..File Error..even from site upload...
Can you send me Execl file you used for that uploading...
+ if possible some coding snippet of uploading invenorty. I want to upload through coding.. send me at:
sumit_kapoor1980@hotmail.com
or chat with me at hotmail account or yahoo: sumit_kapoor1980@yahoo.com
I hope you will help me..
Thanks
Have a Nice Life..
Sumit Kapoor.
---Sumit Kapoor---
|
|
|
|
|
Is it just me, or is anyone else getting irritated by this...
Steve S
Developer for hire
|
|
|
|
|
it takes 1 week..still no solution..can you provide any hint...
Thanks...
---Sumit Kapoor---
|
|
|
|
|
Here's a hint.
Don't crosspost to every topic, it annoys people, and hence, makes them feel less inclined to help.
Steve S
Developer for hire
|
|
|
|
|
HI thanX...
I hate when no one help me... I'm trying from 1 week & posted in vc++ five time..no one reply...
so today..i posted to all..so that may be any other forum person know...
may be no know...
OK! Bye..sumit
---Sumit Kapoor---
|
|
|
|
|
hello,
I declare a class --- class CMainDlg :public CDialogImpl<cmaindlg>
{
enum {IDD = ...}
HWND m_hBtnApply;
......
}
the m_hBtnApply is the corresponding object of a resource IDC_APPLY in the resouce editor
I want to disable the IDC_APPLY in OnInitDialog message handler:
m_hBtnApply = GetDlgItem(IDC_APPLY);
::EnableWindow(m_hBtnApply,FALSE);
but it can reach the effects i wanted.while in MFC ,such code can do.
anybody can tell why?
mike shen
|
|
|
|
|
I have this explicit loop:
FileMap::iterator it;
for (it = outputFiles.begin(); it != outputFiles.end(); it++)
{
it->second->close();
}
where FileMap is a map<string,ofstream*>, so the loop is just going through all the stream pointers and calling close() on them
is it possible to implement this using for_each?, I tried this but got compiler errors:
for_each(outputFiles.begin(), outputFiles.end(), std::mem_fun<void, std::ofstream>(&std::ofstream::close));
|
|
|
|
|
map is a key/value type of container. Try a vector or something one dimensional.
Kuphryn
|
|
|
|
|
Yes, it is doable, but not using 'clean' STL design ideas. remember that the type of the element in the map is std::pair<string,ofstream*>, not just ofstream or ofstream*, so you need to compensate for that. The easiest way I can think of is to use lambda expressions (see boost::lambda for a comprehensive library).
Personally, I feel that lambda libraries are shakey ground at the moment. Most developers have enough trouble reading normal STL constructs without adding in strange things like '_1'and '_2' - but it depends on how comfortable with STL you and your co-workers are.
Just as an aside, are you sure that you really want to do this? Assuming that you dynamically creating the files why don't you rely upon the destructors to close the files for you - if this is the behavior that you want use boost::shared_ptr to keep a reference counter handle to the files, and when the map goes out of scope, all the files will be taken with it. The only other reason I can think that you would want to do this is to reuse the files, if you are doing this make sure that you test thoroughly Herb Sutter (the convenor of the C++ standards committee) documented some interesting 'features' (read: issues) of ofstream's after they have recycled in a recent issue of the C/C++ Users Journal.
After all that, if you're prepared to compromise on a 'dirty' rewrite for_each to work nicely with pairs, use the normal loop or try the following:
void closer(const std::pair<string,ofstream*>& toClose)
{
toClose.second->close();
}
for_each(outputFiles.begin(), outputFiles.end(), closer);
In this case I think your original loop really does make things a lot clearer than it would otherwise be.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|