title: My WlanRegisterNotification callback is only working when the callback is static
body: <p>I have been struggling for days to figure out the probably obvious reason why i cant get my code to compile.</p>
  
  <p>I have a class (based on wxThread) where the callback is defined:</p>
  
  <p>-- Header file --</p>
  
  <pre><code>class TestClass : public wxThread
  {
  private:
       static void WlanNotification(WLAN_NOTIFICATION_DATA *wlanNotifData, VOID *p); 
  };
  </code></pre>
  
  <p>-- Code file --</p>
  
  <p>I call the WlanRegisterNotification function, that needs the above callback function as a parameter:</p>
  
  <pre><code>dwResult = WlanRegisterNotification(hClient, WLAN_NOTIFICATION_SOURCE_ALL, true, (WLAN_NOTIFICATION_CALLBACK) WlanNotification, this, 0, &amp;dwPrevNotif);
  </code></pre>
  
  <p>This compiles and works fine, but the problem is the function is marked as static, so i cant access my non static stuff from the callback (which i need for other reasons).</p>
  
  <p>I have tried every single combination i can think of to pass in the callback as non static:</p>
  
  <p>-- Header file --</p>
  
  <pre><code>void WINAPI WlanNotification(PWLAN_NOTIFICATION_DATA data, PVOID context);
  </code></pre>
  
  <p>-- Code file --</p>
  
  <pre><code>dwResult = WlanRegisterNotification(hClient, WLAN_NOTIFICATION_SOURCE_ALL, true, (WLAN_NOTIFICATION_CALLBACK)WlanNotification, this, 0, &amp;dwPrevNotif);
  </code></pre>
  
  <p>i just get:</p>
  
  <ul>
  <li><p>error C2660: 'WlanRegisterNotification' : function does not take 6
  arguments</p></li>
  <li><p>error C2440: 'type cast' : cannot convert from 'overloaded-function' 
  to 'WLAN_NOTIFICATION_CALLBACK'</p></li>
  </ul>
  
  <p>I'm thinking its related to the typedef somehow:</p>
  
  <pre><code>typedef VOID (WINAPI *WLAN_NOTIFICATION_CALLBACK) (PWLAN_NOTIFICATION_DATA, PVOID);
  </code></pre>
  
  <p>I have tried googling for examples of using the WlanRegisterNotification function, but none of the examples i could find is calling it from a class, which is what seems to be an issue here, so i'm really lost.</p>