Click here to Skip to main content
15,921,660 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Reference to Variables? Pin
GeMe_Hendrix3-Dec-03 11:36
GeMe_Hendrix3-Dec-03 11:36 
GeneralRe: Reference to Variables? Pin
Christian Graus3-Dec-03 11:39
protectorChristian Graus3-Dec-03 11:39 
GeneralInsertColumn ordering Pin
ns3-Dec-03 9:16
ns3-Dec-03 9:16 
GeneralRe: InsertColumn ordering Pin
David Crow3-Dec-03 10:38
David Crow3-Dec-03 10:38 
GeneralDebug assertion failed dbgheap.c! :( Pin
Kuniva3-Dec-03 9:04
Kuniva3-Dec-03 9:04 
GeneralCRichEditView and jpg images Pin
Anonymous3-Dec-03 8:58
Anonymous3-Dec-03 8:58 
GeneralRe: CRichEditView and jpg images Pin
Joel Lucsy4-Dec-03 3:31
Joel Lucsy4-Dec-03 3:31 
GeneralDeleting tmp files from windows service Pin
haritadala3-Dec-03 8:32
haritadala3-Dec-03 8:32 
Hello all

I coded a window service which creates a lot of tmp files in the course of its operation. I wanted to delete these files once service is stopped. I'm using the following code to do so in destructor function ...

SHFILEOPSTRUCT fs ;

char buff[255];
char tmp[]="\\*\0\0";

sprintf(buff,"%s%s",sWorkingDir,tmp);

int len=strlen(buff);

buff[++len]=NULL;
buff[++len]=NULL;

fs.hwnd = NULL;
fs.wFunc = FO_DELETE ;
fs.pFrom = ( LPCSTR ) buff ;
fs.pTo = NULL;
fs.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_SILENT;

if(SHFileOperation ( &fs ) ==0)
WriteLogData('I',5,"DST","Successfully deleted tmp files");
else
WriteLogData('E',5,"DST","Unable to delete tmp files");

but the above code is not working within windows service. When I used the same code in a standalone application it is working. When I use GetLastError() in service I'm getting value 6( stands for INVALID_HANDLE). Can any one help me in this

Thanks for your help
Hari.
GeneralRe: Deleting tmp files from windows service Pin
Jörgen Sigvardsson3-Dec-03 8:54
Jörgen Sigvardsson3-Dec-03 8:54 
GeneralRe: Deleting tmp files from windows service Pin
haritadala3-Dec-03 13:13
haritadala3-Dec-03 13:13 
GeneralRe: Deleting tmp files from windows service Pin
Jörgen Sigvardsson3-Dec-03 13:21
Jörgen Sigvardsson3-Dec-03 13:21 
Questionhow can i Transfer a PictureBox picture to an array of bytes? Pin
asd17533-Dec-03 7:41
asd17533-Dec-03 7:41 
GeneralDao DB Pin
rfraser3-Dec-03 6:11
rfraser3-Dec-03 6:11 
GeneralRe: Dao DB Pin
RChin3-Dec-03 7:33
RChin3-Dec-03 7:33 
GeneralRe: Dao DB Pin
GeMe_Hendrix3-Dec-03 11:31
GeMe_Hendrix3-Dec-03 11:31 
GeneralRe: Dao DB Pin
RChin3-Dec-03 12:54
RChin3-Dec-03 12:54 
GeneralRe: Dao DB Pin
coralsnake_21-Dec-03 8:49
coralsnake_21-Dec-03 8:49 
GeneralScrolling CRichEditCtrl to the limit Pin
RickyC3-Dec-03 6:07
RickyC3-Dec-03 6:07 
GeneralCapture application start Pin
zebiloute3-Dec-03 5:45
zebiloute3-Dec-03 5:45 
GeneralRe: Capture application start Pin
Anonymous3-Dec-03 7:38
Anonymous3-Dec-03 7:38 
GeneralRe: Capture application start Pin
David Crow3-Dec-03 7:41
David Crow3-Dec-03 7:41 
GeneralRe: Capture application start Pin
Peter Molnar3-Dec-03 13:02
Peter Molnar3-Dec-03 13:02 
GeneralOracle BLOBs and VC++ Pin
JYoder3-Dec-03 5:32
JYoder3-Dec-03 5:32 
GeneralRe: Oracle BLOBs and VC++ Pin
Joel Lucsy3-Dec-03 8:34
Joel Lucsy3-Dec-03 8:34 
GeneralRe: Oracle BLOBs and VC++ Pin
JYoder3-Dec-03 8:42
JYoder3-Dec-03 8:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.