Standalone app clips bottom if resized during mLayoutFunc

My UI is mainly bitmap based. I designed the UI layout and bitmaps around the largest scale, but I want to then default to a lower scale, so I call graphics->Resize() at the end of my mLayoutFunc code.

This works fine in a DAW, but in the standalone app, the bottom of the UI gets clipped off by the native window. This is because the internal window resize code uses the existing window dimensions in its calculation, but at this point the window has garbage dimensions (eg. zero height), causing the window rect to not be tall enough.

for my dev work I worked around it with this callback in iPlugAPP.h:

std::function<void()> mOnShowWindowFirstTime = NULL;

this is called in iPlugAPPHost.cpp → WM_INITDLG:

    case WM_INITDIALOG:
    {
      gHWND = hwndDlg;
      IPlugAPP* pPlug = pAppHost->GetPlug();

      if (!pAppHost->OpenWindow(gHWND))
        DBGMSG("couldn't attach gui\n");

      width = pPlug->GetEditorWidth();
      height = pPlug->GetEditorHeight();

      ClientResize(hwndDlg, width, height);

// gl - due to the way IPlug2 handles resizing, the client rect needs to be
//       established before the plugin can call a resize method (otherwise
//       the window bottom is clipped off as the resize calculations work off
//       the existing windows dimensions, which only exist now).  so give
//       the plugin a chance to set a default scale before the window is shown:
      if(pPlug->mOnShowWindowFirstTime)
        pPlug->mOnShowWindowFirstTime();

      ShowWindow(hwndDlg, SW_SHOW);
      return 1;

and then at the end of your mLayoutFunc code:

#ifdef APP_API
	mOnShowWindowFirstTime = [graphics]()
#endif
		{
		graphics->Resize(...)
		};

this will use the code via the callback in standalone app targets, and directly in any other targets (like VST3).

works fine and it’s only for development, but is there a better way?