Guidance
指路人
g.yi.org
software / rapidq / examples / gui / Edit & Richedit / Win32API RichEdit / API RichEdit.bas

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

  
'From:  "dragon_html" <dragon_html@y...>
'Date:  Wed Jun 19, 2002  4:16 pm
'Subject:  Re: Help me,Example Source of Windows API function to replace QRichEdit

'create multiline-box by API

     $TYPECHECK ON

     $DEFINE HWND INTEGER

     CONST WS_EX_CLIENTEDGE = &H200 ' Just some of the many API constants
     CONST WS_CHILD = &H40000000
     CONST WS_VISIBLE = &H10000000
     CONST WS_BORDER = &H800000
     CONST ES_LEFT = 0
     CONST ES_AUTOHSCROLL = &H80
     CONST ES_MULTILINE = &H4

     CONST WM_COMMAND = &H111

'** Some Button Notification Codes **

     CONST BN_CLICKED = 0
     CONST IDM_CLEAR = 1


     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 SetWindowText LIB "USER32" ALIAS "SetWindowTextA" _
      (Hwnd AS INTEGER, Text AS STRING) AS LONG

     DECLARE SUB FormWndProc (Handle AS INTEGER, uMsg AS LONG, wParam AS LONG,lParam AS LONG)

     DIM Form AS QFORM
     Form.Center

     DIM EditHandle AS HWND
     DIM ButtonHandle AS HWND

     EditHandle = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "Edit"+STR$(1), _
      WS_CHILD OR WS_VISIBLE OR WS_BORDER OR ES_LEFT OR ES_AUTOHSCROLL OR ES_MULTILINE, _
      10,27,200,125, Form.Handle, 5,GetModuleHandle("WINEX.EXE"), 1)

     ButtonHandle = CreateWindowEx(WS_EX_CLIENTEDGE, "Button", "Clear "+STR$(1), _
      WS_CHILD OR WS_VISIBLE, _
      210,27,80,25, Form.Handle, 1,GetModuleHandle("WINEX.EXE"), 0)

'- ^ Button ID, make sure this is unique

     Form.CAPTION = "Creating Windows"
     Form.WndProc = FormWndProc
     Form.SHOWMODAL


     SUB FormWndProc (Handle AS INTEGER, uMsg AS DWORD, wParam AS LONG, lParam AS LONG)
      IF uMsg = WM_COMMAND THEN
       IF lParam = 0 THEN
        IF (wParam AND &HFF) = IDM_CLEAR THEN
         SetWindowText EditHandle(wParam SHR 8), ""
        END IF
       ELSE
        SELECT CASE (wParam AND &HFFFF)
        CASE IS = 1 AND (wParam SHR 16) = BN_CLICKED '-- Button 1 clicked
         SendMessage(Handle, WM_COMMAND, &H0100 OR IDM_CLEAR, 0)
        END SELECT
       END IF
      END IF
     END SUB


'For the better than this,
'I want to contact the multiline-box with same property, method and event of
'QRichEdit by API function.

'*Above code,come from modifying winex.bas in
'"Rapid-Q examples for Windows"
'(http://www.basicguru.com/rapidq/download.html)
掌柜推荐
 
 
¥1,380.00 ·
 
 
¥1,450.00 ·
 
 
¥477.00 ·
 
 
¥264.00 ·
 
 
¥1,280.00 ·
 
 
¥489.00 ·
© Mon 2024-11-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-05-02 08:52:26