|
I understand all that! Thanks!
In 8 years of programming I never had to use boundschecker! Heck, that's why I even forgot the name of it and asked here. Used to hear about it from people but I always was able to find/fix issues with just what VC has to offer.
Now about the new and replacing it. You don't suggest to not use pointers at all, do you? Plus some of the problems that come up are not even related (seemingly - excuse my spelling ) to our in house code as you described with different maintainers. Our code uses libraries from other vendors. And right now I'm having a problem with this:
<br />
Detected memory leaks!<br />
Dumping objects -><br />
{67} client block at 0x015B4CE8, subtype 0, 64 bytes long.<br />
a CDynLinkLibrary object at $015B4CE8, 64 bytes long<br />
{63} client block at 0x015B4A08, subtype 0, 64 bytes long.<br />
a CDynLinkLibrary object at $015B4A08, 64 bytes long<br />
{56} client block at 0x015B2E18, subtype 0, 64 bytes long.<br />
a CDynLinkLibrary object at $015B2E18, 64 bytes long<br />
Object dump complete.<br />
Of course the issue is probably in my code but it comes up as a leak of a MFC class. Now I would just like to see where exactly those objects are created. How else can I see when the process loads like 50 DLLs? Only 4 of them are mine and the leak is not in them.
|
|
|
|
|
inner wrote:
Now about the new and replacing it. You don't suggest to not use pointers at all, do you?
No, of course not. But it should be used sparingly, and with care. An example where new is necessary is in containers, where lots of objects are stuffed in vector s or CObArray s. But in this case, by creating a container wrapper class, where the dtor deletes all memory, you'll avoid possible leaks. Another rule of thumb that I've used with great success is always writing the deallocation code at the same time as the allocation.
inner wrote:
Of course the issue is probably in my code but it comes up as a leak of a MFC class. Now I would just like to see where exactly those objects are created. How else can I see when the process loads like 50 DLLs?
This might very well be because a dtor is not called, so it's not certain that Boundschecker or other tools will point out the real error.
But I'm a great fan of Boundschecker. That tool has saved lots of development time around the word! It shouldn't be difficult to be allowed to buy it, if you are in a situation where you can't decide such stuff yourself - running your application(s) through it, it will most likely earn its cost the first day, when leaks and GDI-losses are detected
|
|
|
|
|
The thing about CDynLinkLibrary is that it's created like this, right? :
<br />
new CDynLinkLibrary(TrymfcdefDLL);<br />
Without assigning it to anything. And MFC knows to kill it when DLL is about to be unloaded, right?
And each MFC extension DLL has this, right? Well. In my DLLd dtors deffinitely get called. Cause I've replaced CDynLinkLibrary with my own CDynLinkLibrary derived class and ctor and dtor TRACE to output. So there are some other DLLs that have a problem I assume.
Do you know by any chance if latest is compatible with VC6? Cause I still have my projects there. I want to go VC 7 but, our management doesn't like to take such steps in a hurry.
|
|
|
|
|
I don't know how CDynLinkLibraries are deleted, but if they register themselves to a global list, they will indeed be deleted automatically. It's easy to check, however. Put a breakpoint in one of the working DLL dtor s, and look at the callstack when it is triggered. This will allow you to trace backwards, and might give an indication why the leaking ones don't get delete d.
As for Boundschecker, a quick check on the net shows that Boundschecker 7.1 supports MSVC++ 6.0. Personally, I won't upgrade to VC 7 until the clamour over how crappy it is in microsoft.public.vc.mfc dies down
|
|
|
|
|
I'm trying to attach a bitmap to a button using subclassing in win32 vc++.Can anyone help
|
|
|
|
|
Anonymous wrote:
Can anyone help
That is very likely. However you must first accurately describe the problem.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
In addition to palbano's post, you might also want to provide the snippet of code that is not working. It'll make suggestions a lot more meaningful.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi everyone,
I wanted to know about the connection string for connecting to an Oracle database that is not registered in the system DSN.
For example, for connecting to SQL Server I use:
"DRIVER={SQL Server};SERVER=xp01;UID=user;PWD=pass;APP=Generic32;DATABASE=SOMEDATABASE";
However, I cannot figure out the connection string for an Oracle database. I always have to use a DSN.
Can someone help me out with it?
Thanks,
Sincerely,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
This article[^] has an example connection string for most DBs including Oracle.
Michael
CP Blog [^]
|
|
|
|
|
Perfect! Thanks a lot for pointing that one out.
CP is amazing
Sincerely,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
I should know this by now, but what variable is 16 bytes, and which one is 64 bits?
thanks
wWw.KruncherInc.com - My cool programs
|
|
|
|
|
Do you mean 16 bytes or bits?
16-bit is a short int.
Are you looking for a 64-bit integer? If so, use __int64. Just remember it's Microsoft specific though.
Jeremy Falcon
|
|
|
|
|
I'm trying to read the ".lnk" header, I found the specs here http://myfileformats.com/download.php?url=/files/shortcut.zip&id=5870&name=LNK
under "The File Header" Im looking at
offset 4h contents GUID of shortcut files
offset 1Ch contents Time 1
offset 24h contents Time 2
offset 2Ch Contents Time 3
wWw.KruncherInc.com - My cool programs
|
|
|
|
|
I'm not exactly sure what you are asking.
offset 4h contents GUID of shortcut files is 24 bytes in length
offset 1Ch contents Time 1 is 8 bytes in length
offset 24h contents Time 2 is 8 bytes in length
offset 2Ch Contents Time 3 is presumably 8 bytes in length
A char is one byte. A short is 2 bytes. A long is 4 bytes. An int is the same size as the system word (4 bytes in 32-bit OSs).
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
LOL fine, what is a 64 bit int in C? Not platform specific?
|
|
|
|
|
KingKruncher wrote:
what is a 64 bit int in C?
long long , but not all compilers support it.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
A Microsoft-specific __int64 type exists.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_langref___int8.2c_.__int16.2c_.__int32.2c_.__int64.asp
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I've an application written in MFC. The main window is a subclass of CFrameWnd . I'd like to have an option to set the window always-on-top, so I've got a check menu item "Always on top" on my "View" menu. The command handler for this (method OnAlwaysOnTop ) checks the state of the menu item check, toggles it (this works fine) then calls this->ModifyStyleEx( 0, WS_EX_TOPMOST ) or this->ModifyStyleEx( WS_EX_TOPMOST, 0 ) depending on whether it is setting or clearing the state respectively. For some reason I always get a zero return from ModifyStyleEx() meaning it has failed (non-zero means success) and the window does not go topmost.
- Can a CFrameWnd (or a derived class) have the WS_EX_TOPMOST extended style set?
- Does the WS_EX_TOPMOST extended style actually mean always-on-top or does it simply bring to front until another window is activated?
- The window is created using Create() , in order to use extended styles must I use CreateEx() ?
In the debugger this is definetly the correct derived class.
Any tips on how I can achieve this feature?
Thanks all in advance. Please ask if I have been unclear on anything or you need more information.
Cheers,
Robin
|
|
|
|
|
Look at SetWindowPos()
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Works a charm, I used:
SetWindowPos( &wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
Thanks a lot
|
|
|
|
|
I know what you will say: There are some sources on this site....
all I find was in MFC,
Here is my probleme:
if I do this:
case WM_INITDIALOG:
{
DragAcceptFiles(hwnd,TRUE);
........
...
}
no problemo, I catch the WM_DROPFILES
but I want it for my list view control (IDC_LIST1)
so I did that
case WM_INITDIALOG:
{
DragAcceptFiles(GetDlgItem(hwnd,IDC_LIST1),TRUE);
........
...
}
and impossible to catch the msg...
I try to catch everywhere, whitout result..
if someone can help me!!!
|
|
|
|
|
youpiyoyo wrote:
I try to catch everywhere
Did you try subclassing the list control?
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
How do I subclass the list control????
|
|
|
|
|
Type CListCtrl in the Search window and click the Go button
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
As I had said before in the title, it was coded in api win32, and not in MFC,
so for the CListCtrl it won't work.....
I try something with windowlong...
|
|
|
|