title: CBT_Hook, HCBT_MINMAX event, or sub-classing to keep dialog window hidden. C++ on Windows
body: <p>I am trying to prevent a dialog password window that MS Access opens for an encrypted accdb file from becoming visible. (Instead I enter the password using the SendMessage API through a startup program).</p>
  
  <p>I tried installing a CBT_Hook, however the HCBT_MINMAX event for the dialog window does not fire in the same way as other regular windows i.e.: the low order word of lParam does not contain the expected show-window value (which I could then override). [It does work as expected for regular windows].</p>
  
  <p>The window is first created as hidden so modifying the CBT_CREATEWND structure in the HCBT_CREATEWND event does not help.[I tried setting ->cx and ->cy to 0 size, but the child windows are forcing a minimum size]</p>
  
  <p>I also tried sub-classing the dialog window (as soon as the HCBT_CREATEWND is fired I subclass it), but after that, setting lParam to FALSE for the WM_SHOWWINDOW message did not prevent the window from showing. </p>
  
  <p>I also tried canceling (RETURN 0) most WM_ messages the window was getting , such as WM_ACTIVATE, WM_SHOWWINDOW etc. but to no avail.</p>
  
  <p>Canceling the WM_NCCALCSIZE message helped, but that didn’t prevent the child windows from showing, so it does not really help.</p>
  
  <p>Any ideas?</p>
  
  <p>[At present, before starting Access I am enumerating all windows every 10ms and as soon as I find the password dialog box I am sending it a message to hide, but even doing that every 10 ms causes it to flash on and off once when it is discovered, I would like to prevent this.</p>
  
  <p>Starting Access using window style hidden does not help as the main Access app stays hidden but not the dialog box.]</p>