Correct signature in mt5 for kernel32 import - page 2

 
bisewski:

I give up...There are somthing more bigger than me...I tried unistall my MT5 Pepperstone and I received the error "This app cant run in your computer" 

The app is unistall.exe

So now I cant unistall too...

You need to read the WINAPI documentation, understand it and use the parameters correctly.

For example :

#import "kernel32.dll"
int WriteFile(HANDLE file,const ushort &buffer[],uint number_of_bytes_to_write,uint &number_of_bytes_written[],PVOID overlapped);
long CreateFileW(const string file_name,uint desired_access,uint share_mode,PVOID security_attributes,uint creation_disposition,uint flags_and_attributes,HANDLE template_file);
...
#import

...
  uint accessMode = GENERIC_READ | GENERIC_WRITE;
  long fWrite     = CreateFileW(path, accessMode, 0x0000000, 0, 2, FILE_ATTRIBUTE_NORMAL, NULL);

  if (fWrite == INVALID_HANDLE)
   {
    Print("Unable to open " + path + " for writing");
   }
  else
   {
    string DataBuffer = "This is some test data to write to the file.";
    ushort buffer[];
    uint dwBytesToWrite = (uint)StringLen(DataBuffer);
    StringToShortArray(DataBuffer,buffer,0,dwBytesToWrite);
    uint dwBytesWritten[1] = {0};
    bool write=WriteFile(
      fWrite,           // open file handle
      buffer,      // start of data to write
      dwBytesToWrite,  // number of bytes to write
      dwBytesWritten, // number of bytes that were written
      0);            // no overlapped structure

    CloseHandle(fWrite);
   }
Files:
test.csv  1 kb