Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. Now why doesn't this COMPILE!?!?!?

Now why doesn't this COMPILE!?!?!?

Scheduled Pinned Locked Moved COM
helpquestionannouncementworkspace
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tommy Svensson
    wrote on last edited by
    #1

    Hi, I've been staring at this problem for hours and hours... what is wrong?! This is what I do:

    ...snip...

    CComModule _Module;

    BEGIN_OBJECT_MAP(ObjectMap)
    OBJECT_ENTRY(CLSID_Lex, CLex)
    END_OBJECT_MAP()

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

    extern "C"
    BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
    {
    if (dwReason == DLL_PROCESS_ATTACH)
    {
    TCHAR pszLoader[MAX_PATH];
    GetModuleFileName(NULL, pszLoader, MAX_PATH);
    _tcslwr(pszLoader);
    if (_tcsstr(pszLoader, _T("explorer.exe")))
    return FALSE;

        \_Module.Init(ObjectMap, hInstance, &LIBID\_LEXBHOLib);
        DisableThreadLibraryCalls(hInstance);
    }
    else if (dwReason == DLL\_PROCESS\_DETACH)
        \_Module.Term();
    return TRUE;    // ok
    

    }

    ...snap...

    I get this error:

    ---Configuration: LexBHO - Win32 Unicode Release MinDependency--------
    Linking...
    Creating library ReleaseUMinDependency/LexBHO.lib and object ReleaseUMinDependency/LexBHO.exp
    LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    ReleaseUMinDependency/LexBHO.dll : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    LexBHO.dll - 2 error(s), 0 warning(s)

    But when I comment these lines out...

    /*
    TCHAR pszLoader[MAX_PATH];
    GetModuleFileName(NULL, pszLoader, MAX_PATH);
    _tcslwr(pszLoader);
    if (_tcsstr(pszLoader, _T("explorer.exe")))
    return FALSE;
    */

    ...things are working just fine. What is wrong with _tcslwr? Because that's where the problems start... Help is much appreciated, /Tommy

    S 1 Reply Last reply
    0
    • T Tommy Svensson

      Hi, I've been staring at this problem for hours and hours... what is wrong?! This is what I do:

      ...snip...

      CComModule _Module;

      BEGIN_OBJECT_MAP(ObjectMap)
      OBJECT_ENTRY(CLSID_Lex, CLex)
      END_OBJECT_MAP()

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

      extern "C"
      BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
      {
      if (dwReason == DLL_PROCESS_ATTACH)
      {
      TCHAR pszLoader[MAX_PATH];
      GetModuleFileName(NULL, pszLoader, MAX_PATH);
      _tcslwr(pszLoader);
      if (_tcsstr(pszLoader, _T("explorer.exe")))
      return FALSE;

          \_Module.Init(ObjectMap, hInstance, &LIBID\_LEXBHOLib);
          DisableThreadLibraryCalls(hInstance);
      }
      else if (dwReason == DLL\_PROCESS\_DETACH)
          \_Module.Term();
      return TRUE;    // ok
      

      }

      ...snap...

      I get this error:

      ---Configuration: LexBHO - Win32 Unicode Release MinDependency--------
      Linking...
      Creating library ReleaseUMinDependency/LexBHO.lib and object ReleaseUMinDependency/LexBHO.exp
      LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
      ReleaseUMinDependency/LexBHO.dll : fatal error LNK1120: 1 unresolved externals
      Error executing link.exe.

      LexBHO.dll - 2 error(s), 0 warning(s)

      But when I comment these lines out...

      /*
      TCHAR pszLoader[MAX_PATH];
      GetModuleFileName(NULL, pszLoader, MAX_PATH);
      _tcslwr(pszLoader);
      if (_tcsstr(pszLoader, _T("explorer.exe")))
      return FALSE;
      */

      ...things are working just fine. What is wrong with _tcslwr? Because that's where the problems start... Help is much appreciated, /Tommy

      S Offline
      S Offline
      soptest
      wrote on last edited by
      #2

      go ot project setting and remove _ATL_MIN_CRT macro soptest

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups