Ejemplo n.º 1
0
 public void SendShutdown(IntPtr msg)
 {
     if (HDPlusModule.SensorSendMsg(msg))
     {
         return;
     }
     CommonError.ThrowLastWin32Error("Cannot send message to guest");
 }
Ejemplo n.º 2
0
 public Monitor Attach(uint id, Monitor.ExitHandler exitHandler)
 {
     if (!HDPlusModule.ManagerAttach(this.handle, id))
     {
         CommonError.ThrowLastWin32Error("Cannot attach to monitor " + id.ToString());
     }
     return(new Monitor(this.handle, id, exitHandler));
 }
Ejemplo n.º 3
0
 public void SendLocation(GPSManager.GpsLocation location)
 {
     if (HDPlusModule.MonitorSendLocation(location))
     {
         return;
     }
     CommonError.ThrowLastWin32Error("Cannot send GPS location update");
 }
Ejemplo n.º 4
0
            public void Update(int x, int y)
            {
                IntPtr dc           = BstCursor.Pointer.GetDC(IntPtr.Zero);
                IntPtr compatibleDc = BstCursor.Pointer.CreateCompatibleDC(dc);
                IntPtr hObject1     = IntPtr.Zero;
                IntPtr hObject2     = IntPtr.Zero;

                try
                {
                    hObject1 = this.mBitmap.GetHbitmap(Color.FromArgb(0));
                    hObject2 = BstCursor.Pointer.SelectObject(compatibleDc, hObject1);
                    BstCursor.Pointer.Win32Size     psize  = new BstCursor.Pointer.Win32Size(this.mBitmap.Width, this.mBitmap.Height);
                    BstCursor.Pointer.Win32Point    pprSrc = new BstCursor.Pointer.Win32Point(0, 0);
                    BstCursor.Pointer.Win32Point    pptDst = new BstCursor.Pointer.Win32Point(x, y);
                    BstCursor.Pointer.BLENDFUNCTION pblend = new BstCursor.Pointer.BLENDFUNCTION()
                    {
                        BlendOp             = 0,
                        BlendFlags          = 0,
                        SourceConstantAlpha = byte.MaxValue,
                        AlphaFormat         = 1
                    };
                    if (BstCursor.Pointer.UpdateLayeredWindow(this.Handle, dc, ref pptDst, ref psize, compatibleDc, ref pprSrc, 0, ref pblend, 2))
                    {
                        return;
                    }
                    CommonError.ThrowLastWin32Error("Cannot update layered window");
                }
                finally
                {
                    BstCursor.Pointer.ReleaseDC(IntPtr.Zero, dc);
                    if (hObject1 != IntPtr.Zero)
                    {
                        BstCursor.Pointer.SelectObject(compatibleDc, hObject2);
                        BstCursor.Pointer.DeleteObject(hObject1);
                    }
                    BstCursor.Pointer.DeleteDC(compatibleDc);
                }
            }
Ejemplo n.º 5
0
        public Video VideoAttach(bool verbose)
        {
            IntPtr zero = IntPtr.Zero;
            IntPtr addr = HDPlusModule.MonitorVideoAttach(this.mId, verbose);

            if (addr == IntPtr.Zero)
            {
                CommonError.ThrowLastWin32Error(string.Format("FATAL ERROR: Cannot attach to monitor video: {0}", (object)Marshal.GetLastWin32Error()));
            }
            Video video = new Video(addr);

            try
            {
                video.CheckMagic();
            }
            catch (Exception ex)
            {
                HDPlusModule.MonitorVideoDetach(addr);
                throw;
            }
            Logger.Info("Video Attached");
            return(video);
        }
Ejemplo n.º 6
0
 public void StartReceiver(VmMonitor.ReceiverCallback callback)
 {
     this.mReceiverCallback = callback;
     this.mReceiverWakeup   = (EventWaitHandle) new ManualResetEvent(false);
     this.mReceiverThread   = new Thread((ThreadStart)(() =>
     {
         try
         {
             if (HDPlusModule.SensorRecvMsg(this.mReceiverCallback))
             {
                 return;
             }
             CommonError.ThrowLastWin32Error("Cannot receive monitor message");
         }
         catch (Exception ex)
         {
             Logger.Error("Exception, receiver thread died. Err : " + ex.ToString());
         }
     }))
     {
         IsBackground = true
     };
     this.mReceiverThread.Start();
 }