Announcement

Collapse
No announcement yet.

Selecting And Copying All Text From PBDLL Editor

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

  • Selecting And Copying All Text From PBDLL Editor

    I using the code listed below to automatically select and copy
    all the text from a specified edit control (text or rich-text),
    but it doesn't work with either the PBDLL editor or UltraEdit 7.

    Does anyone know how I could provide the means of reliably
    selecting and copy text from most any edit control? PGP 7.0
    offers this type of function to encrypt and/or decrypt text from
    what it refers to as the "current window". Any ideas on how
    this could be done from PBDLL?

    Code:
    '
    ' Load Clipboard From Selected Text or Rich-Text Edit Control
    '
    SUB Txb2ClipBrd(hTXB AS LONG) ' hTXB = Handle to edit control
      '
      ' Create Local Variables
      '
      LOCAL i       AS LONG
      LOCAL Stt     AS LONG
      LOCAL Stp     AS LONG
      LOCAL sClass  AS STRING
      LOCAL selData AS CHARRANGE
      '
      ' Display Class Name (For DEBUG Only!!!)
      '
    '  sClass = STRING$(51,0)
    '  GetClassName hTXB, BYVAL STRPTR(sClass), 50
    '  MSGBOX sClass
      '
      ' Select Text
      '
      SendMessage hTXB, %EM_SETSEL, 0, -1
      '
      ' Check For Selected Text
      '
      SendMessage hTXB, %EM_GETSEL, VARPTR(Stt), VARPTR(Stp)
      '
      ' Display Selected Patameters (For DEBUG Only!!!)
      '
    '  MSGBOX "Stt = " & FORMAT$(Stt) & CHR$(13,13) & "Stp = " & FORMAT$(Stp)
      '
      ' Textbox Failed, Try RichEdit
      '
      IF Stt = -1 THEN
        '
        ' Get Number Of Characters To Copy
        '
        i = SendMessage(hTXB, %WM_GETTEXTLENGTH, 0, 0)
        IF i = 0 THEN EXIT SUB
        '
        ' Select Rich-Text
        '
        selData.cpMin = 0
        SelData.cpMax = i - 1
        SendMessage hTXB, %EM_EXSETSEL, 0, VARPTR(selData)
      END IF
      '
      ' Empty Clipboard First
      '
      ClearClipboard
      '
      ' Copy Text
      '
      SendMessage hTXB, %WM_COPY, 0, 0
    END SUB
    Thanks,

    Doug



    ------------------
    Thanks,

    Doug Gamble
    [email protected]

  • #2
    Doug --
    it looks that you want to copy a text, from a window, which doesn't belong to your app
    (in this case SendMessage with addresses do not work).

    If so, I think, there are two variants.
    1) to attach keyboard focus to this window (not so simple, but possible), and to emulate Ctrl-A and Ctrl-C (using keybd_event).
    2) to integrate own dll in each process using CBT-hook.
    See, for example, my hook to monitor active windows.
    Very simple, but it's necessary to worry about performance.

    ------------------
    E-MAIL: [email protected]

    Comment


    • #3
      Thanks for the reply Semen,

      Actually the code works with most edit controls (text and
      rich-text), but fails with a few editors (like PBDLL and
      UltraEdit). The SendMessage function seems to work fine once
      I have the handle to the control in question (even if it is in
      a different application). I'm hoping some member has had
      experience with something simular and/or someone from
      PowerBASIC (Lance or Dave?) can help with the routine working
      with the PBDLL editor. Perhaps that will give me a clue to
      making the code work with other edit controls.

      Thanks,

      Doug

      ------------------
      Thanks,

      Doug Gamble
      [email protected]

      Comment


      • #4
        The edit control in the IDE is a custom control, not a standard control. I suspect many IDE's use a similar technique, hence the problem you describe arises.

        I don't have any information on manipulating the IDE directly, sorry. Only R&D would have that information... you could write to

        Maybe I'm missing something, but how does encrypting data have anything to do with the IDE, anyway?



        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment

        Working...
        X