Paradox Community

Items in pnews.paradox-development

Subject:Re: Microsoft Print to PDF
Date:Thu, 14 Nov 2019 10:57:09 -0600
From:Mark Bannister <markRemove@THISinjection-moldings.com>
Newsgroups:pnews.paradox-development
Ah, that was one of Jan's additions.  Maybe he won't mind if I post it.

Const
         ;from Janm for FileInUse
ctGENERIC_READ = LongInt(-2147483648)
ctGENERIC_WRITE = LongInt(1073741824)
ctOPEN_EXISTING = LongInt(3)
ctFILE_ATTRIBUTE_NORMAL = LongInt(128)
ctFILE_IN_USE = LongInt(-1)
ctFILE_FREE = LongInt(0)
ctFILE_DOESNT_EXIST = LongInt(-999) ;arbitrary number, other than 0 or -1
endConst

{
  Code from Jan M 1-11-2007

  {
----------------Example
method pushButton(var eventInfo Event)
var
liFileInUseRes Longint
endvar
  liFileInUseRes = 
cmFileInUse("D:\\mozillathunderbird\\thunderbird.exe");any other >=32bit 
file will do (exe, dll, doc, pdf, txt, etc.....)
  switch
   case liFileInUseRes = FILE_FREE: msgInfo("File In Use", "FREE")
   case liFileInUseRes = FILE_IN_USE:  msgInfo("File In Use", "IN USE")
   case liFileInUseRes = FILE_DOESNT_EXIST: msgInfo("File In Use", "FILE 
DOESNT EXIST")
  endswitch
endMethod


  }





method apiFileInUse(strFileAndPath string)longint
var
    liRes  LongInt
    liFileRes LongInt
    liClose LongInt
endvar

Try

liRes = ctFILE_FREE
strFileAndPath = cmfullname( strFileAndPath ) ;remove alias
if isFile(strFileAndPath) then
  liFileRes = CreateFileA(strFileAndPath,ctGENERIC_READ + 
ctGENERIC_WRITE,0, 0,ctOPEN_EXISTING,ctFILE_ATTRIBUTE_NORMAL, 0)
  liClose = CloseHandle(liFileRes)

  if liFileRes = ctFILE_IN_USE then
   liRes = ctFILE_IN_USE
  endif
  Return liRes
else
  liRes = ctFILE_DOESNT_EXIST
  Return liRes
endif
OnFail
  errorclear()
  liRes = 0
  Return liRes
endTry
endMethod


On 11/14/2019 8:45 AM, Kevin Baker wrote:
> I just checked my fsapi.lsl file and I don't see apiFileInUse  Is this 
> part of the fsapi.lsl?


Copyright © 2004 thedbcommunity.com