Guidance
指路人
g.yi.org
software / rapidq / Examples / Console / console in form.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'From:  "Marco"
'Date:  Mon Aug 12, 2002  8:05 pm
'Subject:  Re: [rapidq] nesting console window in a form

     $APPTYPE console''makes rapidq console functions availeble
     $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''otherwise we can not close it at the end
     handle=getforegroundwindow''get console window handle
     ShowWindow(handle,sw_hide)''hide console
     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)''set parent to box
     ShowWindow(handle,1)
''get rid of the title and menu bar
     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
  'free console
      setparent(handle,0)''paren to desktop again
      freeconsole''freeconsole
      application.terminate
     END SUB
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2024-4-20  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2002-08-12 20:53:54