It is a little different in C++.
extern "C"
{
__declspec( dllimport ) HDEVINFO SetupDiGetClassDevsUM( LPGUID ClassGuid, PCTSTR Enumerator, HWND hwndParent, DWORD Flags );
}
but not that different.
I don't know about C# but in C++ you'll also need to link to the DLL that exports this function, by adding its import library to the linker input list in Visual Studio or some thing like
#pragma comment(lib,"SetupAPI.lib")