$TYPECHECK ON
$DEFINE HWND INTEGER
CONST WS_EX_CLIENTEDGE = &H200
CONST WS_CHILD = &H40000000
CONST WS_VISIBLE = &H10000000
CONST WS_BORDER = &H800000
CONST ES_LEFT = 0
CONST ES_AUTOHSCROLL = &H80
CONST ES_MULTILINE = &H4
CONST WM_COMMAND = &H111
CONST BN_CLICKED = 0
CONST IDM_CLEAR = 1
DECLARE FUNCTION CreateWindowEx LIB "USER32" ALIAS "CreateWindowExA" _
(ExStyle&, ClassName$, WindowName$, Style&, X&, Y&, _
Width&, Height&, WndParent&, hMenu&, hInstance&, Param&) AS LONG
DECLARE FUNCTION GetModuleHandle LIB "KERNEL32" ALIAS "GetModuleHandleA" _
(ModuleName AS STRING) AS LONG
DECLARE FUNCTION SetWindowText LIB "USER32" ALIAS "SetWindowTextA" _
(Hwnd AS INTEGER, Text AS STRING) AS LONG
DECLARE SUB FormWndProc (Handle AS INTEGER, uMsg AS LONG, wParam AS LONG,lParam AS LONG)
DIM Form AS QFORM
Form.Center
DIM EditHandle AS HWND
DIM ButtonHandle AS HWND
EditHandle = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "Edit"+STR$(1), _
WS_CHILD OR WS_VISIBLE OR WS_BORDER OR ES_LEFT OR ES_AUTOHSCROLL OR ES_MULTILINE, _
10,27,200,125, Form.Handle, 5,GetModuleHandle("WINEX.EXE"), 1)
ButtonHandle = CreateWindowEx(WS_EX_CLIENTEDGE, "Button", "Clear "+STR$(1), _
WS_CHILD OR WS_VISIBLE, _
210,27,80,25, Form.Handle, 1,GetModuleHandle("WINEX.EXE"), 0)
Form.CAPTION = "Creating Windows"
Form.WndProc = FormWndProc
Form.SHOWMODAL
SUB FormWndProc (Handle AS INTEGER, uMsg AS DWORD, wParam AS LONG, lParam AS LONG)
IF uMsg = WM_COMMAND THEN
IF lParam = 0 THEN
IF (wParam AND &HFF) = IDM_CLEAR THEN
SetWindowText EditHandle(wParam SHR 8), ""
END IF
ELSE
SELECT CASE (wParam AND &HFFFF)
CASE IS = 1 AND (wParam SHR 16) = BN_CLICKED
SendMessage(Handle, WM_COMMAND, &H0100 OR IDM_CLEAR, 0)
END SELECT
END IF
END IF
END SUB
|
|