Think you can do better??? Moving a Borderless Window
#2
A different approach:

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

Width 50, 25
Do: Loop Until _ScreenExists
GWL_STYLE = -16
ws_border = &H800000
WS_VISIBLE = &H10000000
_Title "No Border"
hwnd& = _WindowHandle
winstyle& = GetWindowLongA&(hwnd&, GWL_STYLE)
a& = SetWindowLongA&(hwnd&, GWL_STYLE, winstyle& And WS_VISIBLE)
a& = SetWindowPos&(hwnd&, 0, 0, 200, 400, 0, 39)



Do
    k = _KeyHit
    x = _ScreenX: y = _ScreenY
    Select Case k
        Case 19200: _ScreenMove x - 10, y
        Case 19712: _ScreenMove x + 10, y
        Case 18432: _ScreenMove x, y - 10
        Case 20480: _ScreenMove x, y + 10
    End Select
    _Limit 30
    Print "Much";
    Print " easier";
    Print " than";
    Print " Pete's";
    Print " method!";
    _Display
Loop Until k = 27


Just use the arrow keys to move your screen.   Tongue

For your mouse, you'd probably want to set it up so it works with either one distinct area of the screen ("click HERE to drag this window!"), or in combo with a control-key.  (CTRL + mouse drag, for instance.)
Reply


Messages In This Thread
RE: Think you can do better??? Moving a Borderless Window - by SMcNeill - 11-25-2022, 07:42 PM



Users browsing this thread: 3 Guest(s)