exe 调用指定 dll,想让 dll 返回当前所在位置, system32 还是 windows 下用 GetModuleFileName 返回的却是 exe 所在的目录...dll 该如何取得当前目录?

解决方案 »

  1.   

    BOOL WINAPI DllMain(
        HINSTANCE   hinstDLL,   // handle to the DLL module
        DWORD       fdwReason,  // reason for calling function
        LPVOID      lpvReserved // reserved
        )
    {
        char    FileName[MAX_PATH + 1], BookName[MAX_PATH + 1];
        long    NameLen;
        switch(fdwReason)
        {
            case DLL_PROCESS_ATTACH:                    //
        #ifdef _DEBUG
                fp=freopen("debug.txt", "w+t", stdout); //
        #endif
                GetModuleFileName(hinstDLL, FileName, MAX_PATH);//看这个地方!!!
      

  2.   

    呵呵,你怎么从程序中调用DLL的啊?COM?