Hello
You can refer to the CaptureSharedEventDriven sample, which also Write the captured wave data to an output file using CreateFile and WriteFile or the ApplicationLoopback sample.
And note that the CaptureSharedEventDriven sample has a flaw after resuming from a breakpoint.