From: Jackie on
I wrote an example application, however, entirely in C/C++.
It follows pretty much the same instructions as I mentioned earlier.

It finds all top-level windows associated with the process mstsc.exe (if
that's the one you want) and just prints some info into a console window.

--------------------
Windows associated with RD:
'Remote Desktop Connection' (0x00410AF4)
'Remote Desktop Connection' (0x000A0C56)
'' (0x001E0BDA)
'' (0x000A0D34)
'' (0x00090BE0)
'' (0x00200916)
'MSCTFIME UI' (0x00240C0A)
'Default IME' (0x00150BFE)
--------------------

I didn't try anything more than opening mstsc without doing anything. At
least the window where you can connect stays on top of all other
non-topmost windows.
I wrote the code in C++ because it was quicker for me without converting
any APIs to C# code. I can give you the code. Just use the site I gave
you earlier (PInvoke) to check how to use the APIs in C# (mostly
copy/paste).
From: Matthew Arkin on
On 5/16/2010 4:35 PM, Jackie wrote:
> I wrote an example application, however, entirely in C/C++.
> It follows pretty much the same instructions as I mentioned earlier.
>
> It finds all top-level windows associated with the process mstsc.exe (if
> that's the one you want) and just prints some info into a console window.
>
> --------------------
> Windows associated with RD:
> 'Remote Desktop Connection' (0x00410AF4)
> 'Remote Desktop Connection' (0x000A0C56)
> '' (0x001E0BDA)
> '' (0x000A0D34)
> '' (0x00090BE0)
> '' (0x00200916)
> 'MSCTFIME UI' (0x00240C0A)
> 'Default IME' (0x00150BFE)
> --------------------
>
> I didn't try anything more than opening mstsc without doing anything. At
> least the window where you can connect stays on top of all other
> non-topmost windows.
> I wrote the code in C++ because it was quicker for me without converting
> any APIs to C# code. I can give you the code. Just use the site I gave
> you earlier (PInvoke) to check how to use the APIs in C# (mostly
> copy/paste).

Thanks for all your help, I'll see if I can get it to work.
From: Matthew Arkin on
On 5/16/2010 4:50 PM, Matthew Arkin wrote:
> On 5/16/2010 4:35 PM, Jackie wrote:
>> I wrote an example application, however, entirely in C/C++.
>> It follows pretty much the same instructions as I mentioned earlier.
>>
>> It finds all top-level windows associated with the process mstsc.exe (if
>> that's the one you want) and just prints some info into a console window.
>>
>> --------------------
>> Windows associated with RD:
>> 'Remote Desktop Connection' (0x00410AF4)
>> 'Remote Desktop Connection' (0x000A0C56)
>> '' (0x001E0BDA)
>> '' (0x000A0D34)
>> '' (0x00090BE0)
>> '' (0x00200916)
>> 'MSCTFIME UI' (0x00240C0A)
>> 'Default IME' (0x00150BFE)
>> --------------------
>>
>> I didn't try anything more than opening mstsc without doing anything. At
>> least the window where you can connect stays on top of all other
>> non-topmost windows.
>> I wrote the code in C++ because it was quicker for me without converting
>> any APIs to C# code. I can give you the code. Just use the site I gave
>> you earlier (PInvoke) to check how to use the APIs in C# (mostly
>> copy/paste).
>
> Thanks for all your help, I'll see if I can get it to work.
Though some sample c++ code would be awesome! I have some c++ experience.
From: Jackie on
On 5/16/2010 22:50, Matthew Arkin wrote:
> Thanks for all your help, I'll see if I can get it to work.

In case you would like to see my C/C++ code for reference, I put it up here:
http://pastebin.com/rFi4UrQ3

I used QueryFullProcessImageName instead of GetModuleFileNameEx to not
depend on psapi.dll.

Should hopefully be easy to convert it to C# with some help from
PInvoke. Good luck! :)
From: Jackie on
On 5/16/2010 23:10, Matthew Arkin wrote:
> Though some sample c++ code would be awesome! I have some c++ experience.

Great! I made a small change by adding the IsWindowVisible API. :)

http://pastebin.com/bTnasaUX