|
Hi All,
May be it's a basic thing for u guys... but I'm new, How can I remove all the files in a folder. I can give path to the folder. I'm not in position to give the names of all the files. Had it been possible, I would have used Remove(). I want to remove the files, what ever they are.....
Looking forward for a quick solutions from all of u.......
Dhirendra Mishra
|
|
|
|
|
look up CFilefind. You can iterate through a directory. Of course you can also step above it and delete it, I reckon you could also use shellexecute to del *.*
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
if you don't wanna use mfc there is an api - possibility
FindFirstFile and FindNextFile
Have fun
Bernhard
"I went on a diet, swore off drinking and heavy eating, and in fourteen days I had lost exactly two weeks." Joe E. Lewis [American humorist]
|
|
|
|
|
There's an easier way than enumerating files and deleting them one at the time. SHFileOperation with FO_DELETE command supports wildcards, so you should add *.* to folder name and call SHFileOperation. FOF_SILENT and FOF_NOCONFIRMATION will block any dialogs/messages displayed during delete.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
If it is the case that your EXE and DLLs are all linked to use the same runtime library -- do you have to worry about memory allocated in the DLL (with new), and then free'd in the EXE (with delete).
What about malloc and free?
And -- what if the RTL you use is the shared library DLL.
What about threaded RTL?
Did this question cover the possiblities....?
Thanks in advance!
-peter
|
|
|
|
|
|
|
I want to create an Excel file using VC++. Also i would like to append records in this file programatically. I want to do it without using ODBC. Can any body help me out
|
|
|
|
|
It can be done using Excel as a COM object, although obviously you need Excel installed to do it.
I don't recall the details, but I know they came from a CUJ or WDJ article.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Woo, it's not too difficult to manipulate Excel programmatically, believe me
I've just written a prototype for two-days, and I never "touch" on Excel before, but my application seemed work-well
Tips: Use VB6 for explore the object model of Excel (and any Office applications), read "Office 2000 Developer's Guide" in MSDN, and the last,
#import "Excel.exe" and GO!!!
good luck,
|
|
|
|
|
|
It's time for the experts to help out.
I have a situation where I need to guarantee that an object is created and deleted from the same point. Better said that if it is "new'd" in a DLL, the delete must happen there too. [the linkage of the new and delete must be from the same source]
Or created in the EXE and deleted there.
The twist of this -- is that these objects are being created, and then fed into a machine object, which will dispose them when done. After I create this object, and feed it to the machine, then I am done with it. The machine object will use it, and dispose of it when done.
So, here's an example:
class BaseObject
{
public:
virtual void DeleteThis() = 0;
virtual void DoSomething() = 0;
};
class MyClass : public BaseObject
{
static New();
MyClass();
virtual void DeleteThis();
virtual void DoSomething();
};
MyClass *MyClass::New()
{
return new MyClass();
}
MyClass::MyClass()
{
}
void MyClass::DeleteThis()
{
delete this;
}
void MyClass::DoSomething()
{
printf( "%s", "I did it" );
}
/// some code
...
MyClass pObj = MyClass::New();
pObj->DoSomething();
pObj->DeleteThis();
...
this works -- but the question of safety has come up -- and this sample forces the linkage of new and delete to reside in the same .OBJ file (does this make sense?).
Is "delete this" safe in this situation?
|
|
|
|
|
this works -- but the question of safety has come up
AFAIK this is safe. It's OK to perform 'delete this'. Of course, you shouldn't access object after deleting.
this sample forces the linkage of new and delete to reside in the same .OBJ file
I believe new and delete do not reside in .obj file - they come from static/dynamic C++ runtime .lib.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
This is also the way the MS teachs reference counting support in COM objects.
<br />
void IClass::Release()<br />
{<br />
if ( --m_RefCount == 0 )<br />
{<br />
delete this;<br />
}<br />
}<br />
so, doing this, is fine to. It does look strange...
<br />
void IClass::DeleteThis()<br />
{<br />
delete this;<br />
}<br />
|
|
|
|
|
|
I am currently confused as to which control I should be using in my dialog.
The control is to display information as steps are completed. I want it to have the following capabilities.
1. Output only.
2. Multiple lines.
3. Add lines one at a time.
4. Handle different fonts.
CEdit - 1, 2 and 4
CStatic - 1 and 2
Am I missing something? Can one of these controls do all I want? Or is there another control that can do whatI want?
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
"Don't belong. Never join. Think for yourself. Peace"
- Victor Stone
|
|
|
|
|
I do that with our console in Win32 like this:
::SetFocus (editControl);
::SendMessage (editControl, EM_SETSEL, (WPARAM)length, (LPARAM)length);
::SendMessage (editControl, EM_REPLACESEL, 0, (LPARAM) ((LPSTR) str.c_str()));
::SendMessage(editControl, EM_LINESCROLL, 0, (SendMessage(editControl, EM_GETLINECOUNT, 0, 0)));
Essentially I select the caret position at the end, and replace it with the text I want to append, thus adding a line. I also catch the message that tells me the edit is full and trim from the top to make room at the bottom, but I've not shown that. The last line scrolls the edit box down to the line I just added.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
If you need (4), you'll have to abandon CEdit and CStatic. I think you should use CRichEditCtrl or custom-draw CListCtrl.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I want get the data of cell(X,X) from a Excel document ,how to implement the COM object?
Please pardon my weak English!
|
|
|
|
|
|
Thanks a lot,I got it!
Please pardon my weak English!
|
|
|
|
|
This is a great article located here:
http://www.codeproject.com/combobox/customcombo.asp
Its a CListBox. Can someone, anyone help me make it variable row height? Some of my text is really short, just one (1) line? Some of my text is really long, 3-6 lines. How can I make it variable row height?
Please, please, please, any response any one can give me will be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
Will this do?
http://www.codeproject.com/useritems/changerowheight.asp
|
|
|
|
|
|
Anyone know how I could set the Zorder of my window or how i would go about setting an application or window behind the desktop icons?
Any ideas, theories or opinions would be great,
Ryan
|
|
|
|