Beispiel #1
0
 private IEnumerator CaptureWindowProc()
 {
     while (this.hMainWindow == IntPtr.Zero)
     {
         this.hMainWindow = SoundLibWndProc.FindWindow((string)null, Application.productName);
         if (this.hMainWindow != IntPtr.Zero)
         {
             this.newWndProc    = new WndProcDelegate(this.WndProc);
             this.newWndProcPtr = Marshal.GetFunctionPointerForDelegate(this.newWndProc);
             if (this.Is64Bit())
             {
                 this.oldWndProcPtr = SoundLibWndProc.SetWindowLongPtr(this.hMainWindow, -4, this.newWndProcPtr);
             }
             else
             {
                 this.oldWndProcPtr = SoundLibWndProc.SetWindowLong(this.hMainWindow, -4, this.newWndProcPtr);
             }
         }
         else
         {
             yield return(new WaitForEndOfFrame());
         }
     }
     yield break;
 }
Beispiel #2
0
 private void OnDisable()
 {
     if (this.Is64Bit())
     {
         SoundLibWndProc.SetWindowLongPtr(this.hMainWindow, -4, this.oldWndProcPtr);
     }
     else
     {
         SoundLibWndProc.SetWindowLong(this.hMainWindow, -4, this.oldWndProcPtr);
     }
     this.hMainWindow   = IntPtr.Zero;
     this.oldWndProcPtr = IntPtr.Zero;
     this.newWndProcPtr = IntPtr.Zero;
     this.newWndProc    = (WndProcDelegate)null;
 }