C++在dll中获取自身路径(非exe调用路径)

#include "stdafx.h"
#include 
#include 
#include 
using namespace std;

HMODULE GetSelfModuleHandle()
{
    MEMORY_BASIC_INFORMATION mbi;
    return ((::VirtualQuery(GetSelfModuleHandle, &mbi, sizeof(mbi)) != 0) ? (HMODULE)mbi.AllocationBase : NULL);
}

extern "C" __declspec(dllexport) int GetDllPath(){
	ifstream file;
	char curDir[100] = {0};
	GetModuleFileName(GetSelfModuleHandle(),curDir,100);
	cout<<"Dll Path:"<


你可能感兴趣的:(C++在dll中获取自身路径(非exe调用路径))