Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Using a HWND from another application.

Using a HWND from another application.

Scheduled Pinned Locked Moved C#
helpcsharpc++databasesecurity
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mhand75
    wrote on last edited by
    #1

    I wrote an application a while back that used WIN32 C++ to query a list box in another application for its contents (using SendMessage). I would like to do the same in C#, but instead of using SendMessage, I would like to associate the HWND with a ListBox instance. I can get the HWND for the listbox that is in another app, and I tried using Control.FromHandle, but it returns null. If, however, I put a listbox in my own application it works. This made me suspect that it is a security issue and just not possible. Thanks for any help.

    J 1 Reply Last reply
    0
    • M mhand75

      I wrote an application a while back that used WIN32 C++ to query a list box in another application for its contents (using SendMessage). I would like to do the same in C#, but instead of using SendMessage, I would like to associate the HWND with a ListBox instance. I can get the HWND for the listbox that is in another app, and I tried using Control.FromHandle, but it returns null. If, however, I put a listbox in my own application it works. This made me suspect that it is a security issue and just not possible. Thanks for any help.

      J Offline
      J Offline
      John Arlen
      wrote on last edited by
      #2

      An HWND is not global but specific for an application's domain. (It's essentially a pointer). It is therefore not possible to use an HWND outside of that application.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups