|
Hello,
How do you delete executable files in windows?
The following will not work but return that they have:
unlink(file);
DeleteFile(file);
Remove(file);
system("del file");
The following will not allow me access rights to delete the file:
CFile::Remove(file);
Any Suggestions?
~C
|
|
|
|
|
Two questions:
1. Does the user you're logged in as have the proper permissions to be able to delete the file (assuming you're running in an NT based environment)? If not, then log in as Administrator and try again.
2. Are you trying to delete the exe you're currently running in. I don't think this is the case, but if it is... duh!! You can't delete it because it is in use.
Best regards and good luck.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
CArray<cstring,cstring &=""> CMyClass::MyFunction(const char*,const char*)
{
CArray<cstring,cstring &=""> tmp;
CString str_component = "test";
tmp.Add(str_component);
return tmp;
}
=======Compile=========
error C2558: class 'CArray<class cstring,class="" cstring="" &="">' : no copy constructor available
What's wrong ?
What could I do (show me the example please)?
Thanks a lot for your kindness
|
|
|
|
|
// make sure you have this include file:
#include <Afxtempl.h>
//Put this in your header
CArray<CString,CString> yourArray;
//This is how you would do it in your cpp file
yourArray.InsertAt(0,YourString);
Try this, my first response wasn't formatted correctly.
<i>
After a poor performance in London in 1899, Steinitz went insane and died a year later on August 12, 1900 at Wards Island, N.Y.</i>
|
|
|
|
|
heyyyyyyyy just repaly after knowing the problem.he wants to retun a CArray from a function...
me also face the same problem
Renjith-The CPian.
|
|
|
|
|
> he wants to retun a CArray from a function...
> me also face the same problem
Doesn't work!
Solution: use std::vector and fire the responsible MS-Programmer
Really: To return a CArray by value requires the use of the copy constructor
to copy the object (as the local instance will be destructed on return from the function.
But-CArray has got no copy constructor, meaning CArray is almost useless.
Greetings
Jan-Henner Wurmbach
|
|
|
|
|
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.
|
|
|
|