📄 oxuncstandardactor.h
字号:
// ==========================================================================
// Class Specification : COXUNCStandardActor
// ==========================================================================
// Header file : OXUNCStandardActor.h
// Source : R.Mortelmans
// Creation Date : 19th November 1996
// Last Modification : 19th November 1996
// //////////////////////////////////////////////////////////////////////////
// Properties:
// NO Abstract class (does not have any objects)
// YES Derived from CObject
// NO Is a Cwnd.
// NO Two stage creation (constructor & Create())
// NO Has a message map
// NO Needs a resource (template)
// NO Persistent objects (saveable on disk)
// NO Uses exceptions
// //////////////////////////////////////////////////////////////////////////
// Desciption :
// This class works together with the COXUNC class. The COXUNC class encapsulates
// the data, whereas this COXUNCStandardActor class encapsulates the actual actions
// (moving, deleting etc.)
// Remark:
// All result codes are full HRESULTs. Win32 error are converted through
// the HRESULT_FROM_WIN32 macro
// Return values are only valid when the result code is SUCCEEDED
// Prerequisites (necessary conditions):
/////////////////////////////////////////////////////////////////////////////
#ifndef __OXUNCSTANDARDACTOR_H__
#define __OXUNCSTANDARDACTOR_H__
#include "OXUNC.h"
class AFX_EXT_CLASS COXUNCStandardActor : public CObject
{
DECLARE_DYNAMIC(COXUNCStandardActor);
// Data members -------------------------------------------------------------
public:
static COXUNCStandardActor m_theOneAndOnly;
// --- The one and only instantiation of this class
protected:
private:
// Member functions ---------------------------------------------------------
public:
COXUNCStandardActor();
// --- In :
// --- Out :
// --- Returns :
// --- Effect : Constructs the object
virtual HRESULT MakeAbsolute(COXUNC& UNC);
// --- In : UNC : The (possible relative) UNC
// --- Out : UNC : The absolute representation of the UNC is successful,
// otherwise the original value
// --- Returns : The result code
// --- Effect : Converts a possible relativeUNC to and absolute one
virtual HRESULT Exists(COXUNC UNC, BOOL& bExists);
// --- In : UNC : The UNC
// --- Out : bExists : Whether the UNC (directory / file) exists
// --- Returns : The result code
// --- Effect : Checks the existance of an UNC.
// Note that when queried whether a directory exists
// and a file with the specified name is found, FALSE is returned
// So both the name and the type (directory/file) must match
virtual HRESULT Create(COXUNC UNC);
// --- In : UNC : The UNC (deirectory / file) to create
// --- Out :
// --- Returns : The result code
// --- Effect : Creates a directory or file (or both)
virtual HRESULT CreateTemporaryFile(COXUNC tempDir, LPCTSTR pszPrefix, COXUNC& file);
// --- In : tempDir : The directory in which a temporary file should be created
// pszPrefix : The (3-character) prefix to be used in the file name
// --- Out : file : The file that has been created or empty otherwise
// --- Returns : The result code
// --- Effect : Creates an empty temporary file in the specified directory
// This file is not deleted automatically
virtual HRESULT Copy(COXUNC sourceUNC, COXUNC destinationUNC, BOOL bReplaceExisting);
// --- In : sourceUNC : The source UNC (file)
// destinationUNC : The destination UNC (file)
// bReplaceExisting : Whether an existing file should be replaced
// --- Out :
// --- Returns : The result code
// --- Effect : Copies the file to a different location
virtual HRESULT MoveRename(COXUNC sourceUNC, COXUNC destinationUNC, DWORD dwFlags);
// --- In : sourceUNC :
// destinationUNC :
// dwFlags : Any combination of
// MOVEFILE_COPY_ALLOWED : Whether a copy to a different disk is allowed
// MOVEFILE_REPLACE_EXISTING : Whether an already existing destination should be overwritten
// MOVEFILE_DELAY_UNTIL_REBOOT : (NT only) Command is only executed when the operating system is restarted
// MOVEFILE_WRITE_THROUGH : (NT only) The function does not return until the file has actually been moved on the disk.
// --- Out :
// --- Returns : The result code
// --- Effect : Moves or replaces the specified file or directory
virtual HRESULT Delete(COXUNC UNC, BOOL bRemoveReadOnly);
// --- In : UNC :
// bRemoveReadOnly : Whether read/only files should also be deleted
// --- Out :
// --- Returns : The result code
// --- Effect : Deletes the specified file or directory
virtual HRESULT GetCurrentDirectory(COXUNC& UNC);
// --- In :
// --- Out : UNC : The current directory if succesful (empty otherwise)
// --- Returns : The result code
// --- Effect : Retrieves the current directory of this process
virtual HRESULT SetCurrentDirectory(COXUNC UNC);
// --- In : UNC : The directory to make current
// --- Out :
// --- Returns : The result code
// --- Effect : Sets the current directory of this process
virtual HRESULT GetWindowsDirectory(COXUNC& UNC);
// --- In :
// --- Out : UNC : The windows directory if succesful (empty otherwise)
// --- Returns : The result code
// --- Effect : Retrieves the windows directory
virtual HRESULT GetSystemDirectory(COXUNC& UNC);
// --- In :
// --- Out : UNC : The windows system directory if succesful (empty otherwise)
// --- Returns : The result code
// --- Effect : Retrieves the windows system directory
virtual HRESULT GetApplicationDirectory(COXUNC& UNC);
// --- In :
// --- Out : UNC : The application directory if succesful (empty otherwise)
// --- Returns : The result code
// --- Effect : Retrieves the directory in which this executable is located
virtual HRESULT GetTemporaryDirectory(COXUNC& UNC);
// --- In :
// --- Out : UNC : The temporary directory if succesful (empty otherwise)
// --- Returns : The result code
// --- Effect : Retrieves the temporary directory
virtual HRESULT GetSize(COXUNC UNC, DWORDLONG& nSize);
// --- In : UNC : The UNC (file) to query
// --- Out : nSize : The size in bytes of the specified file
// --- Returns : The result code
// --- Effect : Retrieves the size of a file
virtual HRESULT GetCompressedSize(COXUNC UNC, DWORDLONG& nSize);
// --- In : UNC : The UNC (file) to query
// --- Out : nSize : The compressed size in bytes of the specified file
// --- Returns : The result code
// --- Effect : Retrieves the compressed size of a file
virtual HRESULT SetSize(COXUNC UNC, DWORDLONG nSize);
// --- In : UNC : The UNC (file) to change
// nSize : The new size in bytes of the specified file
// --- Out :
// --- Returns : The result code
// --- Effect : Sets the new size of a file
// When the file is enlarged, the added bytes have an undefined value
virtual HRESULT GetShortName(COXUNC UNC, COXUNC& shortUNC);
// --- In : UNC : The UNC
// --- Out : shortUNC : The short (8.3) name of the UNC if successful or empty otherwise
// --- Returns : The result code
// --- Effect : Converst a UNC to an 8.3-format name
virtual HRESULT GetLongName(COXUNC UNC, COXUNC& longUNC);
// --- In : UNC : The UNC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -