$OPTIMIZE ON
$TYPECHECK ON
$INCLUDE "rapidq.inc"
$ESCAPECHARS ON
DECLARE FUNCTION CreateWindowEx LIB "USER32" ALIAS "CreateWindowExA" (ExStyle&, ClassName$, WindowName$, Style&, X&, Y&, Width&, Height&, WndParent&, hMenu&, hInstance&, Param&) AS LONG
DECLARE FUNCTION SendMessageR LIB "user32" ALIAS "SendMessageA" (hwnd AS LONG, wMsg AS LONG, wParam AS LONG, lParam AS LONG) AS LONG
DECLARE FUNCTION SetWindowText LIB "user32" ALIAS "SetWindowTextA" (hwnd AS LONG, lpString AS STRING) AS LONG
DECLARE FUNCTION GetText LIB "GetText" ALIAS "GetText" (hwnd AS LONG, iMaxCount AS LONG) AS STRING
CONST WS_EX_CLIENTEDGE = &H200
CONST WS_CHILD = &H40000000
CONST WS_VISIBLE = &H10000000
CONST WS_BORDER = &H800000
CONST WM_GETTEXTLENGTH = &HE
CONST ES_RIGHT = &H2
CONST ES_MULTILINE = &H4
DECLARE SUB Button_OnClick
DIM hwndEdit(2) AS LONG
DEFSTR Window1Text$ = "Right", Window2Text$ = "Right\r\nand\r\nMulti\r\nLine"
DIM Form AS QFORM
hwndEdit(1) = CreateWindowEx(WS_EX_CLIENTEDGE,"edit", Window1Text$, WS_CHILD OR WS_VISIBLE OR WS_BORDER OR ES_RIGHT, 5, 5, 121, 21, Form.Handle, 0, Application.hInstance, 0)
hwndEdit(2) = CreateWindowEx(WS_EX_CLIENTEDGE,"edit", Window2Text$, WS_CHILD OR WS_VISIBLE OR WS_BORDER OR ES_RIGHT OR ES_MULTILINE, 5, 31, 121, 5 * 21, Form.Handle, 0, Application.hInstance, 0)
DIM Button AS QBUTTON
Button.PARENT = Form
Button.Top = 151
Button.Left = 5
Button.CAPTION = "&Push Me!"
Button.Default = True
Button.OnClick = Button_OnClick
Form.SHOWMODAL
SUB Button_OnClick
DIM LEN& AS LONG
LEN& = SendMessageR(hwndEdit(1), WM_GETTEXTLENGTH, 0, 0)
SHOWMESSAGE GetText(hwndEdit(1), LEN& + 1)
LEN& = SendMessageR(hwndEdit(2), WM_GETTEXTLENGTH, 0, 0)
SHOWMESSAGE GetText(hwndEdit(2), LEN& + 1)
SetWindowText(hwndEdit(1), "Left? No!")
LEN& = SendMessageR(hwndEdit(1), WM_GETTEXTLENGTH, 0, 0)
SHOWMESSAGE GetText(hwndEdit(1), LEN& + 1)
END SUB
|
|