litterflybug
15th September 2009, 06:11
Hi: every one
i'm want use crystal report in qt,i find Qt/MFC Migration Framework ,and test example.
i proble is
i have a wrap class from crystal report control,this is deriver from CWnd
how can i complie it with Qt Application.
//////////////////////////
//h
#ifndef CRVIEWER1_H
#define CRVIEWER1_H
#include "stdafx.h"
class CCrviewer1 : public CWnd
{
protected:
DECLARE_DYNCREATE(CCrviewer1)
public:
............
//
};
#endif
////////////////////////////////////////
//cpp
//#include "stdafx.h"
#include "crviewer1.h"
/////////////////////////////////////////////////////////////////////////////
// CCrviewer1
IMPLEMENT_DYNCREATE(CCrviewer1, CWnd)
///////////////////////////////////////////////////////
//MyCtrl.h
#ifndef MYCTRL_H
#define MYCTRL_H
#import "C:\\Program Files\\Common Files\\Crystal Decisions\\2.0\\bin\\craxddrt9.dll" no_namespace
#include "crviewer1.h"
#include <qwinhost.h>
#include <QtGui>
class HostWindow : public QWinHost
{
Q_OBJECT
public:
HostWindow(QWidget *parent = 0, Qt::WFlags f = 0)
: QWinHost(parent, f)
{
setFocusPolicy(Qt::StrongFocus);
}
HWND createWindow(HWND parent, HINSTANCE instance)
{
//how can i create CCrviewer1???
return 0;
}
signals:
void message(const QString &msg, int timeout);
public slots:
void returnPressed()
{
QMessageBox::information(topLevelWidget(), "Message from Qt", "Return pressed in QLineEdit!");
}
public:
CCrviewer1* m_pCRViewer1;
IApplicationPtr m_Application;
IReportPtr m_Report;
protected:
};
#endif
then i compile the application,i get this info
c:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxv_w32.h(16) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
i adjest include head sequece ,the complie is ok ,but i get some warning
1>LINK : warning LNK4098: default libraries “mfc90d.lib†conflicts with other libraries;please use /NODEFAULTLIB:library
1>LINK : warning LNK4098: default libraries “mfc90d.lib†conflicts with other libraries;please use /NODEFAULTLIB:library
this i run the program, but the main entry is to AfxWinMain, is not my Qt Application
main()!!
i want to know how can i use CWnd in Qt
thanks every much!
i'm want use crystal report in qt,i find Qt/MFC Migration Framework ,and test example.
i proble is
i have a wrap class from crystal report control,this is deriver from CWnd
how can i complie it with Qt Application.
//////////////////////////
//h
#ifndef CRVIEWER1_H
#define CRVIEWER1_H
#include "stdafx.h"
class CCrviewer1 : public CWnd
{
protected:
DECLARE_DYNCREATE(CCrviewer1)
public:
............
//
};
#endif
////////////////////////////////////////
//cpp
//#include "stdafx.h"
#include "crviewer1.h"
/////////////////////////////////////////////////////////////////////////////
// CCrviewer1
IMPLEMENT_DYNCREATE(CCrviewer1, CWnd)
///////////////////////////////////////////////////////
//MyCtrl.h
#ifndef MYCTRL_H
#define MYCTRL_H
#import "C:\\Program Files\\Common Files\\Crystal Decisions\\2.0\\bin\\craxddrt9.dll" no_namespace
#include "crviewer1.h"
#include <qwinhost.h>
#include <QtGui>
class HostWindow : public QWinHost
{
Q_OBJECT
public:
HostWindow(QWidget *parent = 0, Qt::WFlags f = 0)
: QWinHost(parent, f)
{
setFocusPolicy(Qt::StrongFocus);
}
HWND createWindow(HWND parent, HINSTANCE instance)
{
//how can i create CCrviewer1???
return 0;
}
signals:
void message(const QString &msg, int timeout);
public slots:
void returnPressed()
{
QMessageBox::information(topLevelWidget(), "Message from Qt", "Return pressed in QLineEdit!");
}
public:
CCrviewer1* m_pCRViewer1;
IApplicationPtr m_Application;
IReportPtr m_Report;
protected:
};
#endif
then i compile the application,i get this info
c:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxv_w32.h(16) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
i adjest include head sequece ,the complie is ok ,but i get some warning
1>LINK : warning LNK4098: default libraries “mfc90d.lib†conflicts with other libraries;please use /NODEFAULTLIB:library
1>LINK : warning LNK4098: default libraries “mfc90d.lib†conflicts with other libraries;please use /NODEFAULTLIB:library
this i run the program, but the main entry is to AfxWinMain, is not my Qt Application
main()!!
i want to know how can i use CWnd in Qt
thanks every much!