Page 2 of 2

Posted: Tue May 31, 2005 6:52 pm
by GreenGiant
Surely if you want it show exactly what's under if you'd just region out the main part of the window. Or if you wanted to draw some stuff in the window, but with a transparent background, and possibly change the stuff in realtime you could use *this*.

Posted: Tue May 31, 2005 7:38 pm
by akee
Trond wrote:@akie: 50% transparent window can easily be achieved by an entirely different technique:
COOL! THANKS! :D

Posted: Wed Jun 01, 2005 12:56 am
by NoahPhense
Sparkie wrote:Nice one Trond :)
NoahPhense wrote:btw - i tried the trick.. nice.. now make it not jumpy...
This seems to work pretty good...

Code: Select all

; --> Original "Desktop Window" inspired Trond
Procedure myCallback(hwnd, msg, wparam, lparam) 
  Result = #PB_ProcessPureBasicEvents 
  Select msg
    Case #WM_PAINT
      hdc = BeginPaint_(hwnd, @ps.PAINTSTRUCT) 
      PaintDesktop_(hdc)
      EndPaint_(hwnd,@ps) 
      Result = 0
    Case #WM_MOVING
      InvalidateRect_(WindowID(), 0, 0)
    Case #WM_SIZE
      InvalidateRect_(WindowID(), 0, 0)
  EndSelect 
  ProcedureReturn Result 
EndProcedure 
If OpenWindow(0, 0, 0, 300, 300,  #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget, "Desktop Window")
  SetClassLong_(WindowID(), #GCL_HBRBACKGROUND, 0)
  SetWindowCallback(@myCallback()) 
  Repeat 
    event = WaitWindowEvent() 
  Until event = #PB_EventCloseWindow 
EndIf
End

* Edited to remove un-needed line *
Wow Sparkie.. very nice.. that sh!t is tight.. ;)

- np

Posted: Wed Jun 01, 2005 3:32 am
by Sparkie
NoahPhense wrote:Wow Sparkie.. very nice.. that sh!t is tight..
Thanks np. :)
... but are you saying I'm a tight a$$ :P :wink:
PB wrote:Sparkie, how about adapting it to show whatever's under the window, instead
of just the Desktop?
There may be a better way, but here's your See-Through window. Only tested on WinXP. ;)

Code: Select all

borderW = GetSystemMetrics_(#SM_CXSIZEFRAME)
borderH = GetSystemMetrics_(#SM_CYSIZEFRAME)
captionH = GetSystemMetrics_(#SM_CYCAPTION)
If OpenWindow(0, 0, 0, 300, 300,  #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget, "See-Through Window")
  outterRgn  = CreateRectRgn_(0, 0, WindowWidth() + (borderW * 2), WindowHeight() + captionH + (borderH * 2))
  innerRgn = CreateRectRgn_(borderW, captionH + borderH, WindowWidth() + borderW, WindowHeight() + captionH + borderH)
  winRgn = outterRgn
  CombineRgn_(winRgn, outterRgn, innerRgn, #RGN_XOR)
  SetWindowRgn_(WindowID(), winRgn, 1)
  DeleteObject_(outterRgn)
  DeleteObject_(innerRgn)
  Repeat 
    event = WaitWindowEvent() 
    Select event
      Case #PB_Event_SizeWindow
        outterRgn  = CreateRectRgn_(0, 0, WindowWidth() + (borderW * 2), WindowHeight() + captionH + (borderH * 2))
        innerRgn = CreateRectRgn_(borderW, captionH + borderH, WindowWidth() + borderW, WindowHeight() + captionH + borderH)
        winRgn = outterRgn
        CombineRgn_(winRgn, outterRgn, innerRgn, #RGN_XOR)
        SetWindowRgn_(WindowID(), winRgn, 1)
        DeleteObject_(outterRgn)
        DeleteObject_(innerRgn)
    EndSelect
  Until event = #PB_EventCloseWindow 
EndIf 
End

Posted: Wed Jun 01, 2005 3:50 am
by NoahPhense
Sparkie wrote:
NoahPhense wrote:Wow Sparkie.. very nice.. that sh!t is tight..
Thanks np. :)
... but are you saying I'm a tight a$$ :P :wink:
No. It is one of the highest praises I know of using slang. :D

Posted: Wed Jun 01, 2005 4:00 am
by Sparkie
I got that np, I was being sarcastic. ;)

Back in the 60's, when I was a wee little boy, the highest praise was... boss-or-what. :roll:

Posted: Wed Jun 01, 2005 4:04 am
by NoahPhense
Sparkie wrote:I got that np, I was being sarcastic. ;)

Back in the 60's, when I was a wee little boy, the highest praise was... boss-or-what. :roll:
When I was younger, one of them was: choice.. :)

..another was Rad.

- np

Posted: Wed Jun 01, 2005 12:18 pm
by PB
> here's your See-Through window

:shock: Words fail me... that's just effing awesome! CONGRATULATIONS! :D

Posted: Wed Jun 01, 2005 4:39 pm
by fsw
On XP the TITLEBAR changes to the DOS-WINDOW-STYLE...

Other than that 8)

Posted: Wed Jun 01, 2005 4:52 pm
by traumatic
Cool as always, Sparkie!

OT: fsw, glad you decided _not_ to shut up :)

Posted: Wed Jun 01, 2005 5:07 pm
by fsw
traumatic wrote: OT: fsw, glad you decided _not_ to shut up :)
[german]
manchmal schaue ich hier rein (in den deutschen forum auch :wink: ), hab aber schon lange nichts mit pb gemacht... ausser Sparkies code testen 8)
[/german]

Sometimes I come by and test Sparkie's code 8)
...but besides that I didn't do anything with pb lately :wink:

Posted: Wed Jun 01, 2005 6:30 pm
by Sparkie
@fsw & traumatic: Thank you :)

@fsw: I was hoping nobody would notice the loss of XP style. No sure how useful the code is, but I'll work on correcting that as my next challenge. ;)