Copying a file using WINAPI Classes in AX2009
static void WinApiClassestocopythefile(Args _args)
{
#avifiles
boolean present;
SysOperationProgress simpleProgress;
int i;
;
// startlengthyoperation();
SimpleProgress = SysOperationProgress::newGeneral(#aviupdate, 'Simple', 100);
if(WinAPI::fileExists("C:\\Documents and Settings\\nikhil.pujar\\My Documents\\Downloads\\ganatharva.pdf"))
{
for (i=1; i<=100; i++)
{
simpleProgress.incCount();
simpleprogress.setText(strfmt("%1% Of File is being Copied",i));
sleep(200);
}
WinAPI::copyFile("C:\\Documents and Settings\\nikhil.pujar\\My Documents\\Downloads\\ganatharva.pdf","C:\\Documents and Settings\\nikhil.pujar\\My Documents\\Morphx\\ganatharva.pdf",true);
Simpleprogress.kill();
}
else
{
info("This file does not exist");
}
info("The file has been Copied :)");
info(strfmt("The filesize is %1",WinApi::fileSize("C:\\Documents and Settings\\nikhil.pujar\\My Documents\\Morphx\\ganatharva.pdf")));
info(WinAPI::getComputerName());
//endlengthyoperation();
}
No comments:
Post a Comment