NvOptimusEnablement problem

I have dual GPU’s, Intel HD and Nvidia GPU. I want to force my application to use Nvidia GPU. So I created header file

extern "C"
{
  __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
}

and then included into my cpp file where I’m creating device with Nvidia adapter

D3D10CreateDeviceAndSwapChain(dxgiAdapter, D3D10_DRIVER_TYPE_HARDWARE,
        0, 0, D3D10_SDK_VERSION, &swapChainDesc,
           &pSwapChain, &pDevice);

where

dxgiAdapter

is

dxgiFactory -> EnumAdapters(1, &dxgiAdapter_); //1 is Nvidia GPU index, 0 - intel HD GPU index.

but it does not working. What is the problem?