S
Steve
Ok, I am not really sure how to fully describe this problem but I will
do my best and maybe someone can help. First let me say I am not much
of a C# programmer (yet) have dione VB6 for years but am really just
starting with C#.
Anyway here is my problem. I have an app which needs to interact with
another application. To do this I have used some Win32 APIs (as
mentioned in the subject). The problem is I can not get these
functions to work. For whatever reason I am unable to get the
function ChildWindowFromPoint to work in either VB or C#. However I
can get WindowFromPoint to work in VB but not in C# with the exact
same arguments.
Here is my C# code:
[DllImport("user32.dll")]
static extern IntPtr WindowFromPoint(int xPoint, int yPoint);
IntPtr UserIDhWnd = WindowFromPoint(884, 433);
This does not return the handle to the window at those
coordinates...not sure what the value it is returning is but it is not
the window handle I am looking for.
Here is the VB6 version of the same thing:
Private Declare Function WindowFromPoint Lib "user32.dll" (ByVal
xPoint As _
Long, ByVal yPoint As Long) As Long
UserIDhWnd = WindowFromPoint(884, 433)
This code does work.
Can anyone tell me what I am doing wrong with my C# code.
Thanks,
Steve
do my best and maybe someone can help. First let me say I am not much
of a C# programmer (yet) have dione VB6 for years but am really just
starting with C#.
Anyway here is my problem. I have an app which needs to interact with
another application. To do this I have used some Win32 APIs (as
mentioned in the subject). The problem is I can not get these
functions to work. For whatever reason I am unable to get the
function ChildWindowFromPoint to work in either VB or C#. However I
can get WindowFromPoint to work in VB but not in C# with the exact
same arguments.
Here is my C# code:
[DllImport("user32.dll")]
static extern IntPtr WindowFromPoint(int xPoint, int yPoint);
IntPtr UserIDhWnd = WindowFromPoint(884, 433);
This does not return the handle to the window at those
coordinates...not sure what the value it is returning is but it is not
the window handle I am looking for.
Here is the VB6 version of the same thing:
Private Declare Function WindowFromPoint Lib "user32.dll" (ByVal
xPoint As _
Long, ByVal yPoint As Long) As Long
UserIDhWnd = WindowFromPoint(884, 433)
This code does work.
Can anyone tell me what I am doing wrong with my C# code.
Thanks,
Steve