Documentation component by D.Glodt (c)2001-2002

Appendix A: QRun


QRun Component

QRun is a coponent no visible to execute applications or associated files.it can find all desktop application and take their control.

 

QRun Properties

Field

Type

R/W

Default





QRun Methods

Method

Type

Description

Params





FindApplication

FUNCTION(FileName$) AS STRING

Return the name and path of associated application.

1

FileRun

SUB(FileName$,cmdShow%)

Run a associated file or an exe file.
cmdShow can be
SW_HIDE
SW_SHOWNORMAL
SW_NORMAL
SW_SHOWMINIMIZED
SW_SHOWMAXIMIZED
SW_MAXIMIZE
SW_SHOWNOACTIVATE
SW_SHOW
SW_MINIMIZE
SW_SHOWMINNOACTIVE
SW_SHOWNA
SW_RESTORE
SW_SHOWDEFAULT
SW_MAX

2

ExeRun

SUB(ExeName$,Param$,cmdShow%)

Run an exe file with parameters.

3

EnumWindow

FUNCTION(All&) As Boolean

The desktop windows will be returned by event OnEnumWindows if the parameter All is at false , only visibles windows will be returned.The method return true if there is find windows

1

FindChild

FUNCTION(handle&,class$,name$) As Boolean

Return handle of children control by arguments following:

handle& is the parent handle , class$ is the class name of search control , name$ is the title of control.

3

EnumFromPoint

FUNCTION(X&,Y&) As Boolean

Return the window at the position x,y by event OnEnumFromPoint. The method return true if there is a find window.

2

Close

SUB(handle&)

Close window identify by handle parameter.

1

Minimize

SUB(handle&)

Minimize window identify by handle parameter.

1

Maximize

SUB(handle&)

Maximize window identify by handle parameter.

1

Restore

SUB(handle&)

Restore window state identify by handle parameter.

1

SetFocus

SUB(handle&)

Set focus on control identify by handle parameter.

1

SetTopMost

SUB(handle&,flag&)

Put the window identify by handle parameter to the top level of Z order if parameter flag is at true

2

QRun Events

Event

Type

Occurs when...

Params





OnEnumWindows

(handle&,name$,ClassName$)

On execution of the method EnumWindow

3

OnEnumFromPoint

(handle&,name$,ClassName$)

On execution of the method EnumFromPoint

3

QRun Examples

QRun Exemple 1

$typecheck on
$INCLUDE "Rapidq.inc"
$INCLUDE "Object\QRun.inc"

declare sub OuvrirClick
declare sub QuitterClick

dim App as QRun

CREATE Form AS QFORM
  Caption ="Execute"
  Width = 200
  Height = 200
  Center
  CREATE Menu AS QMAINMENU
    CREATE item1 AS QMENUITEM
      Caption="&Fichier"
      CREATE item2 AS QMENUITEM
        Caption="&Ouvrir"
        OnClick=OuvrirClick
      END CREATE
      CREATE item5 AS QMENUITEM
        Caption="-"
      END CREATE
      CREATE item6 AS QMENUITEM
        Caption="&Quitter"
        OnClick=QuitterClick
      END CREATE
   END CREATE
 END CREATE
END CREATE

Form.ShowModal

sub OuvrirClick
 dim file as QOPENDIALOG

 file.Filter="Fichiers(*.*)|*.*"
 file.InitialDir=CurDir$
 if file.Execute then
 if App.FindApplication(file.fileName)<>"" then
 App.fileRun(file.fileName,SW_SHOW)
 end if
 end if
end sub

sub QuitterClick
 Form.Close
end sub

QRun Exemple 2

$typecheck on
$include "rapidq.inc"
$include "QFuncLib.inc"
$include "Object\QRun.inc"

declare sub rout1
declare sub rout2(handle as Long,name as string,ClassName as string)

dim app as QRun
    app.OnEnumWindows=rout2

create form as qform
  center
  caption="Enum windows"
  width=600
  height=400
  create lb as qlistbox
    width=300
    height=200
  end create
  create bt as qbutton
    caption="Enum"
    onclick=rout1
    left=340
  end create
end create

form.showmodal

sub rout1
  lb.clear
  app.enumWindow false
end sub

sub rout2(handle as Long,name as string,ClassName as string)
  if handle<>form.handle and handle<>application.handle then
    lb.additems name
    lb.additems ClassName
  end if
end sub
 
Hosted by uCoz