|
Eugen Podsypalnikov wrote: Try to analyze debuggers output lines after the applications exit
i dont know how to use this?
please tell me how can i do this.
|
|
|
|
|
Build a debug version, start its debugging (F5),
then close the app and observe the output window in VS.
Usually you can even jump to the source, like ... = new ... ,
just by a double click at a "memory leak" line there Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
Its looks like this.
'Test.exe': Loaded 'C:\Windows\System32\ntdll.dll'
'Test.exe': Loaded 'C:\Windows\System32\kernel32.dll'
'Test.exe': Loaded 'C:\Windows\System32\user32.dll'
'Test.exe': Loaded 'C:\Windows\System32\gdi32.dll'
'Test.exe': Loaded 'C:\Windows\System32\advapi32.dll'
'Test.exe': Loaded 'C:\Windows\System32\rpcrt4.dll'
'Test.exe': Loaded 'C:\Windows\System32\msimg32.dll'
'Test.exe': Loaded 'C:\Windows\System32\comdlg32.dll'
'Test.exe': Loaded 'C:\Windows\System32\msvcrt.dll'
'Test.exe': Loaded 'C:\Windows\System32\shlwapi.dll'
'Test.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.18005_none_5cb72f96088b0de0\comctl32.dll'
'Test.exe': Loaded 'C:\Windows\System32\shell32.dll'
'Test.exe': Loaded 'C:\Windows\System32\winspool.drv'
'Test.exe': Loaded 'C:\Windows\System32\oledlg.dll'
'Test.exe': Loaded 'C:\Windows\System32\ole32.dll'
'Test.exe': Loaded 'C:\Windows\System32\oleaut32.dll'
'Test.exe': Loaded 'C:\Windows\System32\winmm.dll'
'Test.exe': Loaded 'C:\Windows\System32\oleacc.dll'
'Test.exe': Loaded 'C:\Windows\System32\imm32.dll'
'Test.exe': Loaded 'C:\Windows\System32\msctf.dll'
'Test.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.0.6002.18005_none_9e50b396ca17ae07\GdiPlus.dll'
'Test.exe': Loaded 'C:\Windows\System32\lpk.dll'
'Test.exe': Loaded 'C:\Windows\System32\usp10.dll'
'Test.exe': Loaded 'C:\Windows\System32\uxtheme.dll'
'Test.exe': Loaded 'C:\Windows\System32\dwmapi.dll'
'Test.exe': Loaded 'C:\Windows\System32\clbcatq.dll'
'Test.exe': Loaded 'C:\Windows\System32\wbem\wbemprox.dll'
'Test.exe': Loaded 'C:\Windows\System32\wbemcomn.dll'
'Test.exe': Loaded 'C:\Windows\System32\ws2_32.dll'
'Test.exe': Loaded 'C:\Windows\System32\nsi.dll'
'Test.exe': Loaded 'C:\Windows\System32\rsaenh.dll'
'Test.exe': Loaded 'C:\Windows\System32\wbem\wbemsvc.dll'
'Test.exe': Loaded 'C:\Windows\System32\wbem\fastprox.dll'
'Test.exe': Loaded 'C:\Windows\System32\ntdsapi.dll'
'Test.exe': Loaded 'C:\Windows\System32\dnsapi.dll'
'Test.exe': Loaded 'C:\Windows\System32\Wldap32.dll'
'Test.exe': Loaded 'C:\Windows\System32\psapi.dll'
'Test.exe': Loaded 'C:\Windows\System32\netapi32.dll'
'Test.exe': Loaded 'C:\Windows\System32\secur32.dll'
The thread 'Win32 Thread' (0xaac) has exited with code 0 (0x0).
'Test.exe': Unloaded 'C:\Windows\System32\dwmapi.dll'
The thread 'Win32 Thread' (0xeb4) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x3a8) has exited with code 0 (0x0).
The program '[3476] Test.exe: Native' has exited with code 0 (0x0).
|
|
|
|
|
OK Was it an output of the Debug vesrsion (configuration) of your application ?
When yes - there are no direct references to the classical memory leaks (by new).
However it would be possible (for example),
that you do not release other kinds of the resources,
such as HPEN, HFILE, HXXX... ,
or you initialize something twice without releasing...
You could try to analyze the code (subject: symmetry of allocation/deallocation),
or use the special tools (when your code is to big for you to analyze)... Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
Output window is like this
‘Test.exe’: Loaded 'C:\Windows\System32\ntdll.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\kernel32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\user32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\gdi32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\advapi32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\rpcrt4.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\msimg32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\comdlg32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\msvcrt.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\shlwapi.dll'
‘Test.exe’: Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.18005_none_5cb72f96088b0de0\comctl32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\shell32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\winspool.drv'
‘Test.exe’: Loaded 'C:\Windows\System32\oledlg.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\ole32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\oleaut32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\winmm.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\oleacc.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\imm32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\msctf.dll'
‘Test.exe’: Loaded 'C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.0.6002.18005_none_9e50b396ca17ae07\GdiPlus.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\lpk.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\usp10.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\uxtheme.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\dwmapi.dll'
Detected memory leaks!
here i found Detected memory leaks!,but i dont know how can get the location of this memory leak,
how can get at which porint or on wich function memory leaks.
please help me for this.
thanks.
|
|
|
|
|
Usually the line "Detected memory leaks!" is not last... Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
like this.
‘Test.exe’: Loaded 'C:\Windows\System32\ntdll.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\kernel32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\user32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\gdi32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\advapi32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\rpcrt4.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\msimg32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\comdlg32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\msvcrt.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\shlwapi.dll'
‘Test.exe’: Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.18005_none_5cb72f96088b0de0\comctl32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\shell32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\winspool.drv'
‘Test.exe’: Loaded 'C:\Windows\System32\oledlg.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\ole32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\oleaut32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\winmm.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\oleacc.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\imm32.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\msctf.dll'
‘Test.exe’: Loaded 'C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.0.6002.18005_none_9e50b396ca17ae07\GdiPlus.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\lpk.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\usp10.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\uxtheme.dll'
‘Test.exe’: Loaded 'C:\Windows\System32\dwmapi.dll'
‘Test.exe’: Unloaded 'C:\Windows\System32\dwmapi.dll'
The thread 'Win32 Thread' (0x16fc) has exited with code 1 (0x1).
Detected memory leaks!
Dumping objects ->
{235} normal block at 0x00F66728, 145 bytes long.
Data: < d > C0 15 9D 01 64 00 00 00 80 00 00 00 01 00 00 00
{227} normal block at 0x00F666D8, 20 bytes long.
Data: < > C0 15 9D 01 03 00 00 00 03 00 00 00 01 00 00 00
{226} normal block at 0x00F66640, 85 bytes long.
Data: < D D > C0 15 9D 01 44 00 00 00 44 00 00 00 01 00 00 00
{225} normal block at 0x00F66598, 103 bytes long.
Data: < V V > C0 15 9D 01 56 00 00 00 56 00 00 00 01 00 00 00
Object dump complete.
The program '[4540] Test.exe: Native' has exited with code 0 (0x0).
|
|
|
|
|
Just double click at {XXX} Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
you mean double click on {235},
nothing happen when i double click on this.
|
|
|
|
|
Please include:
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
at the beginning of each *.cpp in you project, after their "iclude section" Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
|
The sources will be presented in the output window (to double click)
only if it (see above) is included
Please check other sources Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
Hi Experts.
I'm new in Mfc.
In c# I cloud easily add new form to my application and show it.
At first step in Mfc I need to add some dialog to my application and then from some menu or button command display it.
But I mixed to how do it?
Thanks for your kinds.sepel
|
|
|
|
|
From 'View' Menu Choose to see Resource 'View Panel' in your IDE
In the Resource View Panel Expand Items and right click the Dialog Branch and Choose 'Add Resource' and press New Button of add Resource Dialog.
After your dialog has created you can see it in Resource Designer when ever you want by Double Clicking on it in Resource View Panel.
After You do all these Right Click on your Dialog in Resource Designed and choose 'Add Class'
fill the class field with a name (e.g. "CTemp1Dlg")and before Finishing the wizard attention the names of .Cpp File and .h file which is created for you through wizard (here : Temp1Dlg.h and Temp1Dlg.cpp)
now include the Temp1Dlg.h File created in previous step in your Code which you want to Modal your Dialog.
in the method you want to Modal your Dialog write the below code:
CTemp1Dlg dlgMyDialog(this);
dlgMyDialog.DoModal();
|
|
|
|
|
It works !.
Thanks Amir.
Dear Amir,I have some expert in C# and now I migrate to mfc for some interesting and some works !.
Can I ask you guide me to some books or another resource to help me learn mfc better( and quick)?
Best Regardssepel
|
|
|
|
|
Ok Please Don't hesitate to ask any question ,But I could not promise if I could answer them all.
Here is a list of update books you may like to use, How ever mostl of MFC guide books found in the net are old ones but they could be useful too because the bases are the same:
http://msdn.microsoft.com/en-us/visualc/dd721903.aspx[^]
By the way for those who are new to MFC, How Do I? Video Series[^] would be interesting.
|
|
|
|
|
So Helpful.
Thanks again.sepel
|
|
|
|
|
Can I design application like no debugger gets the information from it.
|
|
|
|
|
1- build in RELEASE more
2- don't waste time on that issue because if your application is worthy enough, crackers/hackers will break it.
other than that, can you explain what you want, or what information you do not want people to see ?Watched code never compiles.
|
|
|
|
|
I'm working a _little bit_ with Visual C++ (Visual Studio 2005) but it is not a language I'm familiar with! I have a funtion that needs to take a char* parameter (non unicode) but inside that function I need to work with the data passed in as LPCSTR. I have found quite a few options to convert from LPCSTR to char* but not the other way around.
I have:
myfunction (char* param1)
{
LPCSTR p1;
}
How do I get the value of param1 into p1?
Thanks in advance
Best regards,Arnor Baldvinsson
|
|
|
|
|
I believe that LPCSTR is just const char *, so there is no conversion necessary. Just try:
LPCSTR p1 = param1;
Now, since p1 is a pointer to const, what it points to can not be changed through it.
Going the other way is an issue because what is being pointed to is presumably const, so you should not point a pointer-to-non-const to it. That would break the do not alter rule. So conversion isn't really the issue, but rather making an alterable copy of the original.
Now, if unicode was involved on one side but not the other, ... but that's not your question. Please do not read this signature.
|
|
|
|
|
Thank you Avi for a very quick response. I think I have this under control now
Best regards,
|
|
|
|
|
Hi,
How could I change the CMFCPropertyGridCtrl Property Column or Value column width?
a sample code would be more useful
|
|
|
|
|
How do you do a extern type declaration for this. At link time I get unresolved external symbol "public: static void__cdecl etc. etc.
I'm trying to expand my use of C++ to envelop static functions inside of classes as a way to help organize the code a bit better.
|
|
|
|
|
this worked for me:
class A
{
public:
static void g(int)
{
int i = 0;
}
};
typedef void (*fp)(int);
int _tmain(int argc, _TCHAR* argv[])
{
fp p = A::g;
p(1);
return 0;
}
|
|
|
|