PDA

View Full Version : Using a Win32 library



luochen601
27th July 2010, 03:49
I am newbie in Qt4. Using mingW complier.

I have an application that is coded in MFC which include <atlbase.h> and <atlsafe.h> head. I would like to rebuild the application in QT4 but unfortunately I can not include these head file successfully. The main usage is CComSafeArray<BSTR> and CComPtr<T>.

I would like to know if it is possible to use them in QT4. If not, let me know. If yes (what I hope for) please provide a simple example or a reference to a site which shows how to do this. Or some replace method for CComSafeArray<BSTR> and CComPtr<T> in Qt?

Many thanks in advance for your advice.

franz
27th July 2010, 06:09
Any static library compiled with MSVC cannot be linked against by gcc. If you are only using the templates from the header, you should be able to get them by telling gcc where to find those templates. You can do so by adding say "c:\program files\microsoft visual studio 9.0\Common\VC\include" to your include path. I cannot guarantee the path is correct, but it is along those lines you have to search.

ChrisW67
28th July 2010, 00:14
These are COM related. Is your application using COM? The obvious porting action would be to involve ActiveQt and let it worry about conversion of Windows COM types to Qt types.

luochen601
28th July 2010, 04:58
These are COM related. Is your application using COM? The obvious porting action would be to involve ActiveQt and let it worry about conversion of Windows COM types to Qt types.

Yes, I use COM in Qt. Because the COM that supplied by 3rd party is large and complicated and the given sample was written in MFC, in order to save time I want to transfer this sample to Qt environment, so I does not use ActiveQt method and cause the problem.