Search code examples
.netms-accesshandlespy++

Is the Window handle revealed by Spy++ unique to that computer, or unique to the application


Ok, so I have a Microsoft Access form which contains a textbox which I am trying to get a handle on from .Net

My form is below:

frmTest

Using Spy++, I have found my textbox handle. A screenshow is below:

Spy Plus

Is this handle unique to my PC or frmTest? As in, if I open frmTest on another computer will the handle for my textbox still be 001E1A6E?

Thanks


Solution

  • A window handle is allocated when the window gets created. If you run an application multiple times, an application window will get a new window handle every time. And if the application destroys and recreates the window, it'll get a new handle too.

    The handle is unique across processes. i.e. you can pass a window handle to another application, and it will still be valid(unlike kernel handles). I'm not sure if they are unique per desktop, or per running instance of windows.


    You should use the information from Spy++ to create a series of FindWindow(Ex) calls, that get the handle to the control you want.