Advertisement
Guest User

Untitled

a guest
Mar 5th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. public void EndTransparentWindow()
  2. {
  3. #if !UNITY_EDITOR // You really don't want to enable this in the editor..
  4. int fWidth = Screen.width;
  5. int fHeight = Screen.height;
  6. var margins = new MARGINS() { cxLeftWidth = -1 };
  7. var hwnd = GetActiveWindow();
  8.  
  9. SetWindowLong(hwnd, GWL_STYLE, WS_POPUP | WS_VISIBLE);
  10.  
  11. // Transparent windows with click through
  12. SetWindowLong(hwnd, -20, 524288);//GWL_EXSTYLE=-20; WS_EX_LAYERED=524288=&h80000, WS_EX_TRANSPARENT=32=0x00000020L
  13. SetLayeredWindowAttributes(hwnd, 255, 255, 0);// Transparency=51=20%, LWA_ALPHA=2
  14. SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, fWidth, fHeight, 32); //SWP_FRAMECHANGED = 0x0020 (32); //SWP_SHOWWINDOW = 0x0040 (64)
  15. // DwmExtendFrameIntoClientArea(hwnd, ref margins);
  16.  
  17. Screen.SetResolution(1920, 1080, true);
  18.  
  19. #endif
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement