AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DllCall and structure with strings

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Peter



Joined: 30 Dec 2005
Posts: 279

PostPosted: Sun Jan 15, 2006 1:10 pm    Post subject: DllCall and structure with strings Reply with quote

I want to use a dll for compressing files to zip format. I found zip32.dll here.
As far as I understand it, it seems to need a structure with strings (and others) for DllCall.
Is it possible to use this DLL with strings structure in AutoHotkey?
Thanks
Code:

(From WinDll.txt included in the download:)
BOOL WINAPI ZpSetOptions(ZPOPT)
typedef struct {
LPSTR Date;             /* Date to include after */
LPSTR szRootDir;        /* Directory to use as base for zipping */
LPSTR szTempDir;        /* Temporary directory used during zipping */
BOOL fTemp;             /* Use temporary directory '-b' during zipping */
BOOL fSuffix;           /* include suffixes (not implemented in WiZ) */
BOOL fEncrypt;          /* encrypt files */
BOOL fSystem;           /* include system and hidden files */
BOOL fVolume;           /* Include volume label */
BOOL fExtra;            /* Exclude extra attributes */
BOOL fNoDirEntries;     /* Do not add directory entries */
BOOL fExcludeDate;      /* Exclude files earlier than specified date */
BOOL fIncludeDate;      /* Include only files earlier than specified date */
BOOL fVerbose;          /* Mention oddities in zip file structure */
BOOL fQuiet;            /* Quiet operation */
BOOL fCRLF_LF;          /* Translate CR/LF to LF */
BOOL fLF_CRLF;          /* Translate LF to CR/LF */
BOOL fJunkDir;          /* Junk directory names */
BOOL fGrow;             /* Allow appending to a zip file */
BOOL fForce;            /* Make entries using DOS names (k for Katz) */
BOOL fMove;             /* Delete files added or updated in zip file */
BOOL fDeleteEntries;    /* Delete files from zip file */
BOOL fUpdate;           /* Update zip file--overwrite only if newer */
BOOL fFreshen;          /* Freshen zip file--overwrite only */
BOOL fJunkSFX;          /* Junk SFX prefix */
BOOL fLatestTime;       /* Set zip file time to time of latest file in it */
BOOL fComment;          /* Put comment in zip file */
BOOL fOffsets;          /* Update archive offsets for SFX files */
BOOL fPrivilege;        /* Use privileges (WIN32 only) */
BOOL fEncryption;       /* TRUE if encryption supported, else FALSE.
                           this is a read-only flag */
int  fRecurse;          /* Recurse into subdirectories. 1 => -r, 2 => -R */
int  fRepair;           /* Repair archive. 1 => -F, 2 => -FF */
char fLevel;            /* Compression level (0 - 9) */
} ZPOPT, _far *LPZPOPT;
Back to top
View user's profile Send private message
shimanov



Joined: 25 Sep 2005
Posts: 612

PostPosted: Sun Jan 15, 2006 6:04 pm    Post subject: Re: DllCall and structure with strings Reply with quote

Peter wrote:
structure with strings... Is it possible to use this DLL with strings structure in AutoHotkey?

typedef struct {
LPSTR Date;
...
}


Yes.

LPSTR is a null-terminated string, and is defined as a pointer to a character (uint1) array. For example:

Code:

VarSetCapacity( struct, struct_size, 0 )

date = Sunday, January 15, 2006

EncodeInteger( &date, 4, &struct, 0 )
etc.
Back to top
View user's profile Send private message
Peter



Joined: 30 Dec 2005
Posts: 279

PostPosted: Sun Jan 15, 2006 8:28 pm    Post subject: Reply with quote

Thank you. Smile
I hope I can get it working now.
Back to top
View user's profile Send private message
Venia Legendi



Joined: 27 May 2005
Posts: 38

PostPosted: Mon Oct 09, 2006 12:48 pm    Post subject: Reply with quote

Hi Peter, did you get it working?
Back to top
View user's profile Send private message
Peter



Joined: 30 Dec 2005
Posts: 279

PostPosted: Wed Oct 11, 2006 8:13 am    Post subject: Reply with quote

Regarding my question about ZpSetOptions, it seems to work so far, but not the zip function itselfs. Because, as far as I understand you have to be able to use Callback for the ZpArchive function of the dll. At that point I gave up. And AFAIK it's not possible in AHK.
So, maybe it's possible to use in AHK, but it goes beyond my knowledge.
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 3644
Location: Belgrade

PostPosted: Wed Oct 11, 2006 8:25 am    Post subject: Reply with quote

No it is not possible to use callbacks in AHK.
That is why I urge so hard for & extension to return function address.

Acctually it is possible to do so, but it requires nasty hack and good ASM knowledge. Chris rised priority to & wish so lets hope it will come soon.

Btw, peter, you might be able to find dll that will be able to compress without callback function. I am sure you ca.
_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group