コード例 #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
ファイル: msgs.c プロジェクト: BackupTheBerlios/mgoodies-svn
int LoadSendRecvMessageModule(void)
{
	if (LoadLibraryA("riched20.dll") == NULL) {
		if (IDYES !=
			MessageBoxA(0,
						Translate
						("Miranda could not load the built-in message module, riched20.dll is missing. If you are using Windows 95 or WINE please make sure you have riched20.dll installed. Press 'Yes' to continue loading Miranda."),
						Translate("Information"), MB_YESNO | MB_ICONINFORMATION))
			return 1;
		return 0;
	}
	hDLL = LoadLibraryA("user32");
	pSetLayeredWindowAttributes = (PSLWA) GetProcAddress(hDLL,"SetLayeredWindowAttributes");
	InitGlobals();
	RichUtil_Load();
	OleInitialize(NULL);
	InitREOleCallback();
	InitOptions();
	hEventDbEventAdded = HookEvent(ME_DB_EVENT_ADDED, MessageEventAdded);
	hEventDbSettingChange = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, MessageSettingChanged);
	hEventContactDeleted = HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted);
	HookEvent(ME_SYSTEM_MODULESLOADED, SplitmsgModulesLoaded);
	HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
	HookEvent(ME_PROTO_CONTACTISTYPING, TypingMessage);
	HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownSendRecv);
	CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
#if defined(_UNICODE)
	CreateServiceFunction(MS_MSG_SENDMESSAGE "W", SendMessageCommand);
#endif
	CreateServiceFunction(MS_MSG_GETWINDOWAPI, GetWindowAPI);
	CreateServiceFunction(MS_MSG_GETWINDOWCLASS, GetWindowClass);
	CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData);
	CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
	CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand);
	hHookWinEvt=CreateHookableEvent(ME_MSG_WINDOWEVENT);
	SkinAddNewSoundEx("RecvMsgActive", Translate("Messages"), Translate("Incoming (Focused Window)"));
	SkinAddNewSoundEx("RecvMsgInactive", Translate("Messages"), Translate("Incoming (Unfocused Window)"));
	SkinAddNewSoundEx("AlertMsg", Translate("Messages"), Translate("Incoming (New Session)"));
	SkinAddNewSoundEx("SendMsg", Translate("Messages"), Translate("Outgoing"));
	hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
	hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);
	hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND);
	if (hCurHyperlinkHand == NULL)
		hCurHyperlinkHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND));
	hDragCursor = LoadCursor(g_hInst,  MAKEINTRESOURCE(IDC_DRAGCURSOR));
	return 0;
}