$APPTYPE console
$INCLUDE "rapidq.inc"
CONST SW_SHOWNORMAL = 1
CONST sw_hide=0
DECLARE FUNCTION FreeConsole LIB "kernel32" ALIAS "FreeConsole"() AS LONG
DECLARE FUNCTION AllocConsole LIB "kernel32" ALIAS "AllocConsole" () AS LONG
DECLARE FUNCTION SetParent LIB "user32" ALIAS "SetParent" _
(BYVAL hWndChild AS LONG, BYVAL hWndNewParent AS LONG) AS LONG
DECLARE FUNCTION GetForegroundWindow LIB "user32" ALIAS "GetForegroundWindow" () AS LONG
DECLARE FUNCTION ShowWindow LIB "user32" ALIAS "ShowWindow" _
(BYVAL hwnd AS LONG, BYVAL nCmdShow AS LONG) AS LONG
DECLARE FUNCTION MoveWindow LIB "user32" ALIAS "MoveWindow" _
(BYVAL hwnd AS LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL nWidth AS LONG, BYVAL nHeight AS LONG, BYVAL bRepaint AS LONG) AS LONG
DIM handle AS LONG
AllocConsole
handle=getforegroundwindow
ShowWindow(handle,sw_hide)
DECLARE SUB but_click
DECLARE SUB form_close
CREATE form AS QFORM
onclose=form_close
width=screen.width-10
height=screen.height-50
top=25
CREATE box AS QSCROLLBOX
height=200
width=form.clientwidth/2
CREATE label AS QLABEL
height=296
END CREATE
END CREATE
CREATE butt AS QBUTTON
CAPTION ="test print"
onclick=but_click
left=200
END CREATE
END CREATE
setparent(handle,box.handle)
ShowWindow(handle,1)
MoveWindow(handle,-5,-54,box.width+55,screen.height,1)
form.SHOWMODAL
SUB but_click
PRINT "This will work now"
END SUB
SUB form_close
setparent(handle,0)
freeconsole
application.terminate
END SUB
|