Unable to create d3 device using c# with NVAPI

I’m trying to use c# with NVAPI to activate/deactivate stereo 3D but am unable to successfully create a device. Is the delegate not properly defined or am I missing something else? I’ve posted a portion of the source code below:

public delegate NvAPI_Status NvAPI_D3D11_CreateDeviceDelegate(ref IDXGIAdapter pAdapter, 
                                                                        D3D_DRIVER_TYPE DriverType, 
                                                                        HModule Software, 
                                                                        uint Flags,
                                                                        ref D3D_FEATURE_LEVEL[] pFeatureLevels, 
                                                                        uint FeatureLevels, 
                                                                        uint SDKVersion, 
                                                                        ref IntPtr ppDevice, 
                                                                        ref IntPtr pFeatureLevel,
                                                                        ref IntPtr ppImmediateContext, 
                                                                        ref IntPtr pSupportedLevel);
        public static readonly NvAPI_D3D11_CreateDeviceDelegate NvAPI_D3D11_CreateDevice;

static Nvapi()
            IntPtr lib = LoadLibrary(GetDllName());
            if (lib != IntPtr.Zero)
                nvapi_QueryInterface = GetDelegateOfFunction<nvapi_QueryInterfaceDelegate>(lib, "nvapi_QueryInterface");
                if (nvapi_QueryInterface != null)
                    GetDelegate(0x0150E828, out NvAPI_Initialize);
                    if (NvAPI_Initialize() == NvAPI_Status.NVAPI_OK)
                        GetDelegate(0xF6A1AD68, out NvAPI_Stereo_Activate);
                        GetDelegate(0x1FB0BC30, out NvAPI_Stereo_IsActivated);
                        GetDelegate(0x2D68DE96, out NvAPI_Stereo_Deactivate);
                        GetDelegate(0x6A16D3A0, out NvAPI_D3D11_CreateDevice);
                        GetDelegate(0xBB939EE5, out NvAPI_D3D11_CreateDeviceAndSwapChain);
                        GetDelegate(0xAC7E37F4, out NvAPI_Stereo_CreateHandleFromIUnknown);

static IntPtr GetD3D11Device()
            IDXGIAdapter pAdapter = new IDXGIAdapter();
            HModule hModule = new HModule();
            IntPtr ppDevice = new IntPtr();
            D3D_FEATURE_LEVEL[] FeatureLevelsRequested = new[] {
                D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_9_1 };
            IntPtr pFeatureLevel = new IntPtr();
            IntPtr ppImmediateContext = new IntPtr();
            IntPtr pSupportedLevel = new IntPtr();
            NvAPI_Status status = NvAPI_D3D11_CreateDevice(ref pAdapter, 
                ref FeatureLevelsRequested, 
                ref ppDevice, 
                ref pFeatureLevel, 
                ref ppImmediateContext,
                ref pSupportedLevel);
            Debug.Print("GetD3D11Device: " + status);
            return ppDevice;

static StereoHandle GetStereoHandle()
            StereoHandle stereoHandle = new StereoHandle();
            IntPtr pDevice = GetD3D11Device();
            NvAPI_Status status = NvAPI_Stereo_CreateHandleFromIUnknown(ref pDevice, out stereoHandle);
            Debug.Print("GetStereoHandle: " + status);
            return stereoHandle;