2010-08-30 116 views
2

爲什麼在使用以下代碼每隔20毫秒採取一次屏幕截圖並通過加密連接將其傳輸至對等端時會收到黑屏? (我知道20毫秒的刷新速度有點快,但看起來並不是問題,處理器和網絡可以很好地保持刷新率,問題在於位圖完全顯示爲黑色。編輯:我現在知道這是一些還挺奇怪的網絡問題,但現在的圖像顯示了模糊,好像它是一個糟糕的模擬信號。我已節目的截圖這個職位http://imgur.com/y9rWb.png截圖僅包含黑色像素

P2PStream thestream = (P2PStream)sender; 
     Bitmap mymap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); 
     Graphics screenshotGFX = Graphics.FromImage(mymap); 
     screenshotGFX.CopyFromScreen(new Point(),new Point(),new Size(Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height)); 
     Stream encryptedStream = networkLogic.getCryptoStream(thestream, true); 
     while (true) 
     { 
      try 
      { 
       screenshotGFX.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy); 
       mymap.Save(encryptedStream,System.Drawing.Imaging.ImageFormat.Png); 

      } 
      catch (Exception) 
      { 
       MessageBox.Show("A client has disconnected"); 
       break; 
      } 
      System.Threading.Thread.Sleep(20); 
     } 
+0

你想要打印屏幕?一般屏幕或一些電影? – 2010-08-30 21:12:44

+0

我想打印一般scr EEN。我沒有查看任何視頻遊戲,DRM'd音樂或視頻文件等。只是桌面和常規應用程序窗口。 – IDWMaster 2010-08-30 21:16:57

+0

這可能不適用於你;然而在這種情況下,我有機會在通過Citrix遠程桌面連接到我的電腦後,剪貼板看起來損壞,圖像顯示全黑,只有重啓才能解決問題。 – kbrimington 2010-08-30 21:20:41

回答

1

這恰好是與路由器(錯誤的XSF支持)的網絡錯誤,並且現在已被修復。