|
|
1. find out where you allocated a CWnd.
2. determine where you can it.
3. delete it.
-c
A conclusion is simply the place where someone got tired of thinking.
|
|
|
|
|
If there is a method to tell which CWnd is not delete?
thanks!
|
|
|
|
|
Look at default c++ files generated by Visual C++, they usually/always have a few preprocessor lines at the beginning that enable additional debugging info, as well as leak information; if it's defined, the leak is identified, with the code line where the allocation was made.
Max.
|
|
|
|
|
Since you've already got that intel, I think you may have seen Detecting and Isolating Memory Leaks Using Microsoft Visual C++[^].
Further in that article, there's a section called Comparing Memory States. If you suspect code that's leaking, wrap it with a call to checkpoint the memory before, and after, then compare. The article gives an example.
|
|
|
|
|
Has anyone gotten the last paramter to LoadImage LR_TRANSPARENT to work? I myself have not...(image loads but with the white background that clashes with the window). Can anyone help me on this?
|
|
|
|
|
if your talking about LR_LOADTRANSPARENT here is perhaps the answer.
First of all LR_LOADTRANSPARENT does not load transparent image. it replace the first color by COLOR_WINDOW. COLOR_WINDOW is the backgroud color of edit,combobox... by defaut it's white. To change this color by another, you need to replace this color in your window theme.
The second problem is that LR_LOADTRANSPARENT works only with 8bpp images.
The easyest way to use real transparent images is to use CommonControls ImageList.
If you only want to replace one backgroud color by another CommonControls CreateMappedBitmap is perhaps a best solution.
Dimitri Rochette
|
|
|
|
|
i explain:
click a .cpp file, if VC was installed, then VC pops up and displays the .cpp. if borland was installed ...
so, .cpp file is related VC or Borland.
if i develop a nodepad, how do i make .cpp etc related to my application? i guess it is something in register but ...?
thx
includeh10
|
|
|
|
|
Dunno if it is the correct key, but you might try HKEY_CLASSES_ROOT\cppfile\shell\&Open with MSDev
modified 12-Sep-18 21:01pm.
|
|
|
|
|
thx, that is right i think.
i.e. in .java i found "JCreator.java", but why jcreate.java, not jcreate.exe?
there should be more. i.e. i click my.txt (if it is related to MyApp.exe), how system passes the file name "my.txt" to MyApp.exe, from command line?
includeh10
|
|
|
|
|
First you'll need to come up with a "document name".
Something like MyFunkyAppDocType or whatever. Then
create a key under HKEY_CLASSES_ROOT by that name.
Under that key create keys Shell\open\command.
Set the default value to the command line to open
the document type. e.g. "C:\Program Files\MyFunkyApp %1"
Next, under HKEY_CLASSES_ROOT you'll see all the extensions
with associations. Just place the extension you want
associated there as a new key, and set the default value
to your document name.
But don't step on other associations without ok from the user.
i.e. check that your document name is unique. check that
the association is free or the user is willing to allow you
to overwrite it.
|
|
|
|
|
there is not WS_SYSMENU in my dialog,and the dialog app have no system icon and system menu.
how can i set the system icon or system menu?
and SetIcon() can not work.
please help me.
|
|
|
|
|
If you made this dialog in the resource editor then you have a choice of system menu which you can add.
|
|
|
|
|
|
Hi, everyone!
I have read some books about VC network programming, but in
them there are only basic samples (just to show the usage of API).
I want to know where can I get some sample codes of some more practical
samples? I want to learn socket programming.
Where can I get the codes and related explanations?
Cheers,
George
|
|
|
|
|
Try this link...there are many sample winsock apps out there, I was searching for them a few weeks ago and found hundreds of them...here is a good starting point though: http://tangentsoft.net/wskfaq/ Go to Yahoo and search winsock you will see what I am talking about.
|
|
|
|
|
Thanks, georgiek50 pal!
It is a very nice site!
Cheers,
George
|
|
|
|
|
What Windows network programming books did you read? I recommend Network Programming for Microsoft Windows, Second Edition by Anthony Jones and Jim Ohmund.
CodeProject has a network programming section with very good examples.
http://www.codeproject.com/internet/
Kuphryn
|
|
|
|
|
Thanks, Kuphryn pal!
Your recommendation is very nice!
Cheers,
George
|
|
|
|
|
When I debug my program, it says something like thread so-and-so has exited with code ######. There aren't any memory leaks but I don't know what the exit code means. Is there a list somewhere of what the codes are or does it really not tell you anything?
There's always one more bug.
|
|
|
|
|
Hi
Is there anyway to get accelerators working on a pure dialog application..
I've seen some notes about hooking into the message process but no examples of it..
I'm not using MFC.
Cheers
Chris
|
|
|
|
|
Have you tried changing your message loop to:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(hwnd, hAccel, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
I haven't actually written any apps with a pure dialog but this is what works for the other ones, and if it is a modeless dialog box then the same but you also need:
while (Getmessage...like above
{
if (hDlgModeless == 0 || !IsDialogMessage(hDlgModeless, &msg))
{
if (!Translate...like above
{
}
}
}
This is straight from Petzold's book...page 522. Hope this helps.
|
|
|
|
|
I'm a newbie in creating DLL projects and can't seem to solve this problem. I am using a similar technique to Steve Driessen's article[^].
I'm trying to create a DLL that exports a couple of classes that uses some MFC collection objects, but I keep on getting this warning:
<br />
warning C4251: 'CGifParser::m_aData' : class 'CArray<TYPE,ARG_TYPE>' needs to have dll-interface to be used by clients of class 'CGifParser'<br />
(m_aData) is a CArray that is a member of CGifParser, the class I'm trying to export).
The test program works correctly on a debug build, but not on a release build when testing the DLL.
I'm just trying to create a simple library so that I can reuse the code in other projects easier. Visual Studio .Net complicates everything! I first attempted this by trying to create a static library (.lib) but I got all these duplicate declaration errors from the standard C++ libraries. I'm use to simple command line linkers on Unix =).
Thanks.
- Anatari
|
|
|
|
|
This means the base class (CArray) was not declared to be exported. Try adding a line like:
template class __declspec(dllexport) CArray<Arraydata, Arraydata>;
Hope that will fix it..
/moliate
The corners of my eyes catch hasty, bloodless motion -
a mouse?
Well, certainly a peripheral of some kind.
Neil Gaiman - Cold Colours
|
|
|
|
|
Hi, I wrote my program using Visual Studio 6 and on Win98.
I used lots of new operator to allocate my object on heap and also to allocate a block of heap and use pointer/array that sorta thing,
everything works just fine and I never had any problem using the new []/delete[] thingy
but when I move my code to WinXP, everything is crash and burn, when I trace and debug it, sometimes my variables/member variables changed its value without any good reason. And sometimes I can't even delete my object
I've allready trace and debug it so that there are no mem. leaks and stuff, but the problem is still the same, and I've read that in WinNT(XP) it uses different dynamic heap managing method.
Is it true ?? so how do you manage your heap in your program in WinXP ??
Is there a safe way (just simple compiler/linker options) to make sure that my heap allocation runs correctly ?? without making any modifications to your code ??
|
|
|
|