如何在VCL表单应用程序中创建和调用函数

How to make and call a function in VCL form application

本文关键字:创建 调用 函数 应用程序 VCL 表单      更新时间:2023-10-16

我正在使用C++生成器,并且需要一些帮助才能为某些表单操作创建一个函数。我已经尝试了下面的代码,但没有运气。

这是我的代码:

int calculateAndDisplayImportantAppointments()
{
    int integerNumberOfImportantAppointments = calCalendar.getNumberOfImportantAppointments();
    if (integerNumberOfImportantAppointments > 0)
    {
        // itoa is not standard (like any of this is)
        WCHAR strN[32];
        swprintf(strN, L"%d", integerNumberOfImportantAppointments);
        // not familiar with ShowMessage(), but I *think* this will work.
        ShowMessage("You have " + UnicodeString(strN) + " important appointments. Do you wish to view them?");
    }
    return integerNumberOfImportantAppointments;
}

我收到以下错误:尝试调用此函数时调用未定义的函数calculateAndDisplayImportantAppointments

我可以在解决此问题方面获得一些帮助吗?

抱歉,非常简单的解决方案。

该函数需要写在声明它的代码部分上方。