|
jhwurmbach wrote:
CArray is almost useless.
YES YES YES YES YES !!!!!
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Instead of returning a CArray (which is impossible no matter what you do since it's a template class; but that's another story) do this:
void CMyClass::MyFunction(CStringArray& a)
{
CString str_component = "test";
a.add(str_component);
} #include "afxtempl.h" to use the class 'CStringArray'. To use 'MyFunction' do like this:
void CMyClass::AnotherFunction()
{
CStringArray myArray;
this->MyFunction(myArray);
} After the call to 'MyFunction' the string is still added since the array is sent by reference. And there is no need for a copy constructor for the same reason.
Sprudling
|
|
|
|
|
Hi everybody!
Just wanted to know whether there are any good places/articles that will give instructions on how to define and create STLs and general information about what are they used for.
Thanks!
Kind regards,
wilche
|
|
|
|
|
http://www.codeproject.com/vcpp/stl/
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
AS well as articles here, try www.sgi.com for good online docs.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
I am trying to profile some performance-critical code and I can't seem to get the profiler to work. It's been ages since I have used it, so I am probably doing something dumb.
I am using MS Visual Studio 6 Pro, SP 5 under Win2k Pro SP 2. I am running on an account that is a member of "Administrators" and I have granted "Administrators" the right to profile both single processes and system processes.
- I create a new project from MSDEV (The same thing happens for both console and MFC applications).
- I go to "Project/Settings," choose the release build, and tell C++ to generate program database debugging info, and tell link to enable profiling and output both a map file and debuging info.
- Set build config to Release and rebuild all.
- "Profile..." is still grayed in the "Build" menu.
- If I run PREP, PROFILE, PREP /M, PLIST from the command line, I get some output, but PLIST throws a fatal error trying to read illegal memory (
The instruction at "0x004060f6" referenced memory at "0x7bd22ef0." The memory could not be "read" ).
Can anyone help me understand why the code profiler seems not to be working here?
|
|
|
|
|
I found some answers to my own problem:
- KB Q224382 answers why the profiler is grayed out on the menu. There is a known bug, whereby you need to manually create the registry value (REG_DWORD) HKLM\Software\Microsoft\DevStudio\6.0\General\ProfilerInstalled = 0x1
- KB Q195374 answers the PLIST crash. PLIST cannot handle symbols longer than 255 characters, so it crashes if you use STL with call attributed profiling.
I have found another bug with the profiler. The debug info generated by MSVC has multiple line numbers for several STL functions, so you get scads of "offset duplication" error messages from PREP.
Oh well, I guess profiling STL is not really possible on VC6. Does anyone know if it is possible under VC7?
|
|
|
|
|
It's better to get some good profilers like NuMega TrueTime. I think there is one which they are giving away for free for VC7 go to http://www.compuware.com. Look for something called Community Profiler
|
|
|
|
|
Hello there !
I have a bitmap
I just want to draw a line and paint a part of the bitmap !
How could i do that ?
What's ur idea ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hadi_Rezaie wrote:
What's ur idea ?
Look it up yourself before asking ?
What do you mean by paint a part of the bitmap ? Do you mean use the ExtFloodFill function, or the FillSolidRect function ? As for drawing lines, MoveTo and LineTo usually do the trick.
Or did I misread the question entirely ? The header said 'filtering an image', not drawing on it.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Thanks dear Christian !
The answer was ExtFloodFill
Thanks alot !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I've searched in CP for some articles regarding to using the MFC class CPropertySheet, some articles here provided the way how to remove the "apply" button, which by default is visible and disabled, however, none mentioned how to actually use the "apply" button, that is, make that button enabled and interact with user input.
As far as I know, in order to enable the "apply" button I need to derive a class from CPropertySheet... and then what? Which method I need to override in new class? Thanks.
|
|
|
|
|
CPropertyPage::SetModified
From MSDN:
Example
BEGIN_MESSAGE_MAP(CColorPage, CPropertyPage)
ON_CONTROL_RANGE(BN_CLICKED, IDC_BLACK, IDC_BLUE, OnColorClicked)
END_MESSAGE_MAP()
void CColorPage::OnColorClicked(UINT nCmdID)
{
COLORREF color;
switch (nCmdID)
{
case IDC_BLACK:
color = RGB(0, 0, 0);
break;
case IDC_RED:
color = RGB(255, 0, 0);
break;
case IDC_GREEN:
color = RGB(0, 255, 0);
break;
case IDC_BLUE:
color = RGB(0, 0, 255);
break;
}
if (color != m_Color)
{
m_Color = color;
SetModified();
}
}
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Cool it worked, thank you!
But what happens after I click the "Apply" button? It turens disabled again until the next call of SetModified(TRUE) , I guess when I click "Apply" button, UpdateData(TRUE) is automatically called, and what else? Can I override a function(if any) so that when I click "Apply" it does something else other than default? I'm just curious about the internal work behind the "Apply" button.
|
|
|
|
|
Clicking [Apply] will trigger CPropertyPage::OnApply() which by default calls CPropertyPage::OnOK() . You can override either or both of those functions to "do something" when the user clicks [Apply] (or [OK] for that matter].
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
[Get Check Favorites 1.4 Now!]
|
|
|
|
|
|
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!]
|
|
|
|