Click here to Skip to main content
16,006,001 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: challenging one Pin
jan larsen2-Mar-05 20:19
jan larsen2-Mar-05 20:19 
GeneralRe: challenging one Pin
mpapeo2-Mar-05 22:17
mpapeo2-Mar-05 22:17 
GeneralRe: challenging one Pin
jan larsen2-Mar-05 22:39
jan larsen2-Mar-05 22:39 
GeneralRe: challenging one Pin
mpapeo4-Mar-05 11:02
mpapeo4-Mar-05 11:02 
QuestionHow 2 make a string of 10 * in a row? Pin
jj2jj22-Mar-05 18:55
jj2jj22-Mar-05 18:55 
AnswerRe: How 2 make a string of 10 * in a row? Pin
ThatsAlok2-Mar-05 19:11
ThatsAlok2-Mar-05 19:11 
AnswerRe: How 2 make a string of 10 * in a row? Pin
jones20003-Mar-05 1:48
jones20003-Mar-05 1:48 
General[IFileSystem ] Problem using IFileSystem Interface from scrrun.dll Pin
Member 862302-Mar-05 18:47
Member 862302-Mar-05 18:47 
/*
Hi Duds,

I am using IFileSystem Interface from scrrun.dll.
It is easier to use "Scripting.FileSystemObject" in Visual Basic.

However, when srcrun.dll is imported so as to used in VC++ project is gives following
compilation error.

warning C4003: not enough actual parameters for macro 'GetFreeSpace'

GetFreeSpace falls under category of Obsolete Windows Programming Elements.
These functions are supported only for backward compatibility with the 16-bit Windows API.

To get rid of this problem, you need to undefine GetFreeSpace as #undef GetFreeSpace.
Now code starts compling properly.


Real Problem with this interface is:

void CopyFolder(
[in] BSTR Source,
[in] BSTR Destination,
[in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles);


When folder already exists CopyFolder API throws exception, even when passing
OverWriteFiles=FALSE.

My objetive is if the destination folder already exists, then copy folder should copy files
that are not present in the destination folder.

So, How to copy file to folder which might already exists?

Thanks & regards,
Rajesh

nikam_rajesh@hotmail.com

*/

#include <atlbase.h>

#undef GetFreeSpace // For warning C4003: not enough actual parameters for macro 'GetFreeSpace'

#import "scrrun.dll"
using namespace Scripting ;

int MyCopyFolder (char *szSrcPath, char *szDstPath)
{
CoInitialize (NULL) ;

try
{
IFileSystemPtr ifSysPtr ;

ifSysPtr.CreateInstance (__uuidof (FileSystemObject)) ;
ifSysPtr->CopyFolder (szSrcPath, szDstPath, FALSE) ;
}
catch (_com_error e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());

MessageBox (0, (char *)bstrSource, (char *)bstrDescription, MB_ICONINFORMATION) ;
}
catch (...)
{
MessageBox (0, "Error occured while copying file.", "Copy Folder Demo", 0) ;
}


CoUninitialize ();

return 1 ;
}


int main ()
{
int nRet = MyCopyFolder ("c:\\test", "c:\\test1") ;

return 0 ;
}

Rajesh Nikam
GeneralQuestion about window's state!!! Pin
kokehqyu2-Mar-05 18:45
kokehqyu2-Mar-05 18:45 
GeneralRe: Question about window's state!!! Pin
Ravi Bhavnani3-Mar-05 3:55
professionalRavi Bhavnani3-Mar-05 3:55 
GeneralRe: Question about window's state!!! Pin
kokehqyu3-Mar-05 17:39
kokehqyu3-Mar-05 17:39 
GeneralDevstudio addin Ques Pin
Jetli Jerry2-Mar-05 18:37
Jetli Jerry2-Mar-05 18:37 
GeneralMFC MDI with sound! Pin
Member 14844962-Mar-05 18:24
Member 14844962-Mar-05 18:24 
GeneralRe: MFC MDI with sound! Pin
David Crow3-Mar-05 2:17
David Crow3-Mar-05 2:17 
Questionhow do i..... Pin
namaskaaram2-Mar-05 17:27
namaskaaram2-Mar-05 17:27 
AnswerRe: how do i..... Pin
Steen Krogsgaard2-Mar-05 21:12
Steen Krogsgaard2-Mar-05 21:12 
GeneralRe: how do i..... Pin
namaskaaram2-Mar-05 22:08
namaskaaram2-Mar-05 22:08 
GeneralRe: how do i..... Pin
Steen Krogsgaard2-Mar-05 23:47
Steen Krogsgaard2-Mar-05 23:47 
GeneralRe: how do i..... Pin
namaskaaram3-Mar-05 17:28
namaskaaram3-Mar-05 17:28 
GeneralProblem with polymorphism Pin
ng kok chuan2-Mar-05 17:14
ng kok chuan2-Mar-05 17:14 
GeneralRe: Problem with polymorphism Pin
Ryan Binns2-Mar-05 17:17
Ryan Binns2-Mar-05 17:17 
GeneralRe: Problem with polymorphism Pin
ng kok chuan2-Mar-05 17:23
ng kok chuan2-Mar-05 17:23 
GeneralRe: Problem with polymorphism Pin
Ryan Binns2-Mar-05 22:27
Ryan Binns2-Mar-05 22:27 
GeneralRe: Problem with polymorphism Pin
ng kok chuan3-Mar-05 14:31
ng kok chuan3-Mar-05 14:31 
GeneralRe: Problem with polymorphism Pin
David Crow3-Mar-05 2:35
David Crow3-Mar-05 2:35 

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.