How do I get the proper swapchain enumeration for getting the backbuffer?

I have code that I’m trying to update from DirectX 8, and so far I have been doing just fine until I reached this line of code:

r = g_pDevice->GetBackBuffer(/*,*/ 0, D3DBACKBUFFER_TYPE_MONO, &pBackSurf); 

Because of this I decided to look up the changes that were made between DirectX 8 and DirectX 9 regarding GetBackBuffer, and found that it needed a parameter called iSwapChain. What it’s asking for is the swap chain ordinal value, and referred me to D3DCAPS9’s code – more specifically the Number of Adapters in Group variable.

Of course I want to have the correct value to correspond with whatever ordinal would give me the proper backsurface to write stuff to (i.e. the last-to-render backsurface in the chain) but that information is elusive and when I was guided to DCAP.NoAiG it doesn’t lead me anywhere else.