Announcement

Collapse
No announcement yet.

control get text in SDK?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • control get text in SDK?

    How does one get the text in textbox control that is in a SDK program?
    Need to retrieve and write to file, so DDT program can use.

    Thanks,

    Brent

  • #2
    See GetDlgItemText, GetWindowText or WM_GETTEXT in win32.hlp.
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      Kev,

      Finally got text from textbox control with following code:
      Code:
           CASE %WM_COMMAND
                 '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  SELECT CASE LOWRD(wParam)
                      CASE %IDC_EDIT_1
                          SELECT CASE HIWRD(wParam)
                            CASE %EN_UPDATE,%EN_CHANGE,%EN_VSCROLL
                              GetWindowText GetDlgItem(hWnd,%IDC_EDIT_1), BYVAL STRPTR(NoFlickText),1024
                              'GetWindowText %idc_edit_1, BYVAL STRPTR(NoFlickText), 1024
                              'force background drawing updates...
                              InvalidateRect GetDlgItem(hWnd,%IDC_EDIT_1), BYVAL 0, 1
                          END SELECT
                  END SELECT
      But then I got windows error. Something about can't write to memory
      location .....
      Now, I can type text on bitmap, but can't get it out of the text box to
      save to file?

      Comment


      • #4
        You must allocate some space in your string, either assign NoFlickText = String$(%MAX_PATH, $NUL) before making the call, or alternatively you can use an ASCIIZ * %MAX_PATH fixed string.
        kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

        Comment


        • #5
          After reading help file on "STRPTR", I updated string buffer address:
          Code:
          CASE %WM_COMMAND
                '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 SELECT CASE LOWRD(wParam)
                     CASE %IDC_EDIT_1
                         SELECT CASE HIWRD(wParam)
                           CASE %EN_UPDATE,%EN_CHANGE,%EN_VSCROLL
                             xx=STRPTR(stxt)   ' gets string buffer address
                             NoFlicktext=stxt
                             [email protected]   ' Updates stxt address in memory
                             GetWindowText GetDlgItem(hWnd,%IDC_EDIT_1), BYVAL STRPTR(stxt),1024
                             'force background drawing updates...
                             InvalidateRect GetDlgItem(hWnd,%IDC_EDIT_1), BYVAL 0, 1
                         END SELECT
                 END SELECT
          Now it returns whatever I type into textbox and writes to file.
          Now, having problem trying to set the font to "MS Script BOLD" POINT12. Needs to match same size
          as in shell from program. What is an easy way to set the font in SDK program?
          Last edited by BRENT GARDNER; 31 Jan 2008, 08:02 AM. Reason: Forgot next question

          Comment


          • #6
            >You must allocate some space in your string..
            True.. but....
            > either assign NoFlickText = String$(%MAX_PATH, $NUL) ... or use ..ASCIIZ * %MAX_PATH fixed string.

            No need to guess at how long to make it and hope you guessed 'enough' ... you can ask the control how much text is available...
            Code:
               NoFlickText = STRING$ (SendMessage  _
                                 (lparam, %WM_GETTEXTLENGTH, %NULL, %NULL) + 1, $NUL)
            MCM
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              Brent described a file name being entered, so %MAX_PATH would suffice.

              Personally, I would use a file dialog instead of the user manually entering a name, as that is what these dialogs are provided for
              kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

              Comment


              • #8
                >Brent described a file name being entered

                I read it as him getting the text to be written to a file, not getting the file name.
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  Re-reading it, I see that it's not a file name entered, never mind
                  kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

                  Comment


                  • #10
                    The BIG PICTURE concept to take home Brent is that in using any Windows Api function dealing with strings of characters such as GetWindowText() or SetWindowText() and piles of others, the 'string' parameters in the function calls are absolutely not like basic dynamic strings such as...

                    Local strName as String

                    What actually must go where the string parameter lies in the function call is an address where space has been allocated to hold the string. That part of it you got right by using Byval Strptr(dynamic string variable). However, the somewhat elusive concept that 'slipped you up' is that basic type languages only allocate space belonging to the string through a variable assignment to the string resulting from the use of the equals sign. For example, this will cause the compiler to perform a memory allocation call to the operating system for 28 bytes...

                    Local strName As String
                    strName = "Compile Without Compromise!"

                    ...to hold the string. Then the compiler will copy the string to those allocated bytes. Any modifications to that string such as even concatenating one character to it will cause PowerBASIC to free the memory to the original string, allocate new memory, and copy the new string to the new location.

                    If you dimension a dynamic string variable and nothing is assigned to it then no memory to put anything has been allocated. That is why Byval Strptr(var) crashes. The api will start moving characters to an invalid location. That is why most api programmers use asciiz variables heavily in their code. In the situation above with your code, it makes more sence to dimension an asciiz variable long enough to hold the string, then just put that in the function call. Since basic's default parameter passing mechanism is a pass by reference, the address of the asciiz string will be passed to the Api - and that is what it wants - an address where it can start copying characters to.
                    I know Kev told you this but I thought it might be helpful to elaborate a bit because it can be a source of confusion.
                    Fred
                    "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

                    Comment


                    • #11
                      Fred,

                      BYREF and %MAX_PATH cause problems!


                      This returns correct text, but causes background bitmap to disappear were the textbox is
                      behind it?
                      Code:
                      GLOBAL NoFlickText AS ASCIIZ*%MAX_PATH 
                      GLOBAL stxt as ASCIIZ*%MAX_PATH
                      
                          GetWindowText GetDlgItem(hWnd,%IDC_EDIT_1), BYREF NoFlickText,1024
                      This works:
                      Code:
                          SetWindowText  GetDlgItem(hWnd,%IDC_EDIT_1), BYREF stxt
                      The PURPOSE of my program is to shell out to SDK program which will allow user to edit text in a textbox placed over a bitmap and NOT flicker as user types or deletes text. (Can't do in DDT)

                      Comment


                      • #12
                        Brent,

                        You don't have to use BYREF as the parameter is BYREF anyway. Try this:

                        Code:
                        GetDlgItemText hWnd, %IDC_EDIT_1, NoFlickText, [B]sizeof(NoFlickText)[/B]
                        If you want to overlay controls, try using a combination of the WS_EX_TRANSPARENT extended style for the bitmap and the WS_CLIPSIBLINGS style for all controls on the window/dialog. The "Z-Order" (tab order) is also important when overlaying controls. This can be changed by calling:

                        Code:
                        SetWindowPos hCtrl, %HWND_TOPMOST, 0, 0, 0, 0, %SWP_NOSIZE or %SWP_NOMOVE
                        ...with the control you want to be on top.
                        Last edited by Kev Peel; 31 Jan 2008, 10:01 AM.
                        kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

                        Comment


                        • #13
                          Originally posted by BRENT GARDNER View Post
                          What is an easy way to set the font in SDK program?
                          This works for me, goodness knows why:

                          Code:
                          ' found on forums, since roughly handled
                          FUNCTION AFontMake(BYVAL sFontName AS STRING, BYVAL nPointSize AS LONG, BYVAL bIsBold AS LONG, BYVAL bIsItalic AS LONG, BYVAL bIsUnderline AS LONG ) AS LONG
                              LOCAL hDC AS LONG, CyPixels AS LONG
                              hDC = GetDC(%HWND_DESKTOP)
                              CyPixels  = GetDeviceCaps(hDC, %LOGPIXELSY)
                              ReleaseDC %HWND_DESKTOP, hDC
                              nPointSize = (nPointSize * CyPixels) \ 72
                              FUNCTION = CreateFont(0 - nPointSize, 0, 0, 0, IIF&(bIsBold, %FW_BOLD, %FW_NORMAL), bIsItalic, bIsUnderline, 0, _
                                         %ANSI_CHARSET, %OUT_TT_PRECIS, %CLIP_DEFAULT_PRECIS, _
                                         %DEFAULT_QUALITY, %FF_DONTCARE, BYCOPY sFontName)
                          END FUNCTION
                          Code:
                              CASE %WM_CREATE
                                  STATIC DKWhfont1 AS LONG
                                  DKWhfont1 = Afontmake ("Courier New", 14, 1, 0, 0)
                                  sendmessage getdlgitem(hWnd,%LL2) , %WM_SETFONT, DKWhfont2, 0
                          
                               CASE WM_DESTROY
                                  Deleteobject DKWhfont1

                          Comment


                          • #14
                            Here is SDK code by Jules Marchildon:
                            Code:
                            '------------------------------------------------------------------------------
                            '
                            ' Instead of creating a %NULL_BRUSH, I created a pattern brush by using a chunk
                            ' of bitmap from where the edit control is going to be shown. This is assuming,
                            ' the bitmap is of actual size, and edit control has no border or H/V Scrollbars.
                            '
                            '------------------------------------------------------------------------------
                            #COMPILE EXE
                            #INCLUDE "Win32API.inc"
                            
                            %IDC_EDIT_1 = 1000
                            
                            GLOBAL hbmp        AS DWORD
                            GLOBAL hMemBmp     AS DWORD
                            GLOBAL hBmpDC      AS DWORD
                            GLOBAL NoFlickText AS STRING
                            '========================MakeFont FUNCTION===================================================
                            ' For Comments textbox text, Script MS Bold, Italic
                             FUNCTION MakeFontI(BYVAL SYSFont AS STRING, BYVAL PointSize AS LONG) AS LONG
                             LOCAL hDC      AS LONG
                             LOCAL CyPixels AS LONG              '/ 72   0,0,8,%fw_normal, 0, 0, 0,
                             hDC = GetDC(%HWND_DESKTOP)
                             CyPixels  = GetDeviceCaps(hDC, %LOGPIXELSY)
                             ReleaseDC %HWND_DESKTOP, hDC         'point 8 is default for power basic
                             PointSize =-MulDiv(PointSize, CyPixels, 72)
                             FUNCTION = CreateFont(PointSize, 0, 0, 0, %FW_NORMAL, 1, 0, 0, _  'italic, underline, strikeout
                             %ANSI_CHARSET, %OUT_TT_PRECIS, %CLIP_DEFAULT_PRECIS, _    'was %FW_NORMAL
                                %DEFAULT_QUALITY, %FF_DONTCARE, BYCOPY SYSFont)
                             END FUNCTION                    'FW_NORMAL, 0, 0, 1, LINE THROUGH MIDDLE OF TEXT
                            
                            '------------------------------------------------------------------------------
                            '
                            '------------------------------------------------------------------------------
                            FUNCTION CaptureBitmapSnippet(BYVAL hWnd AS DWORD,BYVAL hBitmap AS DWORD, BYVAL rc AS RECT ) AS DWORD
                            
                                LOCAL hDC AS DWORD
                                LOCAL hBMDC AS DWORD
                            
                                hDC = GetDC(hWnd)
                                hBMDC = CreateCompatibleDC(hDC)
                            
                                SelectObject hBMDC, hBitmap
                            
                                BitBlt hDC,0,0,rc.nleft,rc.ntop, hBMDC, rc.nright,rc.nbottom, %SRCCOPY
                            
                                FUNCTION = hBitmap
                            
                                ReleaseDC hWnd, hDC
                                DeleteDC hBMDC
                            
                            END FUNCTION
                            
                            '------------------------------------------------------------------------------
                            '
                            '------------------------------------------------------------------------------
                            FUNCTION WINMAIN (BYVAL hInstance AS DWORD, BYVAL hPrevInstance AS DWORD, _
                                              BYVAL lpCmdLine AS ASCIIZ PTR, BYVAL iCmdShow AS LONG) AS LONG
                            
                                LOCAL Msg       AS tagMsg
                                LOCAL wce       AS WndClassEx
                                LOCAL szAppName AS ASCIIZ * 80
                                LOCAL hWnd      AS DWORD
                                LOCAL hCtl      AS DWORD
                                szAppName         = "HelloWin"
                                wce.cbSize        = SIZEOF(wce)
                                wce.STYLE         = %CS_HREDRAW OR %CS_VREDRAW
                                wce.lpfnWndProc   = CODEPTR(WndProc)
                                wce.cbClsExtra    = 0
                                wce.cbWndExtra    = 0
                                wce.hInstance     = hInstance
                                wce.hIcon         = 0
                                wce.hCursor       = LoadCursor(%NULL, BYVAL %IDC_ARROW)
                                wce.hbrBackground = GetStockObject(%WHITE_BRUSH) '%NULL
                                wce.lpszMenuName  = %NULL
                                wce.lpszClassName = VARPTR(szAppName)
                                wce.hIconSm       = LoadIcon(hInstance, BYVAL %IDI_APPLICATION)
                            
                                RegisterClassEx wce
                            
                                ' Create a window using the registered class
                                hWnd = CreateWindow(szAppName, _               ' window class name
                                                    "Edit text Program", _     ' window caption
                                                    %WS_OVERLAPPEDWINDOW, _    ' window style
                                                    250, _                     ' initial x position
                                                    100, _                     ' initial y position
                                                    500, _                     ' initial x size
                                                    420, _                     ' initial y size
                                                    %NULL, _                   ' parent window handle
                                                    %NULL, _                   ' window menu handle
                                                    hInstance, _               ' program instance handle
                                                    BYVAL %NULL)               ' creation parameters
                            
                                IF hWnd = 0 THEN  ' exit on failure
                                    MSGBOX "Unable to create window"
                                    EXIT FUNCTION
                                END IF
                            
                                ' Display the window on the screen
                                ShowWindow hWnd, iCmdShow
                                UpdateWindow hWnd
                            
                                DO WHILE GetMessage(Msg, %NULL, 0, 0)
                                    TranslateMessage Msg
                                    DispatchMessage Msg
                                LOOP
                            
                                CALL SAVEEDIT
                                    '' File to open in "FLICKERJULES" to get edited text
                                    '? "NoFlickText, ready to close= "+NoFlickText
                                    ''NoFlickText=stxt
                                    'OPEN "C:\Program Files\MyDiaryWin\NoFlicker.csv" FOR OUTPUT AS #1
                                    '  WRITE #1, NoFlickText
                                    'CLOSE #1
                            
                                FUNCTION = msg.wParam
                            END FUNCTION
                            
                            '------------------------------------------------------------------------------
                            '
                            '------------------------------------------------------------------------------
                            FUNCTION WndProc (BYVAL hWnd AS DWORD, BYVAL wMsg AS DWORD, _
                                              BYVAL wParam AS DWORD, BYVAL lParam AS LONG) EXPORT AS LONG
                            
                                LOCAL hDC       AS DWORD
                                LOCAL pPaint    AS PAINTSTRUCT
                                LOCAL tRect     AS RECT
                                LOCAL ptnmhdr   AS NMHDR PTR
                                LOCAL hInst     AS DWORD,hImage   AS DWORD, hCtl AS DWORD
                                LOCAL wStyle    AS DWORD,wStyleEx AS DWORD
                                LOCAL szCaption AS ASCIIZ*255
                                LOCAL rc        AS RECT
                                LOCAL stxt      AS STRING
                                LOCAL Lb        AS LOGBRUSH 'DUPLICATE NAME
                                LOCAL lf        AS LOGFONT
                            
                                STATIC hBrush   AS DWORD
                                STATIC pt       AS POINTAPI
                                STATIC hFont11  AS LONG
                                'STATIC hBrush1  AS DWORD
                                '---
                                DIM xx AS ASCIIZ PTR
                                SELECT CASE wMsg
                            
                                 '---
                                 CASE %WM_INITDIALOG
                                   ' For text in a pop up dialog - NOT NEEDED FOR LOADPICTURETEXT
                                   'hFont11 = MakeFontI("MS Script Bold", 12) '("Script", 12)
                                   'GetObject hFont11, SIZEOF(lf), BYVAL VARPTR(lf)
                                   'lf.lfWeight = %FW_BOLD
                                   'lb.lbStyle = %NULL_BRUSH
                                   'hBrush = CreatePatternBrush( hMemBmp )
                            
                                   'hBrush1  = CreateSolidBrush(GetSysColor(%COLOR_3DFACE))
                            
                                   'SendMessage GetDlgItem(hwnd, %IDC_EDIT_1), %WM_SETFONT, hFont11, 0    ' 1000
                            
                                 CASE %WM_CREATE
                                   ' File to open is "FLICKERJULES" to get text to edit
                                   OPEN "C:\Program Files\MyDiaryWin\NoFlicker.csv" FOR INPUT AS #1
                                   WHILE ISFALSE EOF (1)
                                    INPUT #1, NoFlickText
                                   WEND
                                   CLOSE #1
                            
                                   '=========================================================================
                                    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    '---LOAD BITMAP FROM FILE...652 X 362 PIXELS
                                    STATIC bmpfile AS ASCIIZ*255
                                    'bmpfile = "C:\PROGRAM FILES\MYDIARYWIN\BITMAPS\TESTJULES.bmp" + CHR$(0)
                                    bmpfile = "C:\PROGRAM FILES\MYDIARYWIN\BITMAPS\TAN254FRAM1.bmp" + CHR$(0)
                                   '"jetstream.bmp" + CHR$ (0)   ' convert string to ASCIIZ
                                    hBmp = LoadImage(0, bmpfile, %IMAGE_BITMAP, 0, 0, %LR_LOADFROMFILE)
                            
                                    STATIC bm AS BITMAP
                                    GetObject hBmp, SIZEOF(bm), BYVAL VARPTR(bm)
                                    pt.x = bm.bmWidth: pt.y = bm.bmHeight
                                    '--resize window to fit actual size <todo: add border and caption offset>
                                    MoveWindow hWnd, 100,10,pt.x,pt.y,1
                            
                                    '---CAPTURE AREA WHERE THE CONTROL WILL BE POSITIONED...
                                    'CALL SetRect(rc,500,220,220,100)'area to capture
                                    'CALL SetRect(rc,207,105,305,209)'area to capture
                                    CALL SetRect(rc,12,12,630,340)'area to capture   53,61,305,209
                                    hMemBmp = CaptureBitmapSnippet( hWnd, hBmp, BYVAL rc ) 'returns a snippet
                                    hBrush = CreatePatternBrush( hMemBmp )
                                    '---
                                    ' Position where it would be in DiaryBook.exe and size in pixels
                                    SetWindowPos hWnd, %HWND_TOP, 260, 166, 652, 402,  0 'width & height in pixels %SWP_NOMOVE OR %SWP_NOSIZE
                                    'SetWindowPos hCtrl, %HWND_TOPMOST, 0, 0, 0, 0, %SWP_NOSIZE or %SWP_NOMOVE                                                '652,402
                                    '---add an edit control...
                                    hInst = GetModuleHandle(BYVAL %NULL)
                                    szCaption = ""
                                    'CALL SetRect(rc,500,220,220,100)
                                    CALL SetRect(rc,12,12,630,340)'same size as area to capture
                            
                                    wStyle   = %WS_CHILD OR %WS_CLIPSIBLINGS OR %WS_TABSTOP OR _
                                               %WS_VISIBLE OR %ES_LEFT OR %ES_AUTOVSCROLL   OR _
                                               %ES_MULTILINE OR %ES_WANTRETURN 'OR %WS_VSCROLL
                                    wStyleEx = 0 '%WS_EX_CLIENTEDGE
                            
                                    hCtl = CreateWindowEx(wStyleEx, "EDIT", szCaption,wStyle, _
                                                          rc.nLeft,rc.nTop,rc.nRight,rc.nBottom, _
                                                          hWnd, %IDC_EDIT_1, hInst, BYVAL %NULL)
                                    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    '' File to open is "FLICKERJULES" to get text to edit
                                    'OPEN "C:\Program Files\MyDiaryWin\NoFlicker.csv" FOR INPUT AS #99
                                    ' WHILE ISFALSE EOF (99)
                                    '  INPUT #99, NoFlickText
                                    ' WEND
                                    ' CLOSE #99
                                    'IF NoFlickText <> "" THEN
                                     stxt=TRIM$(NoFlickText) 'trim$(NoFlickText)
                                    'END IF
                                    '? "stxt = "+stxt
                                    'stxt = "This is your Mission Impossible!       " & $CRLF & _
                                    '       " ## Scroll down to read more ##        " & $CRLF & _
                                    '       "If you accept this mission, you" & $CRLF & _
                                    '       "will need your supernatural papers." & $CRLF & _
                                    '       "You can locate them in your back" & $CRLF & _
                                    '       "pocket on the right side of your" & $CRLF & _
                                    '       "flight suit." & $CRLF & _
                                    '       "This computer will self destruct in " & $CRLF & _
                                    '       "10 seconds...        "
                                    '? "stxt=  "+stxt
                            
                                    SetWindowText  GetDlgItem(hWnd,%IDC_EDIT_1), BYVAL STRPTR(stxt)
                                    'SetWindowText  GetDlgItem(hWnd,%IDC_EDIT_1), stxt 'BYVAL STRPTR(stxt)
                                    CALL SetFocus(GetDlgItem(hWnd,%IDC_EDIT_1))
                                    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            
                                    'SetTimer hWnd,555, 500, BYVAL %NULL
                            
                                 '---
                                 CASE %WM_TIMER
                                    'KillTimer hWnd, 555
                                    'stxt = "This is your Mission Impossible!       " & $CRLF & _
                                    '       " ## Scroll down to read more ##        " & $CRLF & _
                                    '       "If you accept this mission, you" & $CRLF & _
                                    '       "will need your supernatural papers." & $CRLF & _
                                    '       "You can locate them in your back" & $CRLF & _
                                    '       "pocket on the right side of your" & $CRLF & _
                                    '       "flight suit." & $CRLF & _
                                    '       "This computer will self destruct in " & $CRLF & _
                                    '       "10 seconds...        "
                                    'SetWindowText  GetDlgItem(hWnd,%IDC_EDIT_1), BYVAL STRPTR(stxt)
                                    'CALL SetFocus(GetDlgItem(hWnd,%IDC_EDIT_1))
                                    'FUNCTION =1 :EXIT FUNCTION
                            
                                 '---
                                 CASE %WM_PAINT
                                    hDC = BeginPaint(hWnd, pPaint)
                                        'dummy paint cycle
                                    EndPaint hWnd, pPaint
                                    FUNCTION = 1 :EXIT FUNCTION
                            
                                 '---
                                 CASE %WM_ERASEBKGND
                                    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    hBmpDC = CreateCompatibleDC(wParam)
                                    SelectObject hBmpDC, hBmp
                                    BitBlt wParam, 0, 0, pt.x, pt.y, hBmpDC, 0, 0, %SRCCOPY
                                    DeleteDC hBmpDC
                                    FUNCTION = 1 :EXIT FUNCTION
                                    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            
                                 'CASE %WM_CTLCOLORSTATIC    'changes font color in Labels
                                 ' SELECT CASE GetDlgCtrlID(LPARAM)
                                 '  ' textboxe - COLOR BROWN
                                 '  CASE %IDC_EDIT_1 '1000
                                 '   SelectObject wPARAM, hFont11
                                 '   SetBkMode wParam, %TRANSPARENT
                                 '   SetTextColor WPARAM, RGB(64,0,0)
                                 '   FUNCTION = hFont11: exit FUNCTION
                                 ' END SELECT
                            
                                 '---
                                 CASE %WM_CTLCOLOREDIT
                                    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    SetTextColor wParam, RGB(64,0,0)
                                    SelectObject wParam, hBrush
                                    SetBkMode wParam,%TRANSPARENT
                                    FUNCTION = hBrush :EXIT FUNCTION
                                    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            
                                 '---
                                 CASE %WM_COMMAND
                                       '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                        SELECT CASE LOWRD(wParam)
                                            CASE %IDC_EDIT_1
                                                SELECT CASE HIWRD(wParam)
                                                  CASE %EN_UPDATE,%EN_CHANGE,%EN_VSCROLL
                                                    xx=STRPTR(stxt)   ' gets string buffer address
                                                    NoFlicktext=TRIM$(stxt)
                                                    [email protected]   ' Updates stxt address in memory
                                                    'GetWindowText GetDlgItem(hWnd,%IDC_EDIT_1), BYVAL STRPTR(stxt),1024
                                                    ' GetWindowText GetDlgItem(hWnd,%IDC_EDIT_1), BYREF (stxt),%MAX_PATH '1024
                                                    'GetWindowText %idc_edit_1, byref stxt, %MAX_PATH
                                                    GetWindowText GetDlgItem(hWnd,%IDC_EDIT_1), BYVAL STRPTR(NoFlickText), 1024 '%MAX_PATH '1024
                                                    '' Kev try this - did not return added text?
                                                    ''GetDlgItemText hWnd, %IDC_EDIT_1, NoFlickText, SIZEOF(NoFlickText)
                                                   ' GetWindowText GetDlgItem(hWnd,%IDC_EDIT_1), BYREF NoFlickText,1024 '%MAX_PATH '1024
                                                    'GetWindowText %idc_edit_1, byval strptr(NoFlickText), 1024
                                                    'force background drawing updates...
                                                    InvalidateRect GetDlgItem(hWnd,%IDC_EDIT_1), BYVAL 0, 1
                                                END SELECT
                                        END SELECT
                                       '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            
                                 '---
                                 CASE %WM_DESTROY
                                    PostQuitMessage 0 :EXIT FUNCTION
                                    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    DeleteObject hBrush
                                    DeleteObject hBmp
                                    DeleteOBject hMemBmp
                                    'DeleteObject hBrush1
                                    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            
                                END SELECT
                            
                                 FUNCTION = DefWindowProc(hWnd, wMsg, wParam, lParam)
                            
                            END FUNCTION
                            
                            SUB SAVEEDIT
                                    ? "NoFlickText= "+NoFlickText
                                    ' File to open in "FLICKERJULES" to save edited text and return to program
                                    'IF NoFlickText <> "" THEN
                                     OPEN "C:\Program Files\MyDiaryWin\NoFlicker.csv" FOR OUTPUT AS #1
                                       WRITE #1, NoFlickText
                                     CLOSE #1
                                    'END IF
                            
                            END SUB
                            with modifications.
                            Last edited by BRENT GARDNER; 3 Feb 2008, 08:13 AM.

                            Comment


                            • #15
                              >This works for me, goodness knows why

                              RTFM and you'll know why, too.
                              Michael Mattias
                              Tal Systems (retired)
                              Port Washington WI USA
                              [email protected]
                              http://www.talsystems.com

                              Comment


                              • #16
                                Originally posted by Michael Mattias View Post
                                RTFM
                                Pedant!

                                Comment


                                • #17
                                  Goodness did RTFM: That's why she knows.
                                  Michael Mattias
                                  Tal Systems (retired)
                                  Port Washington WI USA
                                  [email protected]
                                  http://www.talsystems.com

                                  Comment


                                  • #18
                                    In above posted program, what is proper way to open a sequential file
                                    and get text in file string(NoFlickText) to variable stxt, a local string variable in program? Then after editing text in program, write the result
                                    back to sequential file and close.

                                    Comment


                                    • #19
                                      what is proper way to open a sequential file and get text in file string(NoFlickText) to variable stxt, a local string variable in program? Then after editing text in program, write the result back to sequential file and close.
                                      This is a trick question, right?

                                      OK, I'll bite: By following lesson #1 in your Learning BASIC reference?
                                      Michael Mattias
                                      Tal Systems (retired)
                                      Port Washington WI USA
                                      [email protected]
                                      http://www.talsystems.com

                                      Comment

                                      Working...
                                      X