|
Thanks Jörgen,
Solution did not require me to use Locks. But your answer did give a spark to think in a particular direction and finally I reached a solution.
Suchit.
(why doesn't my name appear besides by posting? I am logged in using my CodeProject ID).
|
|
|
|
|
You're welcome! May I ask how you solved it?
Someone wrote:
why doesn't my name appear besides by posting? I am logged in using my CodeProject ID
I believe it's because you are using HTML commands in your name. Your name shows up as <font face= in the email notification. Try changing your CP settings.
--
Arigato gozaimashita!
|
|
|
|
|
I am sorry about saying that this problem is solved.
Actaully the problem of crash/exception remains where it was.
However initially hosting activex control in invisible, and modeless ATL dialogs was not achieved by me, now it is possible.
|
|
|
|
|
I oftenly encounter the need of using the ATLControls.h header file for compiling some of the ATL codes. But according to the source codes. It is not supported by Ms. Any better replacement for this or there are updated version of similar kind.
thank you.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
You've probably seen atlctrls.h , which is a WTL header file (despite its atl prefix).
--
Arigato gozaimashita!
|
|
|
|
|
|
Hi!
I've implemented a thumbnail extension for windows xp explorer by implementing the IExtractImage interface. The super weird part is about windows passing the desired BPP on GetLocation().
In Explorer: When the left bar, with the Information box, is active: windows requires 32bpp. And shows my image stretched (as wide as possible, and then super heigh).
When in normal thumbnail mode, windows requires 24bpp: but it won't show the thumbnail unless it's 1bpp or 32bpp! If I force feed it 32bpp the thumbnail is shown nicely (not stretched as in the Information box).
Does anyone have any idea as of why?
Thanx
/JP
|
|
|
|
|
Hello
I have used standard template library in one of my applications. I belive that memory leaks are due to stl components, mainly string. i wrote a sample program in VC 6.0 that clearly shows memory leaks in stl
wstring str = L"";
for( int a = 0 ; a < 100000 ; a++ )
{
str += L"int";
}
str.str.erase( str.begin() , str.end() );
str = L"int";
i wrote this code against a button in dialog based application. Before clicking the button, the memory usage is 3MB and after this code it is 17MB although i believe it should have been back to 3MB after the statement str.str.erase( str.begin() , str.end() ).
My other observation is that if i exit the application in debug mode it tells almost everything about the memory leaks except for the file from which memory was allocated. I copied a code that would tell the file but it would all leaks are from crtdbg.h
i need to know how to get memory statistics low.any help in this regard will be highly appreciated.
P.S. I have been using Task Manager to see how much memory is bieng used by my application.
Regards
Omar Javed
|
|
|
|
|
str.erase( str.begin() , str.end() ) does not delete the storage the string uses. Try str.swap(wstring()) . This swaps str with a temporary wstring and then should destruct the temporary, freeing the storage originally used by str .
HTH
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Shouldn't a call to reserve() do fine?
--
...Coca Cola, sometimes war...
|
|
|
|
|
Hmmm - I thought string was like vector - which it isn't entirely, now that I check - you can call reserve to aattempt to reduce the amount of allocated storage.
However, both the C++ Standard and MSDN say that it's non-binding (i.e. the library doesn't have to honour your request). And the STL with VC++ 7.1 doesn't honour requests with capacity less than the current size (i.e. it won't shrink strings). So half a mark each - strictly, you can try to use reserve like this, but in practise, it doesn't shrink string allocations.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
That sounds like bad design. They ought to replace the reserve() function and with a set_capacity() function IMO.
--
...Coca Cola, sometimes war...
|
|
|
|
|
I'm having quite a problem. I have a class that has this attribute: a vector template. Something like the following:
<br />
extern "C" class __declspec(dllexport) AnotherClass { ... };<br />
<br />
extern "C" class __declspec(dllexport) MyClass<br />
{<br />
private:<br />
vector<AnotherClass> m_vecClass;<br />
};<br />
When I compile it, I get this warning message:
warning C4251: 'm_vecClass' : class 'std::vector<AnotherClass,class std::allocator<class AnotherClass> >' needs to have dll-interface to be used by clients of class 'MyClass'.
I don't know what to do, though I guess I should do something like
<br />
__declspec(dllexport) vector<AnotherClass> m_vecClass<br />
Still, it is not working.
I hope someone can help me. Thanks a lot.
|
|
|
|
|
|
You can't extern "C" a class. A class is a C++ specific feature, and I don't see how you could give it a C compatible linkage.
--
...Coca Cola, sometimes war...
|
|
|
|
|
I use extern "C" for the mangling. If I do not add extern "C", the compiler mangles the class as it wish, and there is no standard for that. So even when the class is a C++ class, if I create a class in Visual C++ and try to import it from its DLL with a Borland C++, it will not compile.
The use of extern "C" prevents the compiler of this mangling situation. Like the use of ordinals in a MAKE file.
Fools say I know you don't know,
silence like a cancer grows;
hear my words, that I might teach you;
take my arms, that I might reach you;
but my words like silence raindrops fell...
echoed the will of silence.
|
|
|
|
|
I use extern "C" for the mangling. If I do not add extern "C", the compiler mangles the class as it wish, and there is no standard for that. So even when the class is a C++ class, if I create a class in Visual C++ and try to import it from its DLL with a Borland C++, it will not compile.
The use of extern "C" prevents the compiler of this mangling situation. Like the use of ordinals in a MAKE file.
Fools say I know you don't know,
silence like a cancer grows;
hear my words, that I might teach you;
take my arms, that I might reach you;
but my words like silence raindrops fell...
echoed the will of silence.
|
|
|
|
|
I see..
--
...Coca Cola, sometimes war...
|
|
|
|
|
AFAIK you CANNOT share C++ code compiled with one vendor's compiler for use by another vendor's compiler. So if you write a C++ class in MSVC and make it into a DLL, you can't then use that dll/class with another vendor's compiler (like Borland). The problem is that each vendor has different ways of layout various C++ internals, such as virtual function tables, multiple inheritance, name mangling (for function overloading, a C++ feature), etc. Plus other features, like operator new/delete may be done differently and the vendor's underlying C Runtime may have a different memory manager, which will cause problems for stuff like the STL (classes like std::basic_string use the C runtime).
Part of the reason for COM was that C++ couldn't be shared this way. You'll note that when application's expose their API for 3rd party plug-ins in C++ they ALWAYS state the compiler you have to use. For example, Alias|Wavefront's Maya program (a powerful 3D Editor) has a sophisticated plugin API in C++, but you MUST use the MS VC compiler to develop for it - you can't use Borland, Digital Mars, GCC or anything else.
This is a known problem, and so far the vendor's have never agreed to a common C++ ABI. It's slightly less of a problem on other platforms, but it's still there. For example on linux most people use GCC and the GCC folks have published and (supposedly) adhere to an open binary ABI for C++. Mac OS X also shares this ABI and I believe that vendor's like Metroworks also honor it (at least on OS X).
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
You have to export an explicit instantiation of vector<AnotherClass> . The procedure is thoroughly explained in this MSKB article[^].
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi
How to resize an ATL activeX Control ? (from inside the Control's code)
I use SetWindowPos or MoveWindow and they work..But when the contol is activated (the user clicks it) it's resized back to the original size.
any help with this ?
I use ATL 3.0
|
|
|
|
|
|
However if your constol is being hosted in Internet Explorer - that won't work.
The "trick" in IE is to find the IHTMLObjectElement that represents your ActiveX control & change it's height / width. This will cause IE to adjust it's layout & resize your ActiveX control's window.
[ Jason De Arte | Toy Maker | 1001010.com ]
|
|
|
|
|
Jason De Arte wrote:
However if your constol is being hosted in Internet Explorer - that won't work
Are you sure ?
In fact I used this in IE6 and worked fine !!
does this change for other IE versions ?
|
|
|
|
|
I am as certain of that just as I am certain of my ability to spell the most common of words.
constol d'oh!
[ Jason De Arte | Toy Maker | 1001010.com ]
|
|
|
|