2010年10月24日日曜日

FDKを使用してアラートの取得2

前回の続き

自作のFDKからマスターページの適用のfcodeを送っても、表示されるアラートを消すことができない。
どうやらnotificationが送られていないのが原因らしい。

結局はhWndを取得してキーコードを送るしかない。

2010年10月6日水曜日

FDKを使用してアラートの取得

FrameMaker Developer's Forumで面白い投稿があったのでメモ。
画像が表示できませんやマスターページを適用しますかといったアラートをFDKで取得し、自動ではいを押すプログラムです。
ここで使用されているFP_ActiveAlertはリファレンスにも載っていない実験的なプロパティみたいです。

#include "fapi.h"
#include "fdetypes.h"
#include "futils.h"

VoidT F_ApiInitialize(IntT init)
{
    if (init == FA_Init_First)
    {
        F_ApiNotification(FA_Note_Alert, True);
        F_ApiBailOut();
    }
}

VoidT F_ApiNotify(IntT notification, F_ObjHandleT docId, StringT filename, IntT iparm)
{
    F_ObjHandleT alertId;
    IntT uniq;

    switch (notification)
    {
    case FA_Note_Alert:
        // Get the id of the alert.
        alertId = F_ApiGetId(0, FV_SessionId, FP_ActiveAlert);
        uniq = F_ApiGetInt(FV_SessionId, alertId, FP_Unique);

        // If the alert is "Cannot display some imported graphics...", supppress it.
        switch(uniq)
        {
        case 40086: //"Cannot display some imported graphics..."
        case 40090: //"Cannot display some imported graphics..."
        case 46001: //Suppress ApplyMasterpages message
            F_ApiReturnValue(FR_YesOperation);
            break ;
        case 0:
            //Unfortunately no ID for "The font information changed..."
            if (F_StrCmp(filename, (StringT)"The font information for your system has changed. This change may affect the format and output of your document(s)."))
                F_ApiReturnValue(FR_YesOperation);
            if (F_StrCmp(filename, (StringT)"Die Schriftinformation für Ihr System hat sich geändert. Diese Änderung kann sich auf Formatierung und Ausgabe Ihrer Dokumente auswirken."))
                F_ApiReturnValue(FR_YesOperation);
            break;
        default:
            break;
        }
        break;

    default:
        break;
    }
    F_ApiBailOut();
}