|
Hi,
I want to get a dll's version detail ,which is registered.
And want to get this data programmetically.
I think ,One way we can make our code to search in Registry-entries & get the information from there.
But unfortunately, i'm not fully aware, what will be the code for this.
PLease advice
|
|
|
|
|
Why have you posted this question here? It has nothing to do with C++/CLI, and I have already answered it in this thread[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi Richard,
It's related to C++ ,I thought we can put here
|
|
|
|
|
This forum is for C++/CLI issues.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I don't disagree with your chiding but you answered a different question in that message. He was looking for info on how to get the DLL version info here. The question/answer you refer to in the other thread was how to get the DLL file location...
... both worthy questions but, yeah, should have been asked in a different forum.
--
Harvey
|
|
|
|
|
Since this question is nearly two months old your comments and answer are largely irrelevant.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Perhaps for the original author but not for someone reading the thread who might be looking for the answer to the question.
--
Harvey
|
|
|
|
|
I think you are looking for the DLLVERSIONINFO data. Here is a class that loads a dll and pulls that info from it:
class CLoadLibrary
{
public:
CLoadLibrary(LPCTSTR lpszLibFileName);
virtual ~CLoadLibrary();
operator HINSTANCE();
DWORD GetModuleVersion();
protected:
HINSTANCE m_hLibModule;
};
CLoadLibrary::CLoadLibrary(LPCTSTR lpszLibFileName)
{
m_hLibModule = ::LoadLibrary(lpszLibFileName);
ASSERT(m_hLibModule != NULL);
}
CLoadLibrary::~CLoadLibrary()
{
::FreeLibrary(m_hLibModule);
}
CLoadLibrary::operator HINSTANCE()
{
return m_hLibModule;
}
DWORD CLoadLibrary::GetModuleVersion()
{
typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)(DLLVERSIONINFO*);
DLLGETVERSIONPROC pDllGetVersion =
(DLLGETVERSIONPROC)::GetProcAddress(*this, _T("DllGetVersion"));
DWORD dwVersion = 0L;
if (pDllGetVersion != NULL)
{
DLLVERSIONINFO dvi;
ZeroMemory(&dvi, sizeof(dvi));
dvi.cbSize = sizeof(dvi);
HRESULT hr = (*pDllGetVersion)(&dvi);
if (SUCCEEDED(hr))
{
ASSERT(dvi.dwMajorVersion <= 0xFFFF);
ASSERT(dvi.dwMinorVersion <= 0xFFFF);
dwVersion = MAKELONG(dvi.dwMinorVersion, dvi.dwMajorVersion);
}
}
return dwVersion;
}
Clearly you can simplify it for your needs...
--
Harvey
|
|
|
|