View Single Post
  #7 (permalink)  
Old 11-21-2005, 10:27 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Question That's right, but?

Quote:
Originally Posted by Beluck
well done , but file functions (as well as many other) may be used directly from windows API dlls.

example of file copy function import:

#import "Kernel32.dll"
bool CopyFileA (string source_file, string destination_file, bool if_exist);

with DLLs you can do a lot of things, like SQL database access and so on.
Beluck,
That's right , but could you give me .mql demo shows me how to use the kernel32 functions CreateFile, OpenFile,WriteFile and ReadFile in MQL4

Code:
HANDLE CreateFile(
  LPCTSTR lpFileName,
  DWORD dwDesiredAccess,
  DWORD dwShareMode,
  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  DWORD dwCreationDisposition,
  DWORD dwFlagsAndAttributes,
  HANDLE hTemplateFile
);

HFILE OpenFile(
  LPCSTR lpFileName,
  LPOFSTRUCT lpReOpenBuff,
  UINT uStyle
);

BOOL WriteFile(
  HANDLE hFile,
  LPCVOID lpBuffer,
  DWORD nNumberOfBytesToWrite,
  LPDWORD lpNumberOfBytesWritten,
  LPOVERLAPPED lpOverlapped
);

BOOL ReadFile(
  HANDLE hFile,
  LPVOID lpBuffer,
  DWORD nNumberOfBytesToRead,
  LPDWORD lpNumberOfBytesRead,
  LPOVERLAPPED lpOverlapped
);
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Reply With Quote