Pause a running thread in MFC - mfc

I have created a thread using AfxBeginThread() in Visual Studio 2010 (vc++) professional edition.
Is there exist any medium by which I can pause (running )same thread handle?
I tried using SuspendThread(), but after this I have no control of the thread , so I can't resume the same thread using ResumeThread() function.
Any suggestion highly appreciated.

Related

How not suspend all threads in Visual Studio 2022 when C++ native breakpoint is reached?

I'm using Visual Studio 2022. I want to set a breakpoint and have the threads that reach it suspend, but I want those threads that have not reached a breakpoint to continue executing as though nothing has happened. Unavoidable consequences of doing this are acceptable to me. In my code, I will have properly synchronized between threads, copied data, and so on. If I do see an unexpected consequence then I've found a bug or learned something interesting about my code.
I found this Stack Overflow article regarding Visual Studio 2008.
VS2008 Suspending all threads upon hitting breakpoint
The article unofficially says Visual Studio 2008 cannot do what I'm asking for in this question. Version 2008 is many versions before today's 2022 yet I still have not found that for which I'm looking.
Before I give up my search, I'm asking this community, Is there a way in Visual Studio C++ native projects to suspend only threads that have reached breakpoints and have all others continue?
In the thread panel, you can resume the execution of the other threads.
If you want that the other threads does not stop, I don't know a way of doing it sadly.

While debugging with Visual Studio, my application freezes on an external DLL call. How can I find the path to this DLL?

I am debugging a Windows application on Visual Studio 2017 because my Azure Kinect application freezes after 20-30minutes of use. When I "pause" the debugger and check the call stack, I can see that the main thread is waiting for an operation happening on a separate thread. This second thread is executing a method defined by k4a.dll.
I have three versions of this dll on my operating system, and I am not sure which one my application is using. Is there any way I can extract the path to the library (dll) from Visual Studio?
(Notice: I am not looking for answers that tell me to use tools like PE-Explorer or Depends. I want that information coming from Visual Studio as it could be finding another library in its scan path)
Turns out you just need to right-click the Call Stack window over the library name and select Go To Module.
A new window will pop-up with a path to all the libraries your application is using...
Modules window with the path for each library:

How to disable servicehub.identityhost for Visual Studio

I'm trying to install c++ templates on Visual Studio and it keeps showing this message which I can't solve.
You need to close all visual studio windows before installing updates or new features.
If you have closed them all wait for a while for them to stop running, then check for the processes in task manager. If all else fails restart your machine.

How do I see which DLL is running in a given thread on a computer without Visual Studio installed?

There is a problem coming from a third-party DLL in our application, and it happens on a client's computer, which doesn't have Visual Studio installed.
Is there a way to 'break' the application and see which DLL is executing (for a given thread) at that moment? Some lighter-weight tool, perhaps?
You can use Process Explorer. Double click on a process, then open Threads tab, and double click on a thread.

Why does Visual Studio show multiple threads even though my MFC app isn't multithreaded?

I have a single-threaded MFC SDI application. When I run it in Visual Studio, the output window shows 2 threads exiting instead of one. It does this for both debug and release builds. Why is this?
Windows itself starts threads in order to perform work on behalf of your code. Other components like GDI+ and Sockets do the same thing. There's more to your process than just the code that you wrote!