Monday, 21 April 2014

Hiding an MFC dialog box without taskbar / flickering etc

How to: Hiding an MFC dialog box without taskbar / flickering etc


If you show your dialog using CDialog::DoModal() the framework will make sure your dialog is shown. There is only one way to prevent a modal dialog from being shown:
In your MFC Project dialog e.g. CHiddenDialog.cpp
BEGIN_MESSAGE_MAP(CHiddenDialog, CDialog)
    ON_WM_WINDOWPOSCHANGING()
END_MESSAGE_MAP()


BOOL CHiddenDialog::OnInitDialog()
{
    CDialog::OnInitDialog();
    m_visible = FALSE;

    return TRUE;
}

void CHiddenDialog::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) 
{
    if (!m_visible)
        lpwndpos->flags &= ~SWP_SHOWWINDOW;

    CDialog::OnWindowPosChanging(lpwndpos);
}

in your header file CHiddenDialog.h
void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);

Friday, 4 April 2014

No identities are available for signing XCode 5 fix

It's a simple fix once you know how.

  1. On the apple website go to Certificates, Identifiers & Profiles in the Developer Center.
  2. Create a new provisioning profile in Provisioning Profiles / Distribution
  3. Click download profile and open it on the Mac machine. (double click on the download).
  4. Restart XCode.
  5. In the build settings, select the 'iPhone Distribution' in the build settings. (Release)
  6. In the build settings, Provisioning profile select the new profile loaded above.
  7. Product menu-->Archive and follow the instructions.