Results 1 to 6 of 6

Thread: how create CWnd and use it in Qt

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default how create CWnd and use it in Qt

    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.

    Qt Code:
    1. //////////////////////////
    2. //h
    3. #ifndef CRVIEWER1_H
    4. #define CRVIEWER1_H
    5.  
    6. #include "stdafx.h"
    7.  
    8. class CCrviewer1 : public CWnd
    9. {
    10. protected:
    11. DECLARE_DYNCREATE(CCrviewer1)
    12. public:
    13. ............
    14. //
    15.  
    16. };
    17. #endif
    18. ////////////////////////////////////////
    19. //cpp
    20.  
    21. //#include "stdafx.h"
    22. #include "crviewer1.h"
    23.  
    24. /////////////////////////////////////////////////////////////////////////////
    25. // CCrviewer1
    26.  
    27. IMPLEMENT_DYNCREATE(CCrviewer1, CWnd)
    28.  
    29. ///////////////////////////////////////////////////////
    30. //MyCtrl.h
    31. #ifndef MYCTRL_H
    32. #define MYCTRL_H
    33. #import "C:\\Program Files\\Common Files\\Crystal Decisions\\2.0\\bin\\craxddrt9.dll" no_namespace
    34. #include "crviewer1.h"
    35. #include <qwinhost.h>
    36. #include <QtGui>
    37.  
    38. class HostWindow : public QWinHost
    39. {
    40. Q_OBJECT
    41. public:
    42. HostWindow(QWidget *parent = 0, Qt::WFlags f = 0)
    43. : QWinHost(parent, f)
    44. {
    45. setFocusPolicy(Qt::StrongFocus);
    46. }
    47.  
    48. HWND createWindow(HWND parent, HINSTANCE instance)
    49. {
    50. [SIZE="6"] //how can i create CCrviewer1???[/SIZE]
    51. return 0;
    52. }
    53.  
    54. signals:
    55. void message(const QString &msg, int timeout);
    56.  
    57. public slots:
    58. void returnPressed()
    59. {
    60. QMessageBox::information(topLevelWidget(), "Message from Qt", "Return pressed in QLineEdit!");
    61. }
    62. public:
    63. CCrviewer1* m_pCRViewer1;
    64. IApplicationPtr m_Application;
    65. IReportPtr m_Report;
    66.  
    67. protected:
    68.  
    69. };
    70. #endif
    To copy to clipboard, switch view to plain text mode 

    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!
    Last edited by litterflybug; 15th September 2009 at 07:03.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.