SetFilePointerEx

LBaliao

Member
Hello. I'm creating a stack image file that has the tendency to get big in size. Before I add an image to it, I use the "SetFilePointer" in kernel32 to move the file pointer to the end of file. The problem is that SetFilePointer has limitation in size. I looked at MSDN for solutions and found the "SetFilePointerEx". The code I copied/pasted below is from MSDN. My problem is that I do not know how to translate this into a PROGRESS procedure.

BOOL SetFilePointerEx(
HANDLE hFile,
LARGE_INTEGER liDistanceToMove,
PLARGE_INTEGER lpNewFilePointer,
DWORD dwMoveMethod
);

I'd appreciate your help. Thanks in advance.

Liza
 

LBaliao

Member
Yes. That's the requirement. We have individual images that I need to write to one image file. So, it's like this:

Say I have 3 items where each has A and B images. To illustrate:

ITEM #1
--------
Image A
--------
Image B
--------

ITEM #2
--------
Image A
--------
Image B
--------

ITEM #3
--------
Image A
--------
Image B
--------

The image file that I'm creating will look like this:

IMAGE FILE
----------------
Item #1 Image A
----------------
Item #1 Image B
----------------
Item #2 Image A
----------------
Item #2 Image B
----------------
Item #3 Image A
----------------
Item #3 Image B
----------------

So as you can see, the Image file that I'm creating may grow really big in size depending on the number of items I have to process.

Liza
 

joey.jeremiah

ProgressTalk Moderator
Staff member
os-append value( "<source file>" ) value( "<target file>" ).


Liza,

if you're referring to graphical images, like, gif, jpeg, bmp etc.

its not as simple as just putting them together in a file. theres a certain
format to it, compression etc. its much more complicated then it looks.

even if its some bit for bit image copy of something you'd need someway to
tell where one ends and the other begins once you've put them together.


if you want to manage files you can store them in a database using blobs
that'll let you attach info and simplify all the management that goes with it.

currently database have a limit of just a few petas if you think it might
be a problem, in 10.1b, its somewhere in the exa or zettabytes.


if its putting together images visually one possible solution can be using
a container document like html, pdf etc.

think simple. hth
 

LordZsh

New Member
Here is an example , I used an Api like you
here code on C#

BOOL GlobalMemoryStatusEx(
LPMEMORYSTATUSEX lpBuffer
);

typedef struct _MEMORYSTATUSEX {
DWORD dwLength;
DWORD dwMemoryLoad;
DWORDLONG ullTotalPhys;
DWORDLONG ullAvailPhys;
DWORDLONG ullTotalPageFile;
DWORDLONG ullAvailPageFile;
DWORDLONG ullTotalVirtual;
DWORDLONG ullAvailVirtual;
DWORDLONG ullAvailExtendedVirtual;
} MEMORYSTATUSEX,
*LPMEMORYSTATUSEX;

and here is Api :
procedure GlobalMemoryStatus external "kernel32.dll":
define input-output parameter lpmemorystatus as memptr.
end.


DEFINE VARIABLE lpmemorystatus AS MEMPTR.
DEFINE VARIABLE TotPhysMem AS INTEGER NO-UNDO.
DEFINE VARIABLE FreePhysMem AS INTEGER NO-UNDO.
DEFINE VARIABLE plabel AS CHARACTER NO-UNDO.

/* set up pointers */
SET-SIZE(lpmemorystatus) = 32.
PUT-LONG(lpmemorystatus,1) = 32.
/* Call Windows API */
RUN GlobalMemoryStatus (INPUT-OUTPUT lpmemorystatus).
/* Extract data from pointers */
ASSIGN

TotPhysMem = GET-LONG(lpmemorystatus,9) / 1024 .
FreePhysMem = GET-LONG(lpmemorystatus,13) / 1024.



ASSIGN pLabel = trim(STRING(TotPhysMem, ">>>,>>>")) NO-ERROR.

/* free pointers */
SET-SIZE(lpmemorystatus) = 0.


You may see an example and do such things
 
Top