News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Edit Control Properties

Started by cman, March 15, 2012, 06:53:58 PM

Previous topic - Next topic

cman

I'm trying to write an application that allows the user to paste a large number of text lines into an edit control and then process the pasted lines. I'm using Visual Studio to create a dialog with a large edit box , but the maximum lines that I can paste is something like 768. Not sure if I need a different control for this task ( rich edit ? ). I guess my Windows programming skills are a bit rusty. :bg Thanks for any information.....

jj2007


cman

Thanks for the information. I still can't get the edit to take more than 700 some lines. I take a 2000 line file and paste it into the edit but it only displays some 700 lines and then will not take anymore input from the keyboard or anything else. Not sure what the problem is. I read the default limit for lines of text in a edit control is 30000 , so I'm not sure what is wrong here.......

qWord

The controls default maximum is 32767 characters, not lines.
can you supplie a example (exe,src) ?
FPU in a trice: SmplMath
It's that simple!

hutch--

Whats wrong with using a rich edit control ?

Also be careful that the clipoard may not also limit what you are doing.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

P1

Quote from: cman on March 15, 2012, 06:53:58 PM
I'm trying to write an application that allows the user to paste a large number of text lines into an edit control and then process the pasted lines.
Intercept the memory handle and parse the data directly from a Paste event.

There was an example of that some where on here before.

Otherwise code a HLL example(SetClipboardViewer) to MASM.

Clipboard limit is free memory of system(W2K or better). 

Regards,  P1  :8)

cman

Quote from: qWord on March 15, 2012, 11:12:46 PM
The controls default maximum is 32767 characters, not lines.


Oops!  :red How many characters can a rich edit input. Maybe I'll try one of those!

jj2007

Quote from: cman on March 15, 2012, 11:06:40 PM
Thanks for the information. I still can't get the edit to take more than 700 some lines.

So you probably have got a virus, or the edit control has a personal aversion agsint you. On my puter at least, after using EM_LIMITTEXT the pastable text jumps from 723 lines to ... the full Windows.inc.

dedndave

 :bg
i dunno about a virus
he probably just isn't mashing all the right buttons   :P
as always, we need to see some code to be more precise

donkey

First off, without at least a bit of code, like say the clipboard and paste function you're not going to get many useable answers. The problem could easily be one or more of a few things. The buffer passed to the clipboard is too small to copy all of the text, the Edit control buffer is too small (Create a larger one and use EM_SETHANDLE to assign it to the Edit control), or your machine is low on resources and could not allocate one of the buffers. Another less likely scenario is that when you read the file you're not assignng a large enough number in the nNumberOfBytesToRead parameter of the ReadFile function.

Next, the references in the thread to 32767 bytes being the maximum are right however that limit applies only to single line edit controls.

Finally the only other suggestion that I have without seeing any code is that a group of migratory book worms has moved into your computer and taken up residence in memory. In order to sustain themelves they have begun to eat any text that they find there, starting from the top and working down. With well over 10 MB of text to chomp through they become fat and bloated by the time they've eaten all but around 10K and can no longer slither through the traces in the memory chips. Since the worms have already entered the circuit traces and have become stuck, it only appears that you cannot paste the rest of the file when in reality you're just blocked by some worms fat ass.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

MichaelW

This works as expected, and allows me to paste in multiple copies of the text from the current MASM32 windows.inc and still edit the contents.

;==============================================================================
; Build as a console app.
;==============================================================================
    include \masm32\include\masm32rt.inc
;==============================================================================
    .data
      hInstance dd 0
      hwndEdit  dd 0
      rc        RECT <>
    .code
;==============================================================================

DlgProc proc hwndDlg:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD

    SWITCH uMsg

        CASE WM_INITDIALOG

            invoke GetDlgItem, hwndDlg, 101
            mov hwndEdit, eax

            invoke SendMessage, hwndEdit, EM_GETLIMITTEXT, 0, 0
            printf("%d\t",eax)
            invoke SendMessage, hwndEdit, EM_SETLIMITTEXT, 10000000, 0
            invoke SendMessage, hwndEdit, EM_GETLIMITTEXT, 0, 0
            printf("%d\n",eax)

        CASE WM_SIZE

            invoke GetClientRect, hwndDlg, ADDR rc
            invoke MoveWindow, hwndEdit, 0, 0, rc.right, rc.bottom, TRUE

        CASE WM_COMMAND

            SWITCH wParam

                CASE IDCANCEL

                    invoke EndDialog, hwndDlg, 0

            ENDSW

        CASE WM_CLOSE

            invoke EndDialog, hwndDlg, 0

    ENDSW

    xor   eax, eax
    ret

DlgProc endp

;==============================================================================
start:
;==============================================================================

    invoke GetModuleHandle, NULL
    mov   hInstance, eax

    Dialog "Test", \
           "MS Sans Serif",10, \
           WS_OVERLAPPED or WS_SYSMENU or DS_CENTER, \
           1,0,0,400,300,1024

    DlgEdit WS_BORDER or ES_MULTILINE or ES_WANTRETURN or \
            WS_VSCROLL or WS_HSCROLL or ES_AUTOVSCROLL or ES_AUTOHSCROLL, \
            0,0,0,0,101

    CallModalDialog hInstance,0,DlgProc,NULL

    exit
;==============================================================================
end start
eschew obfuscation

dedndave

nice example, Michael   :U

cman

Here's the code of the dialog I'm using. Maybe I've done something wrong ( I haven't programmed Windows for a while ). This is just a simple program shell to test the dialog box and edit control.

jj2007

Works like a charm.

.if uMsg == WM_INITDIALOG     ;Things to do when program starts
invoke GetDlgItem, hWin, 1000
invoke SendMessage, eax, EM_LIMITTEXT, 0, 0

cman

Hmmm.... Must be my system.  I cut and paste windows.inc  and about 280 lines were copied into the edit box. Might be time to reinstall Windows. :( Thanks for the help!  :U