How to connect glfw and DirectSound8

Hi. i am working with glfw and opengl for rendering and directsound8 for audio.

However i am not able to create ds8 object with glfw window.

here is my code:


int main(int argc, char* argv[])
{
    if (!glfwInit())
    {
        return -10;
    }
    
    GLFWwindow* window;
    window = glfwCreateWindow(640, 480, "Hello Engine Sound", NULL, NULL);
    
    if (window == NULL)
    {
        glfwTerminate();
        return -50;
    }
    
    glfwMakeContextCurrent(window);
    HWND hwnd = glfwGetWin32Window(window);
    GUID guid;
    IDirectSound8 *dsdevice;
    HRESULT result = DirectSoundCreate8(&guid, &dsdevice, NULL);
    result = dsdevice->SetCooperativeLevel(hwnd, DSSCL_PRIORITY);
return 0;
}

I am getting access violation at SetCooperativeLevel call.

I found the issue. i should pass the GUID returned by enumerate device function.