🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10072

Re: Temporary File

#10072
From: Remy Lebeau (TeamB)
Date: Wed, 26 May 2004 19:46
34 lines
2629 bytes
"Randel Bjorkquist" <rbjorkquist@coilcraft.com> wrote in message
news:40b4d96f@newsgroups.borland.com...

> I am retrieving the file and letting windows open it with its
> associated program.  So if I change it, I'm not sure how to
> open the file so the end-user can see it.

Rather than using ShellExecute(), you could use FindExecutable() with the
original filename, and then use CreateProcess() to run the program directly,
passing it the temporary filename.  Then it (usually) doesn't matter what
the filename actually is.  Or, you can just look in the Registry directly to
determine how a given file extension should be loaded (you can use my
TRegExtension component for that: http://reg.lebeausoftware.org).

> I guess I was being lazy by trying to let Windows clean it up without
> having to write something to do it.

I suggest you read the following article, it explains how to work with the
Disk Cleanup utility:

    Creating a Disk Cleanup Handler

http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_extending/disk_cleanup.asp

    "The basic challenge inherent in disk cleanup is to free as much disk
space as possible without deleting essential files. Because there is no
standard way to mark files for cleanup, no single application can reliably
detect and clean all unessential files. The Disk Cleanup utility addresses
this problem by splitting the cleanup operation between a single disk
cleanup manager and a collection of disk cleanup handlers."


Gambit
Technical Details
Message-ID: <40b4f51f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40b2105a$1@newsgroups.borland.com> <40b21210@newsgroups.borland.com> <40b216d1@newsgroups.borland.com> <40b21989$1@newsgroups.borland.com> <40b21cf1$1@newsgroups.borland.com> <40b2276a$1@newsgroups.borland.com> <40b4d96f@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,30cb4b5f364f10fa
X-Google-Attributes: gid10cc67,public
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <40b2105a$1@newsgroups.borland.com> <40b21210@newsgroups.borland.com> <40b216d1@newsgroups.borland.com> <40b21989$1@newsgroups.borland.com> <40b21cf1$1@newsgroups.borland.com> <40b2276a$1@newsgroups.borland.com> <40b4d96f@newsgroups.borland.com>
Subject: Re: Temporary File
Date: Wed, 26 May 2004 12:46:12 -0700
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 67.22.135.163
Message-ID: <40b4f51f$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1085601055 67.22.135.163 (26 May 2004 12:50:55 -0700)
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail