Example #1
0
int init(void) {
    iniFile = (char*) SendMessage(plugin.hwndWinampParent, WM_WA_IPC, 0, IPC_GETINIFILE);
    if (! mlOrgConfig.LoadConfiguration(iniFile)) {
        logger.Error("ml_org::init()", "could not load configuration");
        return 1;
    }

    logger.SetLogLevel(mlOrgConfig.m_logLevel);
    logger.SetLogfile(mlOrgConfig.m_logfile);

    // Grab ahold of the window function pointer so we can do our own thang
    // when someone presses the "Organize Media Library" menu item
    mlWndproc = (WNDPROC) SetWindowLongPtr(plugin.hwndLibraryParent,
                                           GWLP_WNDPROC, (LONG) winproc);
    if (mlWndproc == 0) {
        int error = GetLastError();
        sprintf(tmp, "could not get window func ptr (%d)", error);
        logger.Error("ml_org::init()", tmp);
        return error;
    }

    logger.Info("ml_org::init()", "plugin initialized");
    return 0;
}