AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 09.10.2007, 15:51   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
Good day guys,


here goes a guide how to manipulate ZIP archives using windows functionality. Here will be described technique for zipping and unzipping functionality. Functionality perfectly works on XP/2003/Vista machines. (Haven't tested on 2000 system). Year ago I was writing on mibuso this thing but maybe somebody would like to see complete article on this


As most of you know, Zip folders functionality appeared from WindowsXP was launched. So now we can use this feature in our Navision projects. For example client want to export any data from navision, ZIP it and send somewhere. So we will discuss second step: Zip it


So let's start by creating needed variables for this functionality (there are no much code to play with it):


Shell32 Automation 'Microsoft Shell Controls And Automation'.Shell - Shell Automation
ZIPFolder Automation 'Microsoft Shell Controls And Automation'.Folder - It will be our Zip Folder
ZipFile File - Zip File
Filename Text 250 - filename of a file to be transferred
IntVal Integer - integer value (discussed later)
ZipFileName Text 250 - zip file filename
i Integer- counter



Now let's start writing code


//Code
//>>CREATING ZIP FILE
ZipFile.CREATE('c:myzipfolder.zip'); //Zip file created
ZipFile.TEXTMODE(FALSE); // in binary mode
IntVal:=101010256; //here we input zip header (it's 6054B50)
ZipFile.WRITE(IntVal); //it's written here
IntVal:=0; //now we input next zip file information for more info refer to
//
http://www.pkware.com/documents/casestudies/APPNOTE.TXT
FOR i:=1 TO 9 DO
ZipFile.WRITE(IntVal); // 9 zeros in binary format - int32 type
ZipFile.CLOSE; // ok, proper zip file is prepared
CREATE(Shell32); // now we create shell automation
ZIPFolder:=Shell32.NameSpace('c:myzipfolder.zip'); //opening our zip file as a folder
Filename := 'c:testfile.txt'; // this file will be compressed into myzipfolder.zip archive
ZIPFolder.CopyHere(Filename); // just copying nice huh?
CLEAR(Shell32); //vuala



Same way you may extract files from zip files. Hope you like it Object is in attachment.


Br,
Igor Beeone



Подробнее... http://dynamicsuser.net/blogs/dynamicslife...s-features.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 


Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 12:49.