Click here to Skip to main content
15,508,714 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 2:44
professionalRichard Andrew x641-Aug-20 2:44 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 2:55
arnold_w1-Aug-20 2:55 
AnswerRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 2:47
professionalRichard Andrew x641-Aug-20 2:47 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 3:04
arnold_w1-Aug-20 3:04 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 3:07
professionalRichard Andrew x641-Aug-20 3:07 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 3:45
arnold_w1-Aug-20 3:45 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 4:24
professionalRichard Andrew x641-Aug-20 4:24 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 4:49
arnold_w1-Aug-20 4:49 
Well, I guess no joy lasts forever... In case somebody is using bash.exe instead of TortoiseGit to Switch/Checkout, then I wanted to do the same thing with bash.exe as the parent form. But when I call
C#
parentForm = ProcessWindowsHelper.getHandleToAnotherProcessWindow("bash", "MING")
then it seems the handles list inside the EnumerateProcessWindowHandles method doesn't get any elements.
C#
private static IEnumerable<IntPtr> EnumerateProcessWindowHandles(int processId)
{
    List<IntPtr> handles = new List<IntPtr>();
    ProcessThreadCollection processThreadCollection = Process.GetProcessById(processId).Threads;
    for (int i = 0; i < processThreadCollection.Count; i++)
    {
        ProcessThread thread;
        thread = processThreadCollection[i];
        EnumThreadWindows(thread.Id,
            delegate(IntPtr hWnd, IntPtr lParam)
            {
                handles.Add(hWnd);
                return true;
            },
            IntPtr.Zero);
    }
    return handles;
}
The call to Process.GetProcessById(processId).Threads returns 3 threads, but nothing gets added to the handles list. Does anybody know why?

When I look at the information in Spy++ I see the following:
C#
Window OOOA9B72 "MINGW64:/c/dummyRepo" mintty
Windows Properties, General tab:
C#
Window Caption: MINGW64:/c/dummyRepo
Window Handle:  OOOA9B72
Window Proc:    (Unavailable)(Unicode)
Rectangle:      (86, 89)-(681, 466), 595x377
Restored Rect:  (86, 89)-(681, 466), 595x377
Client Rect:    (8, 31)-(570, 369), 562x338
Instance Handle 00400000
Menu Handle     00000000
User Data       00000000
Windows Bytes:


modified 1-Aug-20 10:15am.

GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 5:31
professionalRichard Andrew x641-Aug-20 5:31 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 6:22
arnold_w1-Aug-20 6:22 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 6:36
professionalRichard Andrew x641-Aug-20 6:36 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 7:07
arnold_w1-Aug-20 7:07 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 7:10
professionalRichard Andrew x641-Aug-20 7:10 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 7:15
arnold_w1-Aug-20 7:15 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 7:21
professionalRichard Andrew x641-Aug-20 7:21 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 7:51
arnold_w1-Aug-20 7:51 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 8:05
professionalRichard Andrew x641-Aug-20 8:05 
QuestionAzure Active Directory question Pin
pkfox31-Jul-20 1:50
professionalpkfox31-Jul-20 1:50 
AnswerRe: Azure Active Directory question Pin
Richard Deeming4-Aug-20 1:01
mveRichard Deeming4-Aug-20 1:01 
GeneralRe: Azure Active Directory question Pin
pkfox4-Aug-20 4:36
professionalpkfox4-Aug-20 4:36 
GeneralRe: Azure Active Directory question Pin
Richard Deeming4-Aug-20 4:40
mveRichard Deeming4-Aug-20 4:40 
GeneralRe: Azure Active Directory question Pin
pkfox4-Aug-20 6:38
professionalpkfox4-Aug-20 6:38 
GeneralRe: Azure Active Directory question Pin
Richard Deeming4-Aug-20 6:48
mveRichard Deeming4-Aug-20 6:48 
GeneralRe: Azure Active Directory question Pin
pkfox4-Aug-20 7:52
professionalpkfox4-Aug-20 7:52 
GeneralRe: Azure Active Directory question Pin
Richard Deeming5-Aug-20 0:14
mveRichard Deeming5-Aug-20 0:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.