|
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
|
|
|
|
|
Here is the MSDN information for Threadpool of I/O Completion Objects. http://msdn.microsoft.com/en-us/library/windows/desktop/ms682464(v=vs.85).aspx
But I can not use them to create my threadpool and do asyn read and write operation.Is anyone have experience of using these functions?
CancelThreadpoolIo CloseThreadpoolIo StartThreadpoolIo Thread Pools WaitForThreadpoolIoCallbacks
Would you give me a code example for these use?
Thank you!
I/O Completion, Threadpool
|
|
|
|
|
Any C++/CLI Experts wanted to become book author?
Please do contact author@darkcrab.com,
Darkcrab Press new book publishing company offering opportunity for fresh authors. Grab this opportunity and become an author soon. All the best friends.
|
|
|
|
|
Hi All,
Convert 24-bit bmp capture to 8-bit capture in VC++, is it possible?
Possible,
Can any provide the solution.
Thanks,
Lucky.
|
|
|
|
|
lucky_1221 wrote: is it possible?
Yes.
lucky_1221 wrote: Can any provide the solution.
Presumably you want someone to give you the code rather than just wanting to know if anyone could figure it out.
I won't be providing the code.
Presuming that no one else will either then you would need to do the following.
1. Learn basic programming
2. Learn basic IO (presumably you want to do this to files.)
3. Learn what image formats exists, and find the specifications for each. This includes 24 bit and 8 bit.
4. Write code to read a 24 bit image - using 1/3
5. Write code to write a 8 bit image - using 1/3
6. Put 2, 4 and 5 together into a program.
|
|
|
|
|
Hi All,
Currently i am able to capture the 24-bit screens capturerin.
at the same process i am unable to capture the 8-bit screens and 16-bit screens.
Can any one have this solution provide please.
Thanks,
lucky.
|
|
|
|
|
Hi All,
Currently I am using the log4cplus 1.0.2 version in vc++ 6 version, Now i want to use the 1.1.0 version of log4cplus in vs2010 with windows 7.
Can any one provide the steps, what is the correct process.
Tell me please.
Thanks,
Manojkumar.U
|
|
|
|
|
you can get it here[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Any way thanks for your reply.
Now i have the everything in my side. How to merge the latest log4cplus 1.1.0 in my application.
What is the process.
Past my senior employees did this job, i wan not here.
That's why i am stuck using the log4cplus application.
Thanks,
Manojkumar.U
|
|
|
|
|
lucky_1221 wrote: What is the process. I don't know, either you add the source code to your project, or build it as a stand-alone library which you link to your application. I would guess that reading the documentation would be a good starting point.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
HI
I am a newbie to c++/CLI and I am adding code to an existing code.
The code has a thread that has a try {} catch {} (for exceptions)
my problrm is that the thread runs fine then it develops an exception after it calls a couple of routines.
Why does this happen?
How do I know which exception happened?
How to fix it?
Thanks
Emmos2011
|
|
|
|
|
Emmos2011 wrote: How do I know which exception happened? Since you are catching it you just need to display the details there. Or are you falling into the trap of having a null catch block?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Let's say I have this code:
interface class IFoo
{
public:
void foo();
};
ref class FooBase : public IFoo
{
public:
virtual void foo() sealed = IFoo::foo
{
}
};
I need to define a new explicit foo() in a derived class, that overrides the sealed method in the base class. How do I do that? I tried a lot of things and none compiled.
ref class FooDerived : public FooBase
{
public:
virtual void foo()
{
}
};
results in
error C4485: 'FooDerived::foo' : matches base ref class method 'FooBase::foo', but is not marked 'new' or 'override'; 'new' (and 'virtual') is assumed
1> .\Dlg.cpp(22) : see declaration of 'FooBase::foo'
1> Specify 'override' (and 'virtual') to override the ref class virtual method
1> Specify 'new' (and 'virtual') to hide the ref class virtual method with a new virtual method
1> Position for 'new' and 'override' keywords is after method parameter list
but if I add new
ref class FooDerived : public FooBase
{
public:
virtual void foo() new
{
}
};
I get
Dlg.cpp(30) : error C2059: syntax error : 'string'
Dlg.cpp(31) : error C2091: function returns function
also
ref class FooDerived : public FooBase
{
public:
virtual void foo() new = FooBase::foo
{
}
};
results in
1>.\Dlg.cpp(30) : error C2059: syntax error : 'string'
1>.\Dlg.cpp(30) : error C2091: function returns function
1>.\Dlg.cpp(31) : warning C4569: 'FooBase::foo' : no members match the signature of the explicit override
1>.\Dlg.cpp(31) : error C3671: 'FooDerived::foo' : function does not override 'FooBase::foo'
and
ref class FooDerived : public FooBase, public IFoo
{
public:
virtual void foo() new = IFoo::foo
{
}
};
generates
1>.\Dlg.cpp(30) : error C2059: syntax error : 'string'
1>.\Dlg.cpp(30) : error C2091: function returns function
1>.\Dlg.cpp(31) : warning C4569: 'IFoo::foo' : no members match the signature of the explicit override
1>.\Dlg.cpp(31) : error C3671: 'FooDerived::foo' : function does not override 'IFoo::foo'
What I'm trying to do is overriding HwndSource.System.Windows.Interop.IKeyboardInputSink.TabInto[^]
Any help is appreciated.
|
|
|
|
|
You could use Renamed Overriding which will work if you're always called through an interface handle.
interface class IFoo
{
public:
void foo();
};
ref class FooBase : public IFoo
{
public:
virtual void foo() sealed = IFoo::foo
{
Console::WriteLine("FooBase");
}
};
ref class FooDerived : public FooBase
{
public:
virtual void derivedFoo() = IFoo::foo
{
Console::WriteLine("FooDerived");
}
};
int main(array<System::String ^> ^args)
{
FooBase^ fb = gcnew FooBase();
fb->foo();
FooDerived^ fd = gcnew FooDerived();
fd->foo();
IFoo^ iface = dynamic_cast<IFoo^>(fb);
iface->foo();
iface = dynamic_cast<IFoo^>(fd);
iface->foo();
return 0;
}
|
|
|
|
|
Perhaps better. This seems to be what you're after to me.
ref class FooDerived : public FooBase
{
public:
virtual void foo() new = IFoo::foo
{
Console::WriteLine("FooDerived");
}
};
John
|
|
|
|
|
Yes. This seem to be what I was looking for. It's curious that out of all my attempts, this one I missed.
BTW, there is a little error in your sample.
FooDerived^ fd = gcnew FooDerived();
fd->foo();
This obviously prints FooDerived.
And the first example, where you say virtual void foo() = IFoo::foo does not compile.
But thanks again for the help.
|
|
|
|
|
Actually, that's not a error in the output, that's a direct paste from running the code and the output.
There is also no compile error for me (this was directly from running code). Notice the function name in FooDerived; it's "derivedFoo()" not "foo()".
FooDerived can only print "FooDerived" when fd->derivedFoo() is called OR when called via an IFoo^. So, calling fd->foo() does call the base class implementation.
virtual void derivedFoo() = IFoo::foo
|
|
|
|
|
It doesn't work in MFC apps with /clr support.
1>.\mfc_mm_2008.cpp(38) : error C2059: syntax error : 'string'
1>.\mfc_mm_2008.cpp(38) : error C2091: function returns function
1>.\mfc_mm_2008.cpp(39) : warning C4569: 'IFoo::foo' : no members match the signature of the explicit override
1>.\mfc_mm_2008.cpp(39) : error C3671: 'FooDerived::foo' : function does not override 'IFoo::foo'
The reason is MFC is rewriting the new operator with
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
So anyone wanting to do this in MFC, make sure you don't have that replacement of new before your declaration of the new function definition.
|
|
|
|
|
Good tip about the DEBUG_NEW screwing up the new keyword.
I tried the code in my MFC + /clr application but we've had to remove those DEBUG_NEW defines for other reasons so I didn't run into this issue. Good to know!
John
|
|
|
|
|
BTW, my kids have spent many hours playing your 'Alchemy' game so thanks for that
|
|
|
|
|
Hi,
I want to make only one file as /clr supported instead of whole project. But if i do the same i'm getting compilation error as -
Command line error D8016: '/ZI' and '/clr' command-line options are incompatible
My intention is to invoke managed API from unmanaged code.
I googled but not good result i found till now.
So kindly guide me how to avoid above error or any substitute Project-setting i need to do .
If possible please suggest(sample code)if any for my requirement.
Thanks
|
|
|
|
|
There is no sample code for your problem. The message is quite clear you cannot mix managed and unmanaged code in the same project this way. You need to split it into two projects, one which is normal unmanaged C++ and one which is managed and uses the /clr option. Calling Managed Code from Unmanaged Code and vice-versa[^] is a CodeProject article that will help you.
One of these days I'm going to think of a really clever signature.
|
|
|
|