Class WinAPI.OVERLAPPED

  • Enclosing class:
    WinAPI

    public static class WinAPI.OVERLAPPED
    extends com.sun.jna.Structure
    Represent the Windows API struct OVERLAPPED. The constructor of this class does 'this.setAutoSynch(false)' because instances of this class should not be auto synchronized nor written as a whole, because Windows stores pointers to the actual memory representing this this struct and modifies it outside the function calls and copying (writing) the Java class fields to the actual memory will destroy those structures.

    To set the fields it recommend to use the 'writeField(String,Object)'. It is ok to read those fields of OVERLAPPED using Java dot-notatio. that have been written by Java code, but those field that Windows modifies should be accessed using 'readField(String)' or by invoking 'read()' on the object before accessing the fields with the java dot-notation.

    For example this is acceptable usage for doing overlapped I/O (except this code does no error checking!):

     
      OVERLAPPED ovl = new OVERLAPPED();
      ovl.writeField("hEvent", CreateEvent(null, true, false, null));
      ResetEvent(osReader.hEvent);
      ReadFile(hComm, buffer, reqN, recN, ovl);
     
     
    Author:
    nyholku
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.sun.jna.Structure

        com.sun.jna.Structure.ByReference, com.sun.jna.Structure.ByValue, com.sun.jna.Structure.FieldOrder, com.sun.jna.Structure.StructField
    • Constructor Summary

      Constructors 
      Constructor Description
      OVERLAPPED()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected List getFieldOrder()  
      String toString()  
      • Methods inherited from class com.sun.jna.Structure

        allocateMemory, allocateMemory, autoAllocate, autoRead, autoRead, autoWrite, autoWrite, cacheTypeInfo, calculateSize, clear, createFieldsOrder, createFieldsOrder, createFieldsOrder, createFieldsOrder, dataEquals, dataEquals, ensureAllocated, equals, fieldOffset, getAutoRead, getAutoWrite, getFieldList, getFields, getNativeAlignment, getNativeSize, getNativeSize, getPointer, getStringEncoding, getStructAlignment, hashCode, newInstance, newInstance, read, readField, readField, setAlignType, setAutoRead, setAutoSynch, setAutoWrite, setStringEncoding, size, sortFields, toArray, toArray, toString, useMemory, useMemory, write, writeField, writeField, writeField
    • Constructor Detail

      • OVERLAPPED

        public OVERLAPPED()
    • Method Detail

      • getFieldOrder

        protected List getFieldOrder()
        Overrides:
        getFieldOrder in class com.sun.jna.Structure
      • toString

        public String toString()
        Overrides:
        toString in class com.sun.jna.Structure