11-15-2022, 09:05 PM
Anyway, I'll give you an example of how I'm using it...
Click the transparent box symbol and just pretend it's three horizontal lines for now.
Pete
Click the transparent box symbol and just pretend it's three horizontal lines for now.
Code: (Select All)
101
$RESIZE:ON
_DELAY .1
DIM SHARED idx, sam_mode
WIDTH 50, 25
_DELAY .1
a = _DESKTOPWIDTH - (_FONTWIDTH * _WIDTH)
_SCREENMOVE a, 0
fontsize% = 12
style$ = "monospace"
fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\lucon.ttf"
font& = _LOADFONT(fontpath$, fontsize%, style$)
_FONT font&
CONST HWND_TOPMOST%& = -1
CONST SWP_NOSIZE%& = &H1
CONST SWP_NOMOVE%& = &H2
CONST SWP_SHOWWINDOW%& = &H40
CONST KEYEVENTF_KEYUP = &H2
CONST VK_ALT = &H12 'Alt key
REDIM SHARED Hold AS POINTAPI
TYPE POINTAPI
X_Pos AS LONG
Y_Pos AS LONG
END TYPE
DECLARE DYNAMIC LIBRARY "user32"
FUNCTION GetAsyncKeyState% (BYVAL vkey AS LONG)
FUNCTION GetCursorPos (lpPoint AS POINTAPI)
FUNCTION FindWindowA& (BYVAL ClassName AS _OFFSET, WindowName$) 'handle by title
FUNCTION ShowWindow& (BYVAL hwnd AS _OFFSET, BYVAL nCmdShow AS LONG) 'maximize process
FUNCTION GetForegroundWindow& 'Find currently focused process handle
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)
SUB SENDKEYS ALIAS keybd_event (BYVAL bVk AS LONG, BYVAL bScan AS LONG, BYVAL dwFlags AS LONG, BYVAL dwExtraInfo AS LONG)
END DECLARE
_CONTROLCHR OFF
title$ = CHR$(4) + " Sam-Clip"
_TITLE (title$)
_DELAY .1
DIM SHARED hWnd AS LONG
hWnd = _WINDOWHANDLE
TYPE ClipType
clip AS STRING
fil AS STRING
cnt AS INTEGER
var AS INTEGER
mrgn AS INTEGER ' margins left and right
END TYPE
DIM SHARED AS ClipType a, c, placement, paste, header, lt, rt, tp, bt, myfile, hlght, menu
REDIM SHARED clipper$(_HEIGHT * 2), clipper%(_HEIGHT * 2)
rt.mrgn = 5: lt.mrgn = 5: tp.mrgn = 3: bt.mrgn = 2
IF lt.mrgn = 0 THEN lt.mrgn = 1 ' Default.
IF tp.mrgn = 0 THEN tp.mrgn = 1 ' Default.
DO: LOOP UNTIL _RESIZE = 0
DO
_LIMIT 60
IF _SCREENICON THEN _DELAY .2: _CONTINUE ' Disable when minimized.
z = GetCursorPos(Hold)
FGwin& = GetForegroundWindow&
IF hWnd <> FGwin& THEN ' QB64 no longer in focus.
y& = SetWindowPos&(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE + SWP_SHOWWINDOW)
END IF
' Title bar.
IF Hold.Y_Pos >= _SCREENY AND Hold.Y_Pos <= _SCREENY + 24 AND Hold.X_Pos >= _SCREENX + 36 AND Hold.X_Pos <= _SCREENX + 48 THEN
IF GetAsyncKeyState(1) < 0 THEN
IF menu.var = 0 THEN CALL sam_menu ' Isolated sub.
END IF
END IF
LOOP
END
SUB keypress (b$)
b$ = INKEY$
END SUB
SUB sam_menu
y = CSRLIN: x = POS(0)
LOCATE , , 0 ' Hide cursor
DO: _LIMIT 10: LOOP UNTIL GetAsyncKeyState(1) = 0
DO
z = GetCursorPos(Hold)
_LIMIT 30
IF Hold.Y_Pos >= _SCREENY AND Hold.Y_Pos <= _SCREENY + 24 AND Hold.X_Pos >= _SCREENX + 36 AND Hold.X_Pos <= _SCREENX + 48 THEN
IF GetAsyncKeyState(1) < 0 THEN
EXIT DO
END IF
END IF
CALL keypress(b$)
IF b$ = CHR$(27) THEN EXIT DO
IF menu.var = 0 THEN
menu.var = -1 ' Menu open.
PCOPY 0, 1
PALETTE 3, 56
COLOR 1, 7
LOCATE 1, 1
PRINT CHR$(218) + STRING$(18, 196) + CHR$(191)
FOR i = 1 TO 14
PRINT CHR$(179); SPACE$(18) + CHR$(179);
COLOR 7, 3: PRINT CHR$(SCREEN(CSRLIN, POS(0))) + CHR$(SCREEN(CSRLIN, POS(0) + 1)): COLOR 1, 7
NEXT
PRINT CHR$(192) + STRING$(18, 196) + CHR$(217);: COLOR 7, 3: PRINT CHR$(SCREEN(CSRLIN, POS(0))) + CHR$(SCREEN(CSRLIN, POS(0) + 1))
LOCATE , 3:
FOR i = 1 TO 20
PRINT CHR$(SCREEN(CSRLIN, POS(0)));
NEXT
COLOR 7, 0
END IF
LOOP
menu.var = 0
PCOPY 1, 0
LOCATE y, x
_KEYCLEAR
DO: _LIMIT 10: LOOP UNTIL GetAsyncKeyState(1) = 0
END SUB
Pete