Posts: 65
Threads: 22
Joined: Apr 2022
Reputation:
2
I hope you will excuse me, I'm trying to figure out as much of this on my own as I can, but I'll likely still have several questions on this topic.
Let's say that I have a screen with a resolution of 2560 x 1440.
I want to create a screen that occupies the entire screen, preferably without a title bar.
I know that I could these commands:
handle& = _NewImage(2560, 1440, 256)
Screen handle&
This will create a 2560 x 1440 screen, but is it possible to somehow remove the title bar and to force this screen to be opened with the upper left corner located at the upper left of the actual screen?
Posts: 2,171
Threads: 222
Joined: Apr 2022
Reputation:
103
Here's a start. Window without border example:
Code: (Select All) DECLARE DYNAMIC LIBRARY "User32"
FUNCTION GetWindowLongA& (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG)
FUNCTION SetWindowLongA& (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG, BYVAL dwNewLong AS LONG)
FUNCTION SetWindowPos& (BYVAL hwnd AS LONG, BYVAL hWndInsertAfter AS LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL cx AS LONG, BYVAL cy AS LONG, BYVAL wFlags AS LONG)
END DECLARE
SCREEN _NEWIMAGE(600, 480, 32)
_DELAY .2
GWL_STYLE = -16
ws_border = &H800000
WS_VISIBLE = &H10000000
''WS_VSCROLL = &H200000
_TITLE "No Border"
hwnd& = _WINDOWHANDLE
winstyle2& = GetWindowLongA&(hwnd&, GWL_STYLE)
winstyle& = -12582913
a& = SetWindowLongA&(hwnd&, GWL_STYLE, winstyle& AND WS_VISIBLE) ' AND NOT WS_VSCROLL) ' AND NOT ws_border)
a& = SetWindowPos&(hwnd&, 0, 0, 0, 0, 0, 39)
PRINT "Press any key to get back border...";: SLEEP
'''winstyle& = GetWindowLongA&(hwnd&, GWL_STYLE)
a& = SetWindowLongA&(hwnd&, GWL_STYLE, winstyle2& OR ws_border)
a& = SetWindowPos&(hwnd&, 0, 0, 0, 0, 0, 39)
Pete
Shoot first and shoot people who ask questions, later.
Posts: 276
Threads: 14
Joined: Apr 2022
Reputation:
27
Something like the following? Of course there is no task bar visible either.
handle& = _NEWIMAGE(_DESKTOPWIDTH, _DESKTOPHEIGHT, 256)
SCREEN handle&
_FULLSCREEN
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Posts: 2,171
Threads: 222
Joined: Apr 2022
Reputation:
103
Another example:
Code: (Select All) CONST HWND_TOPMOST%& = -1
CONST SWP_NOSIZE%& = &H1
CONST SWP_NOMOVE%& = &H2
CONST SWP_SHOWWINDOW%& = &H40
DECLARE DYNAMIC LIBRARY "User32"
FUNCTION GetWindowLongA& (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG)
FUNCTION SetWindowPos& (BYVAL hWnd AS LONG, BYVAL hWndInsertAfter AS _OFFSET, BYVAL X AS INTEGER, BYVAL Y AS INTEGER, BYVAL cx AS INTEGER, BYVAL cy AS INTEGER, BYVAL uFlags AS _OFFSET)
FUNCTION SetWindowLongA& (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG, BYVAL dwNewLong AS LONG)
FUNCTION GetForegroundWindow&
FUNCTION SetLayeredWindowAttributes& (BYVAL hwnd AS LONG, BYVAL crKey AS LONG, BYVAL bAlpha AS _UNSIGNED _BYTE, BYVAL dwFlags AS LONG)
END DECLARE
SCREEN _NEWIMAGE(2560, 1440, 32)
$COLOR:32
COLOR CrayolaGold, DarkCyan
_SCREENMOVE 0, 0 ' Move screen to top left corner.
CLS
_DELAY .1
GWL_STYLE = -16
ws_border = &H800000
WS_VISIBLE = &H10000000
_TITLE "Borderless Window"
DIM hwnd AS LONG
hwnd = _WINDOWHANDLE
_DELAY .1
Level = 175
winstyle2& = GetWindowLongA&(hwnd, GWL_STYLE)
winstyle& = -12582913
a& = SetWindowLongA&(hwnd, GWL_STYLE, winstyle& AND WS_VISIBLE) ' AND NOT WS_VSCROLL) ' AND NOT ws_border)
a& = SetWindowPos&(hwnd, 0, 0, 0, 0, 0, 39)
msg$ = "Welcome to Translucent Windows Without Borders!"
i = 16
COLOR &HFFFFFFFF, &H0 ' white foreground, transparent background
DO
_LIMIT 60
FGwin& = GetForegroundWindow&
IF hwnd <> FGwin& THEN ' QB64 no longer in focus.
WHILE _MOUSEINPUT: WEND
a& = SetWindowPos&(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE + SWP_SHOWWINDOW)
DO: _LIMIT 30: LOOP UNTIL hwnd = GetForegroundWindow&
END IF
IF INKEY$ = CHR$(27) THEN EXIT DO
LOOP
SYSTEM
Shoot first and shoot people who ask questions, later.
Posts: 2,171
Threads: 222
Joined: Apr 2022
Reputation:
103
Oh, and similar to what OldMoses posted... Let's play hide the task bar!
_screenmove 0, -27
--------------------------
Just shoves the window up far enough to hide the task bar.
Pete
Shoot first and shoot people who ask questions, later.
Posts: 65
Threads: 22
Joined: Apr 2022
Reputation:
2
Thanks guys, that helps immensely.
|