Results 1 to 6 of 6

Thread: How dose windows know?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    175

    Thumbs up

    Hi

    When you open say the Notepad with some text in it and rightclick on the texts a popup menue appears with the Copy section not enabled.

    As soon as you select some text and you rightclick again
    you see the copy section of the menu is enabled.

    How dose windows know when the text is selected?
    Mass

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    It Doesn't, Notepad knows, Notepad is essentially a big textbox, you can check if a textbox has any text selected with CBool(Text1.SelLength)

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    175
    Thanks Sam but Could you tell me more. I don't know
    anything about CBool(Text1.SelLength)
    Mass

  4. #4
    Guest
    CBool will convert the statement to Boolean. Therefor, if SelLength = 0 then a False is returned (because False means 0) and if you do select and text, the length (SelLength) is greater than 0 so it returns True.

    So if the Statement is True, then you enabled the Copy menu.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    175
    Sorry But I need to be able to detect it from a vb application and while you are at it, could you please tell me how do I know (again from vb) if the mouse is clicked or
    dblclicked in external applications

    Thanks
    Mass

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Here also, he's talking about selected text in foreign applications, go look at my subclassing sample
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width