title: DirectDraw get procedure address using GetProcAddress
body: <p>As stated in the documentation for the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/gg426155%28v=vs.85%29.aspx" rel="nofollow" title="IDirectDraw7::SetCooperativeLevel method">IDirectDraw7::SetCooperativeLevel method</a>, it states</p>
  
  <blockquote>
    <p>You must use LoadLibrary to explicitly link to Ddraw.dll and then use GetProcAddress to access the SetCooperativeLevel method.</p>
  </blockquote>
  
  <p>in the remarks. However when I attempt to do so (code below), it fails to work. Am I doing something wrong?</p>
  
  <pre><code>typedef HRESULT (*pSetCooperativeLevelFunc)(HWND, DWORD);
  HMODULE ddrawLib = LoadLibrary(L"ddraw.dll");
  pSetCooperativeLevelFunc SCL = (pSetCooperativeLevelFunc) GetProcAddress(
                                   ddrawLib,
                                   "SetCooperativeLevel"
                                   );
  
  if (SCL == NULL) {
      // this happens
      int error = GetLastError(); // 127 (ERROR_PROC_NOT_FOUND)
      printf("Error getting SetCooperativeLevel function address: %i", error);
  }
  </code></pre>