Click here to Skip to main content
15,908,775 members
Home / Discussions / C#
   

C#

 
GeneralRe: I need to see if a digit from a number is odd or even in c# Pin
keeponfalling125-Aug-20 10:19
keeponfalling125-Aug-20 10:19 
GeneralRe: I need to see if a digit from a number is odd or even in c# Pin
Gerry Schmitz5-Aug-20 14:06
mveGerry Schmitz5-Aug-20 14:06 
QuestionHow to get ios device capacity using MDM profiling Pin
Veridic Anil4-Aug-20 22:25
Veridic Anil4-Aug-20 22:25 
AnswerRe: How to get ios device capacity using MDM profiling Pin
Gerry Schmitz5-Aug-20 5:58
mveGerry Schmitz5-Aug-20 5:58 
QuestionDataBase in User Control Pin
Ismael_19994-Aug-20 4:15
Ismael_19994-Aug-20 4:15 
AnswerRe: DataBase in User Control Pin
OriginalGriff4-Aug-20 4:32
mveOriginalGriff4-Aug-20 4:32 
GeneralRe: DataBase in User Control Pin
Gerry Schmitz4-Aug-20 6:12
mveGerry Schmitz4-Aug-20 6:12 
GeneralRe: DataBase in User Control Pin
OriginalGriff4-Aug-20 6:26
mveOriginalGriff4-Aug-20 6:26 
QuestionHow can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w31-Jul-20 2:38
arnold_w31-Jul-20 2:38 
AnswerRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Eddy Vluggen31-Jul-20 2:53
professionalEddy Vluggen31-Jul-20 2:53 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w31-Jul-20 4:03
arnold_w31-Jul-20 4:03 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard MacCutchan31-Jul-20 4:49
mveRichard MacCutchan31-Jul-20 4:49 
AnswerRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w31-Jul-20 11:03
arnold_w31-Jul-20 11:03 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Gerry Schmitz31-Jul-20 12:41
mveGerry Schmitz31-Jul-20 12:41 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x6431-Jul-20 16:22
professionalRichard Andrew x6431-Jul-20 16:22 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w31-Jul-20 23:09
arnold_w31-Jul-20 23:09 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w31-Jul-20 23:58
arnold_w31-Jul-20 23:58 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 1:44
professionalRichard Andrew x641-Aug-20 1:44 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 1:55
arnold_w1-Aug-20 1:55 
AnswerRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 1:47
professionalRichard Andrew x641-Aug-20 1:47 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 2:04
arnold_w1-Aug-20 2:04 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 2:07
professionalRichard Andrew x641-Aug-20 2:07 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 2:45
arnold_w1-Aug-20 2:45 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 3:24
professionalRichard Andrew x641-Aug-20 3:24 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 3:49
arnold_w1-Aug-20 3: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.

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.