|
They are not obsolete...Klingon developers don't use MS-'secure-versions' of the oldie-goldie CRT functions
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]
|
|
|
|
|
I linked MFC/C++ lib to my C based console application (http://www.codeproject.com/Messages/3299455/Re-Linking-MFC-Cplusplus-code-via-lib-wrapper-into.aspx).
Without invoking any functions from that lib just running the console and returning from main immediatly after calling to _CrtDumpMemoryLeaks() reveals many small mem leaks.
What are they?
Dumping objects ->
{377} client block at 0x00378CF8, subtype c0, 64 bytes long.
a CDynLinkLibrary object at $00378CF8, 64 bytes long
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {372} normal block at 0x00378B68, 22 bytes long.
Data: <<N ` > 3C 4E 10 60 05 00 00 00 05 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {371} normal block at 0x00378B10, 22 bytes long.
Data: <<N ` > 3C 4E 10 60 05 00 00 00 05 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {370} normal block at 0x00378AB0, 34 bytes long.
Data: <<N ` > 3C 4E 10 60 11 00 00 00 11 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {369} normal block at 0x00378A58, 28 bytes long.
Data: <<N ` > 3C 4E 10 60 0B 00 00 00 0B 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {368} normal block at 0x00378A00, 24 bytes long.
Data: <<N ` > 3C 4E 10 60 07 00 00 00 07 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {367} normal block at 0x003789A8, 22 bytes long.
Data: <<N ` > 3C 4E 10 60 05 00 00 00 05 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {366} normal block at 0x00378948, 31 bytes long.
Data: <<N ` > 3C 4E 10 60 0E 00 00 00 0E 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {365} normal block at 0x003788E8, 32 bytes long.
Data: <<N ` > 3C 4E 10 60 0F 00 00 00 0F 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {364} normal block at 0x00378888, 29 bytes long.
Data: <<N ` > 3C 4E 10 60 0C 00 00 00 0C 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {363} normal block at 0x00377AC8, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {362} normal block at 0x00377A70, 22 bytes long.
Data: <<N ` > 3C 4E 10 60 05 00 00 00 05 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {361} normal block at 0x00377A10, 33 bytes long.
Data: <<N ` > 3C 4E 10 60 10 00 00 00 10 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {360} normal block at 0x003779C0, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {359} normal block at 0x00377970, 20 bytes long.
Data: <<N ` > 3C 4E 10 60 03 00 00 00 03 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {358} normal block at 0x00377920, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {356} normal block at 0x003783F8, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {355} normal block at 0x003783A8, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {354} normal block at 0x00378350, 28 bytes long.
Data: <<N ` > 3C 4E 10 60 0B 00 00 00 0B 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {353} normal block at 0x00378300, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {352} normal block at 0x003782A0, 30 bytes long.
Data: <<N ` > 3C 4E 10 60 0D 00 00 00 0D 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {351} normal block at 0x00378248, 27 bytes long.
Data: <<N ` > 3C 4E 10 60 0A 00 00 00 0A 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {350} normal block at 0x003781F8, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {349} normal block at 0x003781A8, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {348} normal block at 0x00378150, 27 bytes long.
Data: <<N ` > 3C 4E 10 60 0A 00 00 00 0A 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {347} normal block at 0x00378100, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {346} normal block at 0x003780B0, 20 bytes long.
Data: <<N ` > 3C 4E 10 60 03 00 00 00 03 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {345} normal block at 0x00378060, 20 bytes long.
Data: <<N ` > 3C 4E 10 60 03 00 00 00 03 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {344} normal block at 0x00378008, 26 bytes long.
Data: <<N ` > 3C 4E 10 60 09 00 00 00 09 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {343} normal block at 0x00377FB8, 20 bytes long.
Data: <<N ` > 3C 4E 10 60 03 00 00 00 03 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {342} normal block at 0x00377F68, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {341} normal block at 0x00377F18, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {340} normal block at 0x00377EC8, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {339} normal block at 0x00377E78, 20 bytes long.
Data: <<N ` > 3C 4E 10 60 03 00 00 00 03 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {338} normal block at 0x00377E28, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {337} normal block at 0x00377DD8, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {336} normal block at 0x00377D88, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {335} normal block at 0x00377D38, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {334} normal block at 0x00377CD0, 38 bytes long.
Data: <<N ` > 3C 4E 10 60 15 00 00 00 15 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {333} normal block at 0x00377C70, 31 bytes long.
Data: <<N ` > 3C 4E 10 60 0E 00 00 00 0E 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {332} normal block at 0x00377C10, 29 bytes long.
Data: <<N ` > 3C 4E 10 60 0C 00 00 00 0C 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {331} normal block at 0x00377BB8, 22 bytes long.
Data: <<N ` > 3C 4E 10 60 05 00 00 00 05 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {330} normal block at 0x00377B60, 24 bytes long.
Data: <<N ` > 3C 4E 10 60 07 00 00 00 07 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {329} normal block at 0x00372700, 30 bytes long.
Data: <<N ` > 3C 4E 10 60 0D 00 00 00 0D 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {328} normal block at 0x003726A0, 33 bytes long.
Data: <<N ` > 3C 4E 10 60 10 00 00 00 10 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {327} normal block at 0x00372638, 38 bytes long.
Data: <<N ` > 3C 4E 10 60 15 00 00 00 15 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {326} normal block at 0x00377250, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {325} normal block at 0x00377200, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {323} normal block at 0x003771A0, 32 bytes long.
Data: <<N ` > 3C 4E 10 60 0F 00 00 00 0F 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {322} normal block at 0x00372BA0, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {143} normal block at 0x003770B0, 24 bytes long.
Data: <<N ` > 3C 4E 10 60 07 00 00 00 07 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {142} normal block at 0x00377058, 22 bytes long.
Data: <<N ` > 3C 4E 10 60 05 00 00 00 05 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {141} normal block at 0x00372B40, 30 bytes long.
Data: <<N ` > 3C 4E 10 60 0D 00 00 00 0D 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {140} normal block at 0x00372AE8, 25 bytes long.
Data: <<N ` > 3C 4E 10 60 08 00 00 00 08 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {139} normal block at 0x00372A90, 23 bytes long.
Data: <<N ` > 3C 4E 10 60 06 00 00 00 06 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {138} normal block at 0x00372A40, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {137} normal block at 0x003729E0, 36 bytes long.
Data: <<N ` > 3C 4E 10 60 13 00 00 00 13 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {136} normal block at 0x00372990, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {135} normal block at 0x00372930, 32 bytes long.
Data: <<N ` > 3C 4E 10 60 0F 00 00 00 0F 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {134} normal block at 0x003728D8, 22 bytes long.
Data: <<N ` > 3C 4E 10 60 05 00 00 00 05 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {133} normal block at 0x00372888, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {132} normal block at 0x00372830, 22 bytes long.
Data: <<N ` > 3C 4E 10 60 05 00 00 00 05 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {131} normal block at 0x003727D0, 35 bytes long.
Data: <<N ` > 3C 4E 10 60 12 00 00 00 12 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {130} normal block at 0x00372778, 25 bytes long.
Data: <<N ` > 3C 4E 10 60 08 00 00 00 08 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {129} normal block at 0x00372420, 19 bytes long.
Data: <<N ` > 3C 4E 10 60 02 00 00 00 02 00 00 00 01 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {128} normal block at 0x003723C8, 26 bytes long.
Data: <<N ` > 3C 4E 10 60 09 00 00 00 09 00 00 00 01 00 00 00
Object dump complete.
Чесноков
|
|
|
|
|
This is a guess, but it would appear that something in your MFC code is getting instantiated and allocating a lot of strings. These are then left at the end of the program, hence the memory leak warnings.
|
|
|
|
|
I do not call to any MFC/C++ lib functions.
I just run console and return from main function. There could be some static CStrings but they would be deallocated automatically
BTW I ran the MFC code and there are non mem leaks inside.
Чесноков
|
|
|
|
|
I can only suggest you run it through the debugger to see what is happening.
|
|
|
|
|
When a DLL is loaded in, its automatic variables (ie globals) will be constructed during its initialisation phase.
Unfortunately, the leak checking code runs before these globals are destroyed by the system, so any dynamic allocation made by objecs within these are reported as memory leaks.
Possible solution:
If you control the source for the DLL, remove the globals and instanciate these dynamically in the DllMain() when dwReason == DLL_PROCESS_ATTACH and destroy them when dwReason == DLL_PROCESS_DETACH
If you vote me down, my score will only get lower
|
|
|
|
|
I have an richedit control.i set its multiline,vertical scroll property but while i scroll the mouse the text rich edit scroll does not scroll while on clicking of vertical bar text gets scrolled.but i want to scroll text in rich edit control on mousewheel command.
|
|
|
|
|
Use the MSH_MOUSEWHEEL event and wParam....
There are some macros in order to handle the roation:
zDelta = (int) wParam; // wheel rotation
xPos = LOWORD(lParam); // horizontal position of pointer
yPos = HIWORD(lParam); // vertical position of pointer
|
|
|
|
|
Hai Friends .
Anybody Plz tell me
Multithreading
COM
ATL in vc++....
Can u plz send me a sample code if possible...
Best Regard's
Mathy's
|
|
|
|
|
Please read the guidelines[^]
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hello sir ;
am a beginner of vc++
so that am not using the following future's
Multithreading
COM
ATL in vc++....
so Can you plz guied me with samples... or any related things...
Best Regard's
Mathy's
|
|
|
|
|
No.
There is enough information in codeproject and in www. Google can be a very good friend for you as well.
Start searching and learning, when you have concrete questions then you will have concrete answers.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi to All,
Could anyone please help me to make an simple dll in VC++6, to export a class pointer
...where i have one more project(console based application) in the same workspace, and I need to get a class pointer of the dll, using which I want to access all the functions of that class in the dll.
thanks in advance
-----------------------------
I am a beginner
|
|
|
|
|
hai ........
I thing the URL is helping to u
//http://www.codeguru.com/cpp/cpp/cpp_mfc/tutorials/article.php/c9855/#more
Best Regard's
Mathy's
|
|
|
|
|
This is basically a repost of your question below. Try some of the things that have been suggested there before asking further questions. If you have some code that does not work correctly then you may post that with specific questions.
|
|
|
|
|
Hi to All
Could anyone please give me some links or docs or any hints for the following
I am trying to learn to design a project. Say I have 5 modules...I want to interact each module from every module by means of messages(class objects)....
Till now I was planning to make all the 4 modules as a dll and get the methods dynamically from the main modules...But thats just an imagination, and this may not be efficient too. I have not implemented anything yet....Could anyone give me some tips or hints to do the same.
Also if there is any other methodology to do so...
Basically I am trying to design a project with several modules...Its just for my self learning...
thanks in advance
-----------------------------
I am a beginner
|
|
|
|
|
Based on what those "modules" could possibly mean, and how they are related to each other, you may decide upon the way they would communicate with each other.
If you could give some precise information (read this post[^]), someone may be able to suggest you something suitable.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
thanks Rajesh
I guess my idea was very generic....
About the communicating with each another, I guess I have mentioned that I want to communicate with classes....say message1 message2...
I was looking for some common approach to design the modules in a project in VC++, where the modules communicate by any means....(may be class messages, or anything u want)...
Please do let me know for further clarification, if any.
-----------------------------
I am a beginner
|
|
|
|
|
hrishiS wrote: I guess my idea was very generic....
That's the problem.
If you ask a specific question like "How can two windows objects communicate with each other", I'll say "Post or send registered window messages".
But to a generic question, only a 'generic' answer can be given. Narrow down your query, say me what exactly are those objects that needs to communicate with one another. And for God's sake what can a "module" possibly mean?! You seem to be using that term very frequently.
Please be specific.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
thanks
Modules are again different projects....(whose output can be dlls)
By objects, I mean simple objects of some classes...eg:
class Message1
{
....
}
Message1 *objPtr= newMessage1();
This Objptr, i should be able to pass with another modules
-----------------------------
I am a beginner
|
|
|
|
|
Your post is again blunt.
hrishiS wrote: This Objptr, i should be able to pass with another modules
Please read Hooks and DLLs by Dr. Joseph Newcomer[^]
I recommend that you read up on the articles related to DLLs for beginners. There's plenty on CP, please do a search.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Please be clear whether you want to know about the class level design i.e Detailed design or component level design, i.e Architecture design.
I hope you are looking for both then please have look at
Design patterns, please check this, either study with Eric Gamma's text or just check [^]
These topics will surely help you.
Величие не Бога может быть недооценена.
|
|
|
|
|
thanks a lot for your reply...I will look in thorough all these
I was looking something like class desing....
example, make all modules as a dll....export a class pointer ...get the handle and get the functions of that module....etc etc
-----------------------------
I am a beginner
|
|
|
|
|
Hello Sir ..
How to Insert a String on a Image .?
Please Respond me!
Thanks
Failure is Success If we learn from it!!
|
|
|
|
|
|