Results 1 to 8 of 8

Thread: hwnd stuff

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Posts
    64
    ok, i have seen all kinds of code on how 2 get progs hwnds. but.. what can u do with it?? i mean what all can u do with knowing the hwnd number of a prog?

    any help is great.. thanx!
    Charlie Jacquez
    16 Year Old Software Developer
    Email: [email protected]
    Web: CJWARES Online
    AIM: CJWARES, SlimmShadee2000, or BIOSzapper
    ICQ: 58493454
    I program: Basic, Visual Basic, HTML, and TI-Calculators
    My System Specs: Click here


  2. #2
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386
    Usually you're not even intrested in the hWnd, but you can for instance make a program invisible, close it, move it, to name a few things.

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Many API functions are declared to get your hwnd for some odd reason, I don't know why. Ie ShellExecute

  4. #4
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386
    Those API's want the hWnd as kind of a parentwindow for message's that might be displayed. Usually not intresting... :-)

  5. #5
    Addicted Member
    Join Date
    Sep 1999
    Posts
    154
    It is important to know if you are trying to create an application that is dependent on another application. Example: If this application is open then do this otherwise do this. You can determine if the ap[plication is open by searching for the application by the handle(hwnd). You may never use it but when you do, it will be very valuable.


  6. #6
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Cleveland, Ohio
    Posts
    263
    I've developed a program that deals with nothing but hwnd's, I'll let you look at it if you really want, but it's not done yet. It's beta, because I haven't added everything I want. Email me if you want to see it.

  7. #7
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Or, simply, because some functionality in VB was never meant to be done. For example there's no VB way to get how many lines in the textbox, or get a particular line from the textbox. And that's where API come in. But you need a window handle (hWnd) of the control you want to get the text from. hWnd is a representation of window (or control which is also a window) for the Windows OS. Every object on the screen potentially has an hWnd (well, almost every object). Check out MSDN library to get the idea on how hWnd works and how to work with it.

  8. #8
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    P.S If you really think about VB's functionality, then you'll realize that it is just a basic wrapper around API calls. For example, when you're getting text from the TextBox:
    strMyVariable = Text1.Text

    Simply what it does, just calls SendMessage API with the WM_GETTEXT message.

    Or if you get the Count from the ComboBox:
    intCount = Combo1.ListCount

    It just calls SendMessage API again:

    intCount = SendMessage(Combo1.hWnd, WM_GETCOUNT, 0, 0)

    I hope this will clear a lot of things for you.

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