|
I have located some memory with malloc that is supposed to hold and error message if an error happens. But when i try to free it, this error appears:
Debug Error!
Program: E:\MP3ORGANIZER\MP3\Debug\MP3.exe
DAMAGE: before Normal block (#92) at 0x008B3B18.
(Press Retry to debug the application)
i don't understand it cause szError (the pointer) holds a valid address so i should be able to free it, right?
|
|
|
|
|
This message is telling you that you have a "buffer overrun problem", some part of the code has written to the no-mans-land inbetween blocks (#91) and (#92).
I would be inclined to set a breakpoint at the position you allocate the memory for szError, use the returned pointer value (rounded down to somewhere say at least 16bytes before that value) in the memory window, and single-step the code watching for the change that causes this, in VC6 you will see the area of "damage" turn red when it gets written to.
There are better ways than this to discover the exact cause, but I cannot remember them offhand.
Good hunting.
|
|
|
|
|
WHen i draw an icon in the resource editor, and display the image in a listview control on one of the columns, i can see that the background color isn't quite the same as the columns color. Is there a way to make it transparent, if not, how do i keep the color from chaning? I took and screenshot and found the RGB color value of the column and edited the colors in the Icon drawer but the color isnøt the same.
|
|
|
|
|
Since you said you are dealing with icons , you can use the Icon Editor's transparent color to draw the background: use the dark color that looks like it is sitting inside a black-framed monitor.
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
[Get Check Favorites 1.4 Now!]
|
|
|
|
|
When i use that the background becomes black.
|
|
|
|
|
I need more information on how you are trying to display the icon (using a static control with SS_ICON style, drawing it manually, etc.), and if possible, send me (via email) a copy of the ICO file you are trying to use and I will take a look at it to see if anything is wonky with it.
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
[Get Check Favorites 1.4 Now!]
|
|
|
|
|
I am trying to write down some application where I have to send large bitmaps across network. These bitmaps will be from a single source and possibility is that most of the time they will have very little difference with each other.
I am trying to write down a program so that I can calculate difference between two bitmaps and send across only data describing difference and recreate bitmap at receiving end.
I can do rest all fairly easily I guess other that I am not finding any thing on internet which can guide me to calculate difference between two bitmap images efficiently. Any kind of resource link will also be greatly appreciated in this regard.
Last point is that I have already experimented with all compressed bitmap formats like gif, jpeg as well as few compression algorithms and I think none of them reduce data that needs to be transferred across network fairly smaller.
Thanks,
Krishna
|
|
|
|
|
You could, like many video codecs does, split up the image in 16x16 blocks, compare the block and if there are no difference, just don't send it.
|
|
|
|
|
Another thing to keep in mind is if you are simply trying to diff the images, or are you trying to determine if a change is significant enough (like MPEG encoding/compression)? If the Former, any binary-capable diff -like utility should work.
A Quick-n-dirty way (which I do not recommend) would be to do calculate and store a difference for each pixel: if you have very little image difference, you will end up with a lot of "zero-value-deltas", which would compress easy and well.
But that would be like using a shotgun to kill a fly...
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
[Get Check Favorites 1.4 Now!]
|
|
|
|
|
Hi,
I am wondering if someone could instruct me on setting a pragma option so that it is in effect for a single source file only. In this case, I would like to disable a couple of warning messages, but I don't want to disable them from that point forward. I have a class, which is generating some of the Unreferenced inline function has been removed warnings (C4514, I think), and I would like to disable this warning for this particular class, or for the .cpp file the class is defined in. The particular project is a static library, so there is no stadafx.h.
Thanks,
Aaron
|
|
|
|
|
Example :-
#inlcude "stdafx.h"
#pragma warning (disable : 4786)
//Some thing that generates the warning
#pragma warning (default : 4786)
//Warning is reenabled
|
|
|
|
|
to really get rid of these warnings, you need to put that pragma after (and before) each place you #include the STL headers that are generating the warnings.
i think the STL headers actually reset the warning settings themselves, overriding whatever you've set. so, you have to keep resetting it.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Actually, it's not an STL header that's causing the problem. Just some C++ class with a bunch of inline functions. I can figure out how to turn off the warning, I just didn't want to leave it turned off for ever and ever, that seems like bad form. The project is in a pretty large workspace, with a lot of other projects, ant I was sure how to figure out how to bracket the source code that generated the warnings so that it would be reenabled for subsequent projects.
|
|
|
|
|
Well, it seems to be working now. I put the disable in the header of the offending class above the class declaration, and re-enable the warning after the #include "offending_class.h".
|
|
|
|
|
I want to get the selected text(if any) in the window with which the user is currently working. But window is not my application window, any window in system. I write this code:
CWnd* ParentWnd = GetForegroundWindow();
ParentWnd->GetWindowText( szWnd );
CWnd* ChildWnd = ParentWnd->GetTopWindow();
ChildWnd->SendMessage( WM_COPY, 0, 0 );
ShowWindow(SW_SHOW);
m_bShow = TRUE;
m_ctlWord.SetWindowText("");
m_ctlWord.Paste();
It works with notepad but doesn't work with Internet Explorer or MS Word. How can I get the text in all windows?
kozlu
|
|
|
|
|
How can I know when a file is opened ?
Ex: When a user use Notepad to open "a.txt", I can catch a message "WM_?" with lParam storing filename: "a.txt"
I want to use this message to write a program to lock any files in my system.
Any help ?
Thanks !
Hung Son
A Vietnamese student
i-g.hypermart.net
dlhson2001@yahoo.com
|
|
|
|
|
You can use LockFile or LockFileEx to lock a specific file, or drive.
|
|
|
|
|
How can I get the column count of a list control ? By functions is good as by message !
Ex: I can get the row count with GetItemCount(), LVM_GETITEMCOUNT,
but there is no GetColumnCount, LVM_GETCOLUMNCOUNT ?
Hung Son
A Vietnamese student
i-g.hypermart.net
dlhson2001@yahoo.com
|
|
|
|
|
Use List View Header Control GetItemCount to fetch the number of columns.
CHeaderCtrl * pMyHeaderCtrl = MyListCtrl.GetHeaderCtrl();
ASSERT(pMyHeaderCtrl != NULL);
int nColumns = pMyHeaderCtrl->GetItemCount();
Hth,
Ramu
|
|
|
|
|
Hey, I never understood it when implementing OnMeasureItem in ownerdraw menus how to calculate width. Height is easy since ::GetSystemMetrics(SM_CYMENU) is available. In most textbooks I've seen they just take the height (::GetSystemMetrics(SM_CYMENU)) and multiply it with some magic number, like 4. In other examples i've seen the following: ::GetSystemMetrics(SM_CXMENUCHECK) * 5. Is there some easy way or is the correct way to count the number of pixels you need and use that for itemWidth in the MEASUREITEMSTRUCT?
Thanks, Patric
|
|
|
|
|
When you open explorer, then the column that the items are sorted after has an arrow after the column title telling whether the sorting is ascending or descending. Can i add such an arrow in my listview control?
|
|
|
|
|
time to get yourself a copy of the MSDN, or visit www.microsoft.com. this answer to this question (and most of your others) is right there waiting for you...
but, what you need to do is to pass an HDITEM struct to the header control (which is a child of the list control). the HDITEM has flags that you can use to turn on that arrow.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Yes, there are several articles available that show you how.
If you are targeting Windows XP (or greater), the HDF_SORTDOWN and HDF_SORTUP styles/flags may help you.
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
[Get Check Favorites 1.4 Now!]
|
|
|
|
|
Where should i set those flags? WHen i use them the compiler says unknown identifier. As far as i can see i use them for the header control. But, isn't it possible to use the properties in my List COntrol?
|
|
|
|
|
You set those flags in the HDITEM structure which is used to directly manipulate Header Control items. You can get the Header Control from a ListView Control by sending it a message (or using CListCtrl::GetHeaderCtrl() ).
The reason they are showing up as undefined identifiers is because you have to set your _WIN32_WINNT and WINVER identifiers to the correct values before including any Win32 header files. You will also need to have an updated installation of the Platform SDK.
If your app is going to be running on other version of windows besides XP, you should really take the Owner Draw aproach: it is not that hard, and there are some existing articles that will walk you through it.
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
[Get Check Favorites 1.4 Now!]
|
|
|
|