The following working code is used to delete the contents of the c:\temp directory.
char *File = "C:\\temp\\*.???\0";
SHFILEOPSTRUCT op;
ZeroMemory(&op, sizeof(op));
op.hwnd = Handle;
op.wFunc = FO_DELETE;
op.pFrom = File;
op.fFlags=FOF_NOCONFIRMATION;
SHFileOperation( &op);
I want to be able to subsitute the "C:\\temp\\*.???\0" with a string as read from a Label1->Caption but I get a compiler error, can't convert AnsiString to char.
Is there a simple way to make the following work?
Label1->Caption="C:\\temp\\*.???\0";
char *File = Label1->Caption; //this line doesn't work!!!
etc
etc
etc
char *File = "C:\\temp\\*.???\0";
SHFILEOPSTRUCT op;
ZeroMemory(&op, sizeof(op));
op.hwnd = Handle;
op.wFunc = FO_DELETE;
op.pFrom = File;
op.fFlags=FOF_NOCONFIRMATION;
SHFileOperation( &op);
I want to be able to subsitute the "C:\\temp\\*.???\0" with a string as read from a Label1->Caption but I get a compiler error, can't convert AnsiString to char.
Is there a simple way to make the following work?
Label1->Caption="C:\\temp\\*.???\0";
char *File = Label1->Caption; //this line doesn't work!!!
etc
etc
etc