예제 #1
0
int main()
{
    int i;
    
    tLinkTable * pLinkTable = CreateLinkTable();
    /* init menu whih the common item, help, version, and exit */
    InitMenuItem(pLinkTable);

    /* Add new item to the exist menu dynamicly */
    AddMenuItem(pLinkTable, "add1", "add menu1", add1);
    AddMenuItem(pLinkTable, "add2", "add menu2", add1);

    /* cmd line begins */
    while(1)
    {
        char cmd[CMD_MAX_LEN];
        printf("Input a cmd > ");
        scanf("%s", cmd);
        /* call the func to run the menu */
        RunMenu(pLinkTable, cmd);
    }
    DeleteLinkTable(pLinkTable);
}
예제 #2
0
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
	pluginLink=link;

	if(mir_getMMI(&mmi))
	{
		MessageBox(NULL,_T("Avatar History"),_T("Miranda Memory manager not initialized, plugin cannot load.\nPlease update Miranda IM to the latest version."),MB_OK | MB_TOPMOST);
		return 1;
	}
	if(mir_getUTFI(&utfi))
	{
		MessageBox(NULL,_T("Avatar History"),_T("Miranda UTF8 interface not initialized, plugin cannot load.\nPlease update Miranda IM to the latest version."),MB_OK | MB_TOPMOST);
		return 1;
	}
	mir_getLP(&pluginInfo);

	// Is first run?
	if (DBGetContactSettingByte(NULL, MODULE_NAME, "FirstRun", 1))
	{
		// Show dialog
		int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), NULL, FirstRunDlgProc, 0);
		if (ret == 0)
			return -1;

		// Write settings

		DBWriteContactSettingByte(NULL, MODULE_NAME, "LogToDisk", 1);

		if (ret == IDC_MIR_SAME)
			DBWriteContactSettingByte(NULL, MODULE_NAME, "LogKeepSameFolder", 1);
		else
			DBWriteContactSettingByte(NULL, MODULE_NAME, "LogKeepSameFolder", 0);

		if (ret == IDC_MIR_SHORT || ret == IDC_SHORT || ret == IDC_DUP)
			DBWriteContactSettingByte(NULL, MODULE_NAME, "LogPerContactFolders", 1);
		else
			DBWriteContactSettingByte(NULL, MODULE_NAME, "LogPerContactFolders", 0);

		if (ret == IDC_DUP)
			DBWriteContactSettingByte(NULL, MODULE_NAME, "StoreAsHash", 0);
		else
			DBWriteContactSettingByte(NULL, MODULE_NAME, "StoreAsHash", 1);

		if (ret == IDC_MIR_SAME || ret == IDC_MIR_PROTO || ret == IDC_MIR_SHORT)
			DBWriteContactSettingByte(NULL, MODULE_NAME, "LogToHistory", 1);
		else
			DBWriteContactSettingByte(NULL, MODULE_NAME, "LogToHistory", 0);

		DBWriteContactSettingByte(NULL, MODULE_NAME, "FirstRun", 0);
	}

	LoadOptions();

	hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
	hHooks[1] = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
	hHooks[3] = HookEvent(ME_OPT_INITIALISE, OptInit);
	hHooks[4] = HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibIconsChanged);
	hHooks[5] = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);

	hServices[0] = CreateServiceFunction(MS_AVATARHISTORY_ENABLED, IsEnabled);
	hServices[1] = CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar);

	if(CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)profilePath) != 0)
		_tcscpy(profilePath, _T(".")); // Failed, use current dir

	SkinAddNewSoundExT("avatar_changed",LPGENT("Avatar History"),LPGENT("Contact changed avatar"));
	SkinAddNewSoundExT("avatar_removed",LPGENT("Avatar History"),LPGENT("Contact removed avatar"));

	hAvatarWindowsList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);

	SetupIcoLib();
	InitMenuItem();

	return 0;
}
예제 #3
0
extern "C" __declspec(dllexport) int Load(void)
{
	mir_getLP(&pluginInfo);

	CoInitialize(NULL);

	// Is first run?
	if ( db_get_b(NULL, MODULE_NAME, "FirstRun", 1)) {
		// Show dialog
		int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), NULL, FirstRunDlgProc, 0);
		if (ret == 0)
			return -1;

		// Write settings

		db_set_b(NULL, MODULE_NAME, "LogToDisk", 1);

		if (ret == IDC_MIR_SAME)
			db_set_b(NULL, MODULE_NAME, "LogKeepSameFolder", 1);
		else
			db_set_b(NULL, MODULE_NAME, "LogKeepSameFolder", 0);

		if (ret == IDC_MIR_SHORT || ret == IDC_SHORT || ret == IDC_DUP)
			db_set_b(NULL, MODULE_NAME, "LogPerContactFolders", 1);
		else
			db_set_b(NULL, MODULE_NAME, "LogPerContactFolders", 0);

		if (ret == IDC_DUP)
			db_set_b(NULL, MODULE_NAME, "StoreAsHash", 0);
		else
			db_set_b(NULL, MODULE_NAME, "StoreAsHash", 1);

		if (ret == IDC_MIR_SAME || ret == IDC_MIR_PROTO || ret == IDC_MIR_SHORT)
			db_set_b(NULL, MODULE_NAME, "LogToHistory", 1);
		else
			db_set_b(NULL, MODULE_NAME, "LogToHistory", 0);

		db_set_b(NULL, MODULE_NAME, "FirstRun", 0);
	}

	LoadOptions();

	HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
	HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
	HookEvent(ME_OPT_INITIALISE, OptInit);
	HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibIconsChanged);
	HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);

	CreateServiceFunction(MS_AVATARHISTORY_ENABLED, IsEnabled);
	CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar);

	if (CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)profilePath) != 0)
		_tcscpy(profilePath, _T(".")); // Failed, use current dir

	SkinAddNewSoundExT("avatar_changed",LPGENT("Avatar History"),LPGENT("Contact changed avatar"));
	SkinAddNewSoundExT("avatar_removed",LPGENT("Avatar History"),LPGENT("Contact removed avatar"));

	hAvatarWindowsList = WindowList_Create();

	SetupIcoLib();
	InitMenuItem();
	return 0;
}
예제 #4
0
BOOL CElcSkinFrameBase::Initialize(HWND hThis)
{
	if (!m_bEnableSkin)
		return TRUE;
		
	if (!::IsWindow(hThis)) {
		m_hDerive = 0;
		ASSERT(0);
		return FALSE;
	}

	m_hDerive = hThis;

	LONG style = GetWindowLong(m_hDerive, GWL_STYLE);
	LONG exstyle = GetWindowLong(m_hDerive, GWL_EXSTYLE);

	style &= ~WS_CAPTION;
	style &= ~WS_BORDER;

	exstyle &= ~WS_EX_CLIENTEDGE;
	exstyle &= ~WS_EX_STATICEDGE;

	CWnd* pWnd = CWnd::FromHandle(m_hDerive);
	if (!pWnd) {
		return FALSE;
	}
	else if (pWnd->IsKindOf(RUNTIME_CLASS(CDialog))) {
		m_nWndType = ELCSWT_DIALOG;

		if (style & WS_CHILDWINDOW) {
			m_nCaption = 0;
			m_nMenuBar = 0;
			m_nLeft = 0;
			m_nRight = 0;
			m_nBottom = 0;
		}
		else if (exstyle & WS_EX_WINDOWEDGE) {
			if ((style & WS_THICKFRAME) == 0)
				style |= WS_DLGFRAME;
		}

		m_bDrawClientBackgnd = TRUE;
	}
	else if (pWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd))) {
		m_nWndType = ELCSWT_FRAMEWND;
	}
	else {
		if (style & WS_CHILDWINDOW) {
			m_nCaption = 0;
			m_nMenuBar = 0;
			m_nLeft = 0;
			m_nRight = 0;
			m_nBottom = 0;
		}

		m_nWndType = ELCSWT_WND;
	}

	::SetWindowLong(m_hDerive, GWL_STYLE, style);
	::SetWindowLong(m_hDerive, GWL_EXSTYLE, exstyle);

	InitButtons();
	InitMenuItem();

	::SetWindowPos(m_hDerive, NULL, 0, 0, 0, 0, 
		SWP_NOACTIVATE|SWP_NOZORDER|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE);

	::SetTimer(m_hDerive, ELC_SKIN_FRAME_STATE_TIMER, 1000, NULL);

	return TRUE;
}