Created
October 29, 2011 09:45
-
-
Save hpcx82/1324285 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Win32DLL.h" | |
#include <iostream> | |
#ifdef UNICODE | |
#define tcout std::wcout | |
#else | |
#define tcout std::cout | |
#endif | |
EXTERN_C IMAGE_DOS_HEADER __ImageBase; | |
tstring WIN32DLL_API GetThisDLLName() | |
{ | |
//// and then, anywhere you need it: | |
TCHAR szDLLPath[_MAX_PATH]; | |
::GetModuleFileName((HINSTANCE)&__ImageBase, szDLLPath, _MAX_PATH); | |
tcout << szDLLPath; | |
return tstring(szDLLPath); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef WIN32DLL_EXPORTS | |
#define WIN32DLL_API __declspec(dllexport) | |
#else | |
#define WIN32DLL_API __declspec(dllimport) | |
#endif | |
#include <string> | |
typedef std::basic_string<TCHAR> tstring; | |
tstring WIN32DLL_API GetThisDLLName(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment