Skip to content

Month Calendar Control: MCN_GETDAYSTATE Value Mismatch on Vista+ Systems #455

@JoseRoca

Description

@JoseRoca

While working with the Month Calendar control in FreeBasic, I discovered that the MCN_GETDAYSTATE notification does not fire on modern Windows systems—even when the control is created with the MCS_DAYSTATE style.

After extensive debugging, I traced the issue to a mismatch in the value of MCN_GETDAYSTATE defined in FreeBasic’s headers.

The Problem:

FreeBasic currently defines:
const MCN_GETDAYSTATE = culng(MCN_FIRST + 3) ' Resolves to -743

However, on Windows Vista and later, the correct value is:
MCN_GETDAYSTATE = culng(MCN_FIRST - 1) ' Resolves to -747

This silent shift causes WM_NOTIFY handlers to miss the message entirely, even though the control is sending it.

To resolve this, I have needed to override the constant manually:

#undef MCN_GETDAYSTATE
#define MCN_GETDAYSTATE culng(-747)

Placing this after including commctrl.bi, the notification fires as expected and day state logic works properly.

I hope this bug is fixed so other users don't have any headaches.

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions