title: C# SCardGetStatusChange() check smartcard status
body: <p>I want to detect the status of the smart card to see if there is a card inserted or pulled out<br>
  for this I used smart card read code <a href="http://boywhy.blogspot.tw/2015/01/c-c.html" rel="nofollow noreferrer">here</a></p>
  
  <p>I have found that the <code>SCardGetStatusChange</code> function can be detected,But do not know how to use.
  this is my add code </p>
  
  <pre><code>[DllImport("winscard.dll")]
      public static extern int SCardGetStatusChange(int hContext,uint dwTimeout,[In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex=3)]SCARD_READERSTATE[] rgReaderState,uint cReaders);
  
  public struct SCARD_READERSTATE
      {
          [MarshalAs(UnmanagedType.LPTStr)]
          public string szReader;
          public IntPtr pvUserData;
          public uint dwCurrentState;
          public uint dwEventState;
          public uint cbAtr;
          [MarshalAs(UnmanagedType.ByValArray, SizeConst = 36)]
          public byte[] rgbAtr;
      }
  SCARD_READERSTATE[] rs = new SCARD_READERSTATE[1];
  rs[0].szReader = ReaderList;
  rs[0].dwCurrentState = SCARD_STATE_UNAWARE;
  int result = SCardGetStatusChange(ContextHandle, 1000, rs, 2);
  </code></pre>
  
  <p>but the result always the same,I don't know what are the wrong parameters.</p>