简体   繁体   中英

COM addin for MS Office doesn't load in a limited user account

I've created a toolbar for Word. It's a COM addin and is written in C++. It works when Word is started by an Administrator account in XP. But when Word is started from a limited account it's not even loaded. I placed this code in DllMain:

/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point

HINSTANCE g_hInst = NULL;

extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
    static int passed = 0;
    if (!passed)
    {
        MessageBox(0, "foo", 0, 0);
        passed = 1;
    }

    g_hInst = hInstance;

    ............................
}

The message box is displayed when running Word from an admin account but not when running from a limited account. I'm testing this on an XP machine with Word 2003.

It turned out that my addin was registering itself in HKCU instead of HKLM (this was in the .rgs file). So only the user doing the install would have it registered. That's why Word wouldn't load it for other user accounts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM