--- a/ooDialog/trunk/ooDialog/oodUser.cpp
+++ b/ooDialog/trunk/ooDialog/oodUser.cpp
@@ -1488,7 +1488,7 @@
 
     if ( pcpbd->hDlg )
     {
-        setDlgHandle(context->threadContext, pcpbd);
+        setDlgHandle(pcpbd);
 
         // Set the thread priority higher for faster drawing.
         SetThreadPriority(pcpbd->hDlgProcThread, THREAD_PRIORITY_ABOVE_NORMAL);
@@ -1596,9 +1596,9 @@
         if ( hChild )
         {
             pcpbd->hDlg = hChild;
+            setDlgHandle(pcpbd);
             pcpbd->isActive = true;
             ((pCControlDialog)pcpbd->dlgPrivate)->activated = true;
-            setDlgHandle(context->threadContext, pcpbd);
         }
     }
     else