PackDBL$-function, UnpackDBL-function, WinHandle-function (original enhancement)
Supplied functions
WINHANDLE(s$)
The handle of the system window (or control) to be passed to Win32 API.
s$ is one of the following.
"MAIN","TEXT","GRAPHICS","INPUT","CHARACTER INPUT","TRACE", "LOCATE", "LOCATECHOICE", "TEXTWINDOW1", "TEXTWINDOW2", "RICHEDIT", "RICHEDIT1", "RICHEDIT2"
Differences in case are ignored.
"RICHEDIT", "RICHEDIT1", "RICHEDIT2" indicates the RichEdit control of the TextOutput window, TextWindow1,TextWindow2, respectively.
Example 1.
100 DECLARE EXTERNAL SUB MoveTextWindow, ResizeTextWindow 110 FOR i=1 TO 5 120 PRINT "Hello" 130 CALL MoveTextWindow(i*100,i*60) 140 CALL ResizeTextWindow(320,160+i*20) 150 WAIT DELAY 1 160 NEXT i 170 END 180 EXTERNAL SUB MoveTextWindow(x,y) 190 SUB SetWindowPos(hwnd,HwndInsAfter,x,y,cx,cy,nFlags) 200 ASSIGN "user32.dll","SetWindowPos" 210 END SUB 220 CALL SetWindowPos(WinHandle("TEXT"),0,x,y,0,0,1) 230 END SUB 240 EXTERNAL SUB ResizeTextWindow(x,y) 250 SUB SetWindowPos(hwnd,HwndInsAfter,x,y,cx,cy,nFlags) 260 ASSIGN "user32.dll","SetWindowPos" 270 END SUB 280 CALL SetWindowPos(WinHandle("TEXT"),0,0,0,x,y,2) 290 END SUB
Example 2.
FUNCTION SendMessage(Handle,MSG,WParam,IParam) ASSIGN "user32.dll","SendMessageA" END FUNCTION FOR i=1 TO 100 PRINT i NEXT i LET EM_SCROLL= BVAL("B5",16) LET SB_LINEUP =0 LET SB_LINEDOWN=1 LET SB_PAGEUP =2 LET SB_PAGEDOWN=3 FOR i=1 TO 100 WAIT DELAY 0.02 LET a= SendMessage(WINHANDLE("RICHEDIT"),EM_SCROLL,SB_LINEUP,0) NEXT i END
BYTE$(n)
The one byte character whose memory image coincides with an integer n .
WORD$(n)
The two byte characters whose memory image coincides with an integer n .
DWORD$(n)
The four byte characters whose memory image coincides with an integer n .
The above 3 functions ignore high-order bits.
PACKDBL$(n)
The (8 byte) memory image of double precision real whose value is n.
UNPACKDBL(s$)
The value converted to numerical value in BASIC from the memory image s$ of a 8 byte double precision real number.
BYTE$, WORD$, DWORD$ are equivalent to the following external functions.
1000 ! DWORD$ (4 byte characters which repesents a 32 bit integer.) 1010 EXTERNAL FUNCTION DWORD$(n) 1020 OPTION ARITHMETIC NATIVE 1030 OPTION CHARACTER byte 1040 LET r=MOD(n,2^8) 1050 LET s$=CHR$(r) 1060 LET n=(n-r)/2^8 1070 LET r=MOD(n,2^8) 1080 LET s$=s$ & CHR$(r) 1090 LET n=(n-r)/2^8 1100 LET r=MOD(n,2^8) 1110 LET s$=s$ & CHR$(r) 1120 LET n=(n-r)/2^8 1130 LET r=MOD(n,2^8) 1140 LET DWORD$=s$ & CHR$(r) 1150 END FUNCTION 1160 ! WORD$(2 byte characters which repesents a 16 bit integer.)) 1170 EXTERNAL FUNCTION WORD$(n) 1180 OPTION ARITHMETIC NATIVE 1190 OPTION CHARACTER byte 1200 LET r=MOD(n,2^8) 1210 LET s$=CHR$(r) 1220 LET n=(n-r)/2^8 1230 LET r=MOD(n,2^8) 1240 LET WORD$=s$ & CHR$(r) 1250 END FUNCTION 1260 ! BYTE$(One byte character which repesents a 8 bit integer.) 1270 EXTERNAL FUNCTION BYTE$(n) 1280 OPTION ARITHMETIC NATIVE 1290 OPTION CHARACTER byte 1300 LET BYTE$=CHR$(MOD(n,2^8)) 1310 END FUNCTION