' Clipboard via Win32 DECLARE — OpenClipboard, GetClipboardData, SetClipboardData
#COMPILE EXE
#DIM ALL

DECLARE FUNCTION OpenClipboard LIB "USER32.DLL" (BYVAL hWnd AS LONG) AS LONG
DECLARE FUNCTION CloseClipboard LIB "USER32.DLL" () AS LONG
DECLARE FUNCTION EmptyClipboard LIB "USER32.DLL" () AS LONG
DECLARE FUNCTION SetClipboardData LIB "USER32.DLL" (BYVAL uFormat AS LONG, BYVAL hMem AS LONG) AS LONG
DECLARE FUNCTION GetClipboardData LIB "USER32.DLL" (BYVAL uFormat AS LONG) AS LONG
DECLARE FUNCTION GlobalAlloc LIB "KERNEL32.DLL" (BYVAL uFlags AS LONG, BYVAL dwBytes AS LONG) AS LONG
DECLARE FUNCTION GlobalLock LIB "KERNEL32.DLL" (BYVAL hMem AS LONG) AS LONG
DECLARE FUNCTION GlobalUnlock LIB "KERNEL32.DLL" (BYVAL hMem AS LONG) AS LONG
DECLARE FUNCTION lstrcpy LIB "KERNEL32.DLL" (BYVAL lpString1 AS LONG, BYVAL lpString2 AS ASCIIZ) AS LONG

%CF_TEXT = 1
%GMEM_MOVEABLE = 2

FUNCTION PBMAIN() AS LONG
    PRINT "Clipboard via Win32 DECLARE:"
    PRINT "1. OpenClipboard, EmptyClipboard"
    PRINT "2. GlobalAlloc + GlobalLock + lstrcpy"
    PRINT "3. SetClipboardData, CloseClipboard"
    PRINT "GetClipboardData retrieves text"
    FUNCTION = 0
END FUNCTION
