Click here to Skip to main content
15,868,016 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 4:31
professionalRichard Andrew x641-Aug-20 4:31 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 5:22
arnold_w1-Aug-20 5:22 
Yes, I stepped it. I first rewrote the method EnumerateProcessWindowHandles according to this:
C#
private static List<IntPtr> handles;

private static IEnumerable<IntPtr> EnumerateProcessWindowHandles(int processId)
{
    handles = new List<IntPtr>();
    ProcessThreadCollection processThreadCollection = Process.GetProcessById(processId).Threads;
    for (int i = 0; i < processThreadCollection.Count; i++)
    {
        ProcessThread thread;   // If I put a breakpoint here, the debugger stops 3 times
        thread = processThreadCollection[i];
        EnumThreadWindows(thread.Id, myDelegate, IntPtr.Zero);
    }
    return handles;
}

private static bool myDelegate(IntPtr hWnd, IntPtr lParam)
{
    handles.Add(hWnd);  // If I put a breakpoint here, then the debugger never stops
    return true;
}
So, something seems to go wrong inside the call to EnumThreadWindows, but that's a Win32 function and I don't know how to put a breakpoint inside it or how to step through it.
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 5:36
professionalRichard Andrew x641-Aug-20 5:36 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 6:07
arnold_w1-Aug-20 6:07 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 6:10
professionalRichard Andrew x641-Aug-20 6:10 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 6:15
arnold_w1-Aug-20 6:15 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 6:21
professionalRichard Andrew x641-Aug-20 6:21 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 6:51
arnold_w1-Aug-20 6:51 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 7:05
professionalRichard Andrew x641-Aug-20 7:05 
QuestionAzure Active Directory question Pin
pkfox31-Jul-20 0:50
professionalpkfox31-Jul-20 0:50 
AnswerRe: Azure Active Directory question Pin
Richard Deeming4-Aug-20 0:01
mveRichard Deeming4-Aug-20 0:01 
GeneralRe: Azure Active Directory question Pin
pkfox4-Aug-20 3:36
professionalpkfox4-Aug-20 3:36 
GeneralRe: Azure Active Directory question Pin
Richard Deeming4-Aug-20 3:40
mveRichard Deeming4-Aug-20 3:40 
GeneralRe: Azure Active Directory question Pin
pkfox4-Aug-20 5:38
professionalpkfox4-Aug-20 5:38 
GeneralRe: Azure Active Directory question Pin
Richard Deeming4-Aug-20 5:48
mveRichard Deeming4-Aug-20 5:48 
GeneralRe: Azure Active Directory question Pin
pkfox4-Aug-20 6:52
professionalpkfox4-Aug-20 6:52 
GeneralRe: Azure Active Directory question Pin
Richard Deeming4-Aug-20 23:14
mveRichard Deeming4-Aug-20 23:14 
GeneralRe: Azure Active Directory question Pin
pkfox5-Aug-20 3:12
professionalpkfox5-Aug-20 3:12 
GeneralRe: Azure Active Directory question Pin
pkfox4-Aug-20 23:12
professionalpkfox4-Aug-20 23:12 

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.