Guidance
指路人
g.yi.org
software / rapidq / examples / gui / Edit & Richedit / SendMessage to control QRichEdit.bas

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

  
'From:  Jacques Philippe <jphilip@t...> Fri Nov 1, 2002  7:52 pm

'Here is the list of Window messages you can send to an Edit Control
'The required value is generally put in the return value of the message,
'so you dont need to handle messages in the wndproc callback function...

' Edit Control Messages
     CONST EM_GETSEL = &HB0
     CONST EM_SETSEL = &HB1
     CONST EM_GETRECT = &HB2
     CONST EM_SETRECT = &HB3
     CONST EM_SETRECTNP = &HB4
     CONST EM_SCROLL = &HB5
     CONST EM_LINESCROLL = &HB6
     CONST EM_SCROLLCARET = &HB7
     CONST EM_GETMODIFY = &HB8
     CONST EM_SETMODIFY = &HB9
     CONST EM_GETLINECOUNT = &HBA
     CONST EM_LINEINDEX = &HBB
     CONST EM_SETHANDLE = &HBC
     CONST EM_GETHANDLE = &HBD
     CONST EM_GETTHUMB = &HBE
     CONST EM_LINELENGTH = &HC1
     CONST EM_REPLACESEL = &HC2
     CONST EM_GETLINE = &HC4
     CONST EM_LIMITTEXT = &HC5
     CONST EM_CANUNDO = &HC6
     CONST EM_UNDO = &HC7
     CONST EM_FMTLINES = &HC8
     CONST EM_LINEFROMCHAR = &HC9
     CONST EM_SETTABSTOPS = &HCB
     CONST EM_SETPASSWORDCHAR = &HCC
     CONST EM_EMPTYUNDOBUFFER = &HCD
     CONST EM_GETFIRSTVISIBLELINE = &HCE
     CONST EM_SETREADONLY = &HCF
     CONST EM_SETWORDBREAKPROC = &HD0
     CONST EM_GETWORDBREAKPROC = &HD1
     CONST EM_GETPASSWORDCHAR = &HD2
'
'


' -------- TEST CODE --------
' Test of EM_MEssages sent to an EDIT control
'
'$INCLUDE "QREDEX.INC"
     $ESCAPECHARS ON
     $TYPECHECK ON
     $INCLUDE "RAPIDQ.INC"
'
     DECLARE FUNCTION SendMessageX LIB "user32" ALIAS "SendMessageA" (BYVAL hwnd AS LONG, _
      BYVAL wMsg AS LONG, BYVAL wParam AS LONG, lParam AS LONG) AS LONG
'
' Edit Control Messages Should word with richedit too (QEDIT is single line I guess)
'
'Const EM_GETSEL = &HB0
'Const EM_SETSEL = &HB1
'Const EM_GETRECT = &HB2
'Const EM_SETRECT = &HB3
'Const EM_SETRECTNP = &HB4
'Const EM_SCROLL = &HB5
'Const EM_LINESCROLL = &HB6
'Const EM_SCROLLCARET = &HB7
'Const EM_GETMODIFY = &HB8
'Const EM_SETMODIFY = &HB9
'Const EM_GETLINECOUNT = &HBA
'Const EM_LINEINDEX = &HBB
'Const EM_SETHANDLE = &HBC
'Const EM_GETHANDLE = &HBD
'Const EM_GETTHUMB = &HBE
'Const EM_LINELENGTH = &HC1
'Const EM_REPLACESEL = &HC2
'Const EM_GETLINE = &HC4
'Const EM_LIMITTEXT = &HC5
'Const EM_CANUNDO = &HC6
'Const EM_UNDO = &HC7
'Const EM_FMTLINES = &HC8
'Const EM_LINEFROMCHAR = &HC9
'Const EM_SETTABSTOPS = &HCB
'Const EM_SETPASSWORDCHAR = &HCC
'Const EM_EMPTYUNDOBUFFER = &HCD
'Const EM_GETFIRSTVISIBLELINE = &HCE
'Const EM_SETREADONLY = &HCF
'Const EM_SETWORDBREAKPROC = &HD0
'Const EM_GETWORDBREAKPROC = &HD1
'Const EM_GETPASSWORDCHAR = &HD2

'
     DECLARE SUB OnClose_frmMyForm
     DECLARE SUB OnClic_AnyMenu (Sender AS QMENUITEM)
'
     CREATE frmMyForm AS QFORM
      Center
      Width = 600
      height = 100
      CAPTION = "frmMyForm V 1.0.0 CLIC ON RUN TO START"
      AutoScroll = False
      OnClose = OnClose_frmMyForm
      CREATE Main AS QMAINMENU
       CREATE mnuRUN AS QMENUITEM
        CAPTION = "&RUN"
        OnClick = OnClic_AnyMenu
       END CREATE
      END CREATE
      CREATE edtMyEdit AS QEDIT
       Left = 5
       Top = 5
       Width = 200
       Height = 25
       Font.Size = 12
       Font.Bold = True
       Text ="dfaqf\r\nsdwn,f,;:wsdn;:n;:v,nwxcv,;:wn,;:,nsdfggklgj\r\nfkdjqsflkqsdjkljsdjkfl\kjqdkljqfk"
      END CREATE
     END CREATE
     SUB OnClose_frmMyForm
      application.Terminate
      END
     END SUB
'
' *************************************
' To Correct RapidQ Minimizing on the DeskTop
' -------------------------------------------
     DECLARE FUNCTION SetWindowLong LIB "user32" ALIAS "SetWindowLongA" (hWnd AS LONG, _
      nIndex AS LONG, dwNewLong AS LONG) AS LONG
     SUB MinSet (fhand AS INTEGER, gwl_hand AS INTEGER, hwnd AS INTEGER, apphand AS INTEGER)
      setwindowlong(fhand, Gwl_Hand, hwnd)
      setwindowlong(apphand, GWL_Hand, fhand)
     END SUB
     MinSet(frmMyForm.handle, -8, 0, application.handle)
' -------------------------------------
     frmMyForm.SHOWMODAL
' *************************************

     SUB OnClic_AnyMenu (Sender)
      DEFINT lineCount, lineLength, iPtr
      DEFSTR EditLineText
      SELECT CASE Sender.Handle
      CASE mnuRun.Handle
       lineCount = SendMessageX (edtMyEdit.Handle, EM_GETLINE, 0, 0)
       SHOWMESSAGE ("Line Count : " & STR$(lineCount))
       lineLength = SendMessageX (edtMyEdit.Handle, EM_LINELENGTH, 0, 0)
       SHOWMESSAGE ("Line Length : " & STR$(lineLength))
       EditLineText = SPACE$ (lineLength + 1)
       lineLength = SendMessageX (edtMyEdit.Handle, EM_GETLINE, 0,VARPTR(EditLineText))
       EditLineText = LEFT$(EditLineText, lineLength)
       SHOWMESSAGE ("Line (0): \n" & EditLineText & "\nLength : " & STR$(lineLength))
      END SELECT
     END SUB
' -------- END CODE --------
掌柜推荐
 
 
¥900.00 ·
 
 
¥430.00 ·
 
 
¥1,580.00 ·
 
 
¥1,015.00 ·
 
 
¥750.00 ·
 
 
¥890.00 编辑
© Mon 2024-11-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2002-11-01 21:53:42