Home Series60 Smartphone Pocket PC PC Omnis
         
 

EXTFunc - TechNote EF0002 (WebClient:Read file from users' machine)

Variable Name Type Description
typedata Character Required functions (as extracted from EXTFUNC.TXT or WIN32API.TXT)
OFREAD Long Integer Read file constant value
STATUS Long Integer API return status
INIDATA Character Contents of file
PATH Character File Path
FILEBUF Long Integer Memory pointer for file contents
FILEHANDLE Long Integer File Handle / reference
Initialize data block specifying ExtFunc functions (needed as Win32 API file doesn't exist in WebClient) 
Begin text block
Text: Const OF_READ = &H0 (Carriage return,Linefeed)
Text: Declare Function lopen Lib "kernel32" Alias "_lopen" (ByVal lpPathName As String, ByVal iReadWrite As Long) As Long (Carriage return,Linefeed)
Text: Declare Function lclose Lib "kernel32" Alias "_lclose" (ByVal hFile As Long) As Long (Carriage return,Linefeed)
Text: Declare Function lread Lib "kernel32" Alias "_lread" (ByVal hFile As Long, lpBuffer As Any, ByVal wBytes As Long) As Long (Carriage return,Linefeed)
Text: Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long (Carriage return,Linefeed)
End text block
Get text block typedata
Read File (in this case WIN.INI) [Marked as "Execute on Web Client"]
Do $cinst.$objs.EFUNC.$loadtypedata(typedata)
Do $cinst.$objs.EFUNC.$gettypevalue("CONST","OF_READ") Returns OFREAD
Do $cinst.$objs.EFUNC.$callfunc("GetWindowsDirectory",PATH,255) Returns STATUS
Calculate PATH as con(PATH,"\WIN.INI")
Do $cinst.$objs.EFUNC.$alloctype("String*65535") Returns FILEBUF
Do $cinst.$objs.EFUNC.$callfunc("lopen",PATH,OFREAD) Returns FILEHANDLE
Do $cinst.$objs.EFUNC.$callfunc("lread",FILEHANDLE,FILEBUF,65535)
Do $cinst.$objs.EFUNC.$callfunc("lclose",FILEHANDLE) Returns FILEHANDLE
Do $cinst.$objs.EFUNC.$gettypevalue(FILEBUF) Returns INIDATA
Do $cinst.$objs.EFUNC.$freetype(FILEBUF)
OK message  {Ini file contents [INIDATA]}

 

Need help with your particular problem?  Then simply email support