Using Win32 functions in Visual FoxPro Image Gallery
File Management
..msdn
CopyFile
CopyFileTransacted
CreateDirectory
CreateFile
CreateFileTransacted
CreateHardLink
CreateSymbolicLink
DeleteFile
DeleteFileTransacted
FindClose
FindCloseChangeNotification
FindFirstChangeNotification
FindFirstFile
FindNextChangeNotification
FindNextFile
FlushFileBuffers
GetBinaryType
GetCurrentDirectory
GetDriveType
GetFileAttributes
GetFileAttributesEx
GetFileInformationByHandle
GetFileType
GetFullPathName
GetLongPathName
GetShortPathName
GetTempFileName
GetTempPath
LockFile
MoveFile
MoveFileTransacted
OpenFile
QueryDosDevice
ReadDirectoryChangesW
ReadFile
RemoveDirectory
RemoveDirectoryTransacted
ReplaceFile
SearchPath
SetCurrentDirectory
SetEndOfFile
SetFileAttributes
SetFilePointer
SetFilePointerEx
SetSearchPathMode
UnlockFile
WriteFile
_lclose
_lopen
Code examples:
SetFilePointerEx
..msdn    Add comment     W32 Constants      Translate this page
Moves the file pointer of the specified file.
Code examples:
Declaration:
BOOL WINAPI SetFilePointerEx(
  HANDLE hFile,
  LARGE_INTEGER liDistanceToMove,
  PLARGE_INTEGER lpNewFilePointer,
  DWORD dwMoveMethod
);
FoxPro declaration:
DECLARE INTEGER SetFilePointerEx IN kernel32;
    INTEGER hFile,;
    LONG liDistanceToMoveLo,;
    LONG liDistanceToMoveHi,;
    STRING @lpNewFilePointer,;
    LONG dwMoveMethod

Parameters:
hFile
[in] A handle to the file. The file handle must have been created with the GENERIC_READ or GENERIC_WRITE access right.

liDistanceToMove
[in] The number of bytes to move the file pointer.

lpNewFilePointer
[out, optional] A pointer to a variable to receive the new file pointer.

dwMoveMethod
[in] The starting point for the file pointer move.
Return value:
If the function succeeds, the return value is nonzero.
Usage:
* creates new empty file
hFile = CreateFile("c:\testfile.txt",;
    GENERIC_WRITE, FILE_SHARE_WRITE, 0,;
    CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0) 

* creates 64K of "pending" space in the file
* warning: setting the 3rd parameter, which is 0, to 1
* means making the pending size 4Gb larger
= SetFilePointerEx(hFile, 0xffff, 0, NULL, FILE_BEGIN)

* effectively increases the size of the file and writes
* 5 more bytes at the end of the file
cBuffer="123" + CHR(13) + CHR(10)
= WriteFile(hFile, cBuffer, LEN(cBuffer), 0,0)

= CloseHandle(hFile)
My comment:
Note that the number of parameters is different in C and VFP declarations for this function.

My first intention was to declare the second parameter, liDistanceToMove, as STRING @, which is the pointer to string. This approach worked in similar situations before but failed in this particular case.

Calvin Hsia in his blog`s entry explains why this function must be declared in VFP with rather five input parameters versus four regular ones.

The long integer (8 bytes) input parameter liDistanceToMove is passed to this function as two separate input parameters of LONG type (4 bytes each).
Word Index links for the SetFilePointerEx :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2007-08-20 16:37:26
Modified: 2007-08-20 17:51:44
Visited in last 7 days: 14
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2014 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.68), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (174.129.62.126)
6 sec.Example: 'Using the DeleteFile'
22 sec.Example: 'How to delete a service object'
1.43 min.
Function group: 'Raw Input'
4 day(s)Function: 'Shell_NotifyIcon'
Function group: 'Shell Functions'
 Example: 'Enumerating the subkeys of a user-specific key'
 Function: 'InternetCloseHandle'
Function group: 'Internet Functions (WinInet)'
 Function: 'GetIconInfo'
Google
Advertise here!