Author Topic: Borderless Graphics Window problem  (Read 4197 times)

0 Members and 1 Guest are viewing this topic.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Borderless Graphics Window problem
« on: March 08, 2021, 11:48:22 pm »
I was trying to use, with no success,

http://www.qb64.org/wiki/Windows_Libraries#Borderless_Window

to make a borderless/titleless  very small graphics window.

_FULLSCREEN makes the window both borderless and titleless  - I just want to have a very much smaller equivalent.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Borderless Graphics Window problem
« Reply #1 on: March 08, 2021, 11:50:20 pm »
I ran that code with no issues at all. What's happening on your end?
Shuwatch!

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: Borderless Graphics Window problem
« Reply #2 on: March 09, 2021, 12:28:07 am »
@SpriggsySpriggs

Now I am confused - it appears to be working now (Maybe I should shut down my computer as it as been running more than a day and Windows 10 does create issues for long runs for me).

The problem occurred with the addition of lines

SCREEN _NEWIMAGE(1599, 63, 32)
_SCREENMOVE  0,0
COLOR &HFFFFFFFF&&
PSET (20,60)

nothing was working (however the default wiki program, text screen, worked OK).

Once I changed screen size down to a much smaller value (150 x 63) - from then onwards everything worked OK.

My display is a HIGH DPI display and there seems to be problems with QB64 v1.5 and Windows 10 that very slowly I have (with help) been developing "workarounds" for my system - all so far related to the "first time" such and such was being done.

So NOW I can "control" no border/title.

Question - how to overcome the "lost graphics real estate" because of the "title bar". With _FULLSCREEN PSET (0, 0) is at the extreme top left hand corner (not so with my small graphics window).


EDIT

 A "cheap and nasty" workaround, for me, is to have _SCREENMOVE -3, -26 and so the TITLE BAR is not visible - this assumes that I only want the small graphics window at the extreme top!
« Last Edit: March 09, 2021, 12:59:50 am by Richard »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Borderless Graphics Window problem
« Reply #3 on: March 09, 2021, 01:32:36 am »
Borderless windows. Been there, done that...

https://www.qb64.org/forum/index.php?topic=1373.msg105615#msg105615

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Borderless Graphics Window problem
« Reply #4 on: March 09, 2021, 03:32:15 am »
Sounds like you might want to look at this: https://www.qb64.org/forum/index.php?topic=3659.0

https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: Borderless Graphics Window problem
« Reply #5 on: March 09, 2021, 05:10:32 am »
@Pete

Thanks for link

I played around a bit with the program - for a translucent window of 1600 x 128 and apart from tweaking up _SCREENMOVE x, y to position exactly (care of @SMcNeill) where I want it...

It appears that the translucent window is ONLY a text screen but with graphics screen resolution position accuracy.

Is it possible to place simple graphics (eg a line) or even an image in the translucent window as well?

Also, is it possible using a mouse say to click through the translucent window to do some other action?

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Borderless Graphics Window problem
« Reply #6 on: March 10, 2021, 04:14:59 am »
Hmmm, interesting. YOu want to click through a window... I'm not sure if there is an easier method to clicking "through" a translucent window than what I'm about to describe, but here we go...

For starters, translucency has nothing to do with focus. To be able to register a mouse click on a desktop icon or another program, running behind your translucent window would require something like the following...

1) The active QB64 translucent window records the click.
2) The position of the click is calculated to the position of the desktop.
3) QB64 tells the current window to momentarily lose focus or hide.
4) While not in focus or hidden, the QB64 program performs a _SCREENCLICK at the previously calculated coordinates.
5) The QB64 translucent windows program now returns to focus.

It's a bit hokey, and with some necessary delays to get the actions to properly perform, it might not be ready for prime time.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Borderless Graphics Window problem
« Reply #7 on: March 10, 2021, 02:08:32 pm »
@Pete You can do click through with WinAPI but it can be a pain in the rear
Shuwatch!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Borderless Graphics Window problem
« Reply #8 on: March 10, 2021, 03:38:12 pm »
@Indy

Any more difficult than the Mickey "mouse" method I described?

I ask, not because I'll ever need or use it, but I've always made work-arounds for just about any conceived problem in QB programming, yet I'm always interested in more elegant solutions. Now Steve would tell you Pete always likes to do things the hard way, but that simply isn't the case. If it were, I'd have written this post in Portuguese.

Oh, just to save you work, I'm not asking you to code an example, just a brief description, much like I did, or even a simple yes or no to the more or less difficulty question.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Borderless Graphics Window problem
« Reply #9 on: March 10, 2021, 05:13:08 pm »
@Pete Who is Indy? Anyways, here is what I tried to do. It looks like Windows doesn't like applications to be clicked through unless you use .Net or some other more modern language. This is the best I could do for now.

Code: QB64: [Select]
  1.  
  2. Const SW_MAXIMIZE = 3
  3.  
  4.     Function SetLayeredWindowAttributes%% (ByVal hwnd As _Offset, Byval crKey As Long, Byval bAlpha As _Unsigned _Byte, Byval dwFlags As Long)
  5.     Function GetWindowLong& Alias "GetWindowLongA" (ByVal hwnd As _Offset, Byval nIndex As Long)
  6.     Function SetWindowLong& Alias "SetWindowLongA" (ByVal hwnd As _Offset, Byval nIndex As Long, Byval dwNewLong As Long)
  7.     Function ShowWindow%% (ByVal hWnd As _Offset, Byval nCmdShow As Long)
  8.  
  9. '_FullScreen 'toggle this to see how it works in FullScreen as well
  10.  
  11. ClickThrough
  12. Print "This window will be able to be clicked through. I don't recommend this, though"
  13.         a = ShowWindow(_WindowHandle, SW_MAXIMIZE)
  14.     End If
  15.     _Limit 60
  16.  
  17. Sub ClickThrough
  18.     Const G = -20
  19.     Const LWA_ALPHA = &H2
  20.     Const WS_EX_LAYERED = &H80000
  21.     Const WS_EX_TRANSPARENT = &H00000020
  22.     Dim As Long a
  23.     a = SetWindowLong(_WindowHandle, G, WS_EX_TRANSPARENT Or WS_EX_LAYERED)
  24.     a = SetLayeredWindowAttributes(_WindowHandle, 0, 100, LWA_ALPHA) '100 is so the window is semi-transparent
Shuwatch!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Borderless Graphics Window problem
« Reply #10 on: March 10, 2021, 08:50:11 pm »
Well, since you hail from Indiana, @Indy seemed pretty good, but if you move to Texas, you could tell everyone... I'm Texy and I know it. Food for thought. Kinda like Twinkies.

Well, you're straight API method sure looks easier to employ than the API / QB64 mix method I outlned. I hope the OP can use one of them, but I 'm a bit curious to what end.

I should probably mentioned using _SCREENCLICK with API calls, as I outlined, requires some work to get the proper delays. Too long would make the effect lame, but too quick and the click would be missed. Also, you need to make sure with _SCREENCLICK you don't mess up and have it activate something you didn't intend to activate.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: Borderless Graphics Window problem
« Reply #11 on: March 10, 2021, 11:33:22 pm »
@Pete

Just for your info - reason why "click through translucent window..."

With Windows 10 I OFTEN have issues with the Task Bar - it often does not automatically "hide" (despite flagging it to do so) and causes me a lot of frustration when a third party or even a Windows app (eg Notepad) wants to launch in "MAXIMISED (full screen)" mode AND I need to access the extreme bottom part which is now hidden by the Task Bar. Although I can [Window key] + [left arrow] reduce width of app I typically have great difficulty shrinking it further because the pivot point (bottom right hand corner) is still hidden by the Task Bar.

Yes I can move taskbar to top, left or right - but soon enough I come across an app that needs action that is hidden by the newer task bar position. 

I have tried a free app that "hides taskbar" (by using [Ctrl]+[Esc]) but for some reason that app only works about half the time (great help, easy to use, when it DOES work).

So I am considering totally permanently "hiding the taskbar" and have my "Pete's version translucent taskbar custom to my requirements" where I can selectively click either layer to launch etc app. And while I am at it - integrate other info in very simplistic manner such as network traffic (very tiny Graph only), disk free space, launched app icons, "Emergency STOP per app", etc - thereby reducing the "clutter" on the desktop using available apps which are limited to how small they can be sized down (ie only info I need to know now contained within the translucent Task Bar). Consider it being a custom "CONTROL PANEL" but as a translucent Task Bar.

I have not yet successfully integrated graphics onto the (being part of) translucent window - so far text only with graphics resolution positioning.

As ultimately I will need to use mouse AND/OR touch pad to "click thru translucent window" - any suggestions to the best "state of the art" mouse input routine (there were many topics on this eg by @SMcNeill et al) - as I have never wrote any code using mouse before?

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Borderless Graphics Window problem
« Reply #12 on: March 11, 2021, 12:26:40 am »
@Richard If you’ve never noticed, the taskbar generally only refuses to hide when you have an “urgent” notification pop up.

https://www.howtogeek.com/howto/31779/fixing-when-the-windows-taskbar-refuses-to-auto-hide-correctly/

If that doesn’t work for you, use WIN-CTRL-D and create a second, virtual desktop without the taskbar.  https://www.howtogeek.com/688608/keyboard-shortcuts-for-using-virtual-desktops-on-windows-10/  The taskbar can be toggled to be only on the main screen, so it’s often a very simple process to just WIN-ARROW to jump between desktops and work in one without it.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: Borderless Graphics Window problem
« Reply #13 on: March 11, 2021, 02:02:57 am »
@SMcNeill

Thanks for info - by paying attention to Task Bar Notifications (as opposed to "New Notifications") - was able to reduce frustrations by 50% - NOW only 25% of the time Windows Task Bar does not behave properly.

I tried the "virtual desktop" approach - but Windows 10 2H20 does not give me the option (that I know of) to "hide taskbar' (outright) - only automatically. So I resorted to the free "hide task bar" app - which is "global" (all desktops). I ended up permanently hiding the taskbar (all desktops) and had to restart (as I was not ready with say desktop icons to completely replace ALL Task Bar ICONS).

Now if I can reliably replicate the "permanent hidden taskbar" from above and just use desktop ICONS etc instead, then that would be quite acceptable (and not use free "hide task bar" app frequently in a session).

For overall simplicity - I will continue with my "Translucent Task Bar" project, as it would be more versatile.