Guidance
指路人
g.yi.org
software / rapidq / Examples / String & Text / CodeSense / CodeSense.bas

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

  
     $TYPECHECK ON

     CONST crlf = CHR$(13) + CHR$(10)
' The following lines enable BOOL variable type usage
     $DEFINE Bool INTEGER
     CONST True = 1
     CONST False = 0

     $INCLUDE "Win32_constants.inc"
     $INCLUDE "C_Constants.inc"
     $INCLUDE "Functions.inc"


     CONST White = 16777215
     CONST Black = 0
     CONST Blue = 16711680
     CONST Red = 255


     DIM apii AS LONG
     DIM apiout AS LONG
     DIM winhandle AS LONG

     DECLARE FUNCTION CreateWindowEx LIB "USER32" ALIAS "CreateWindowExA" _
      (ExStyle&, ClassName$, WindowName$, Style&, X&, Y&, _
      Width&, Height&, WndParent&, hMenu&, hInstance&, Param&) AS LONG


     DECLARE FUNCTION GetModuleHandle LIB "KERNEL32" ALIAS "GetModuleHandleA" _
      (ModuleName AS STRING) AS LONG

     DECLARE FUNCTION DestroyWindow LIB "user32" ALIAS "DestroyWindow" _
      (BYVAL hwnd AS LONG) AS LONG

     DECLARE FUNCTION SetParent LIB "user32" ALIAS "SetParent" _
      (BYVAL hWndChild AS LONG, BYVAL hWndNewParent AS LONG) AS LONG

     DECLARE FUNCTION FlashWindow LIB "user32" ALIAS "FlashWindow" _
      (BYVAL hwnd AS LONG, BYVAL bInvert AS LONG) AS LONG

     DECLARE FUNCTION ShowWindow LIB "user32" ALIAS "ShowWindow" _
      (BYVAL hwnd AS LONG, BYVAL nCmdShow AS LONG) AS LONG

     DECLARE FUNCTION SetWindowLong LIB "user32" ALIAS "SetWindowLongA" _
      (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG, BYVAL dwNewLong AS LONG) AS LONG

     DECLARE SUB showwin
     DECLARE SUB chiudi
     DECLARE SUB resize

     DIM Form AS QFORM
     WITH form
      .center
      .width = 400
      .onshow = Showwin
     END WITH

     Form.onresize = resize
     Form.onclose = chiudi
     Form.SHOWMODAL


     SUB showwin
' Component Registration
      apii = CmUnregister()
      apii = CMRegister(CM_VERSION)

' Creating editor window
      winhandle = CreateWindowEx(0, _
       "CodeSense", "", WS_VISIBLE OR WS_CHILD, _
       40, 60, 200, 100, Form.handle, _
       0, GetModuleHandle(COMMAND$(0)), 0)
      ShowWindow(winhandle, 3)


' Setting up the language and syntax highlighting
      DIM language AS STRING
      RegisterRapidQLanguage
      Cm_SetLanguage (winhandle, "RapidQ")
      CM_EnableLeftMargin(winhandle, False)
      CM_EnableColorSyntax (winhandle, 1)

      DIM ColorSet AS CM_Colors
      WITH Colorset
       .crWindow = White
       .crLeftMargin = 14079702
       .crBookmark = 0
       .crBookmarkBk = 0
       .crText = Black
       .crTextBk = -1
       .crNumber = Red
       .crNumberBk = White
       .crKeyword =  Blue
       .crKeywordBk = -1
       .crOperator = Red
       .crOperatorBk = White
       .crScopeKeyword = Red
       .crScopeKeywordBk = White
       .crComment = 11447982
       .crCommentBk = White
       .crString = 8421440
       .crStringBk = White
       .crTagText = 256
       .crTagTextBk = White
       .crTagEntity = 256
       .crTagEntityBk = White
       .crTagElementName = 256
       .crTagElementNameBk = White
       .crTagAttributeName = 256
       .crTagAttributeNameBk = White
       .crLineNumber = Black
       .crLineNumberBk = .crLeftMargin
       .crHDividerLines = 8421440
       .crVDividerLines = 256
       .crHighlightedLine = 256
      END WITH
      Cm_SetColors(winhandle, ColorSet)


      DIM Fonts AS CM_FONTSTYLES
      WITH Fonts
       .byText = 0               ' plain text font style
       .byNumber = 0             ' numeric literal font style
       .byKeyword = 1            ' keyword font style
       .byOperator = 1           ' operator font style
       .byScopeKeyword = 4       ' scope keyword font style
       .byComment = 2            ' comment font style
       .byString = 2             ' string font style
       .byTagText = 0            ' plain tag text font style
       .byTagEntity = 0          ' tag entity font style
       .byTagElementName = 0     ' tag element name font style
       .byTagAttributeName = 0   ' tag attribute name font style
       .byLineNumber = 0         ' line number font style
      END WITH
      Cm_SetFontStyles (winhandle, Fonts)

      DIM LineNum AS CM_LINENUMBERING
      WITH linenum
       .bEnabled = True
       .nStartAt = 1
       .dwStyle = CM_DECIMAL
      END WITH

      Cm_SetLineNumbering(winhandle, Linenum)
     END SUB


     SUB chiudi
      apii = CmUnregister
      DestroyWindow(winhandle)
     END SUB

     SUB resize
      Setparent(winhandle, form.handle)
      ShowWindow(winhandle, 0)
      ShowWindow(winhandle, 3)
     END SUB
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2023-2-9  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-09-23 11:32:50