Guidance
指路人
g.yi.org
software / RapidQ / Examples / Devices / mouse / whereisthemouse.bas

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

  
' Where is the Mouse
' A little application that indicates the cursor position, by following the cursor
' By Jean CARTIER
' Thanks to hermit_apps (Frank)
' This little program shows how to create an application that :
'  - follows the cursor
'  - is in background and react to the system events
'  - has no borders (easy)
'  - is closed by a keypress (ESC) (easy)

     DECLARE FUNCTION SetWindowPos LIB "user32" ALIAS "SetWindowPos" (BYVAL hwnd AS LONG, BYVAL hWndInsertAfter AS LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL cx AS LONG, BYVAL cy AS LONG, BYVAL wFlags AS LONG) AS LONG

     DECLARE SUB me.ku (key AS WORD)

     CREATE me AS QFORM
      width=50
      height=15
      keypreview=1 'keypress to close
      onkeyup=me.ku
      borderstyle=0 'noborder
      COLOR = &Hffffff
      CREATE Edit1 AS QLABEL
       Left = 0
       Top = 0
       Width = 50
      END CREATE
     END CREATE

     me.show

     DO
      SetWindowPos me.Handle, -1, 0, 0, 0, 0, 3 'Foreground
      DOEVENTS
      me.left=screen.MOUSEX+10 'cause otherwise you'll have the size-pointer
      me.top=screen.MOUSEY+10
      edit1.CAPTION = STR$(screen.MOUSEX)+"x"+STR$(Screen.MOUSEY)
     LOOP

     SUB me.ku (key AS WORD)
      IF key=27 THEN application.terminate '=esc you have no mouse to close :-)
     END SUB
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2023-2-2  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:45:12