示例#1
0
文件: main.c 项目: raoergsls/miranda
int __declspec(dllexport) Load(PLUGINLINK *link)
{
    BOOL bFlag = FALSE;
    HINSTANCE hDll;

#ifndef NDEBUG //mem leak detector :-) Thanks Tornado!
    int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); // Get current flag
    flag |= _CRTDBG_LEAK_CHECK_DF; // Turn on leak-checking bit
    _CrtSetDbgFlag(flag); // Set flag to the new value
#endif

    pluginLink = link;

    // set the memory & utf8 managers
    mir_getMMI( &memoryManagerInterface );
    mir_getUTFI( &utfi );
    mir_getLP( &pluginInfo );

    hDll = LoadLibraryA("riched20.dll");
    if ( hDll ) {
        char modulePath[MAX_PATH];
        if (GetModuleFileNameA(hDll, modulePath, MAX_PATH)) {
            DWORD dummy;
            VS_FIXEDFILEINFO* vsInfo;
            UINT vsInfoSize;
            DWORD size = GetFileVersionInfoSizeA(modulePath, &dummy);
            BYTE* buffer = (BYTE*) mir_alloc(size);

            if (GetFileVersionInfoA(modulePath, 0, size, buffer))
                if (VerQueryValueA(buffer, "\\", (LPVOID*) &vsInfo, &vsInfoSize))
                    if (LOWORD(vsInfo->dwFileVersionMS) != 0)
                        bFlag= TRUE;
            mir_free(buffer);
        }
    }

    if ( !bFlag ) {
        if (IDYES == MessageBox(0, TranslateT("Miranda could not load the Chat plugin because Microsoft Rich Edit v 3 is missing.\nIf you are using Windows 95/98/NT or WINE please upgrade your Rich Edit control.\n\nDo you want to download an update now?."),TranslateT("Information"),MB_YESNO|MB_ICONINFORMATION))
            CallService(MS_UTILS_OPENURL, 1, (LPARAM) "http://members.chello.se/matrix/re3/richupd.exe");
        FreeLibrary(GetModuleHandleA("riched20.dll"));
        return 1;
    }

    UpgradeCheck();

    g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));
    InitREOleCallback();
    HookEvents();
    CreateServiceFunctions();
    CreateHookableEvents();
    OptionsInit();
    TabsInit();
    return 0;
}
示例#2
0
extern "C" __declspec(dllexport) int Load(void)
{
	mir_getLP(&pluginInfo);
	mir_getCLI();

	AddIcons();
	RegisterFonts();

	CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Chat module"), FONTMODE_SKIP };
	mir_getCI(&data);
	saveCI = *pci;

	pci->OnAddUser = OnAddUser;
	pci->OnNewUser = OnNewUser;
	pci->OnRemoveUser = OnRemoveUser;

	pci->OnAddStatus = OnAddStatus;
	pci->OnSetStatus = OnSetStatus;
	pci->OnSetTopic = OnSetTopic;

	pci->OnAddLog = OnAddLog;
	pci->OnClearLog = OnClearLog;

	pci->OnCreateModule = OnCreateModule;
	pci->OnOfflineSession = OnOfflineSession;
	pci->OnRemoveSession = OnRemoveSession;
	pci->OnRenameSession = OnRenameSession;
	pci->OnReplaceSession = OnReplaceSession;
	pci->OnDblClickSession = OnDblClickSession;

	pci->OnEventBroadcast = OnEventBroadcast;
	pci->OnLoadSettings = OnLoadSettings;
	pci->OnSetStatusBar = OnSetStatusBar;
	pci->OnFlashWindow = OnFlashWindow;
	pci->OnFlashHighlight = OnFlashHighlight;
	pci->ShowRoom = ShowRoom;

	pci->DoPopup = DoPopup;
	pci->DoTrayIcon = DoTrayIcon;
	pci->ReloadSettings();

	g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));
	LoadIcons();
	TabsInit();

	HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
	HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
	return 0;
}