Results 1 to 8 of 8

Thread: Application Library with Qt

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    Dec 2012
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Application Library with Qt

    dllmain.cpp :
    Qt Code:
    1. #include <Windows.h>
    2. #include <QApplication>
    3. #include "AppThread.h"
    4.  
    5. BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved)
    6. {
    7. if (dwReason == DLL_PROCESS_ATTACH)
    8. {
    9. DisableThreadLibraryCalls(hModule);
    10. AppThread * thread = new AppThread();
    11. thread->start();
    12. }
    13.  
    14. return TRUE;
    15. }
    To copy to clipboard, switch view to plain text mode 

    AppThread.h:

    Qt Code:
    1. #ifndef APPTHREAD_H
    2. #define APPTHREAD_H
    3. #include <QThread>
    4. #include <QApplication>
    5. #include <QMessageBox>
    6. #include "TestUI.h"
    7.  
    8. class AppThread : public QThread
    9. {
    10. int result;
    11. void run()
    12. {
    13. int a = 0;
    14. QApplication myQapp(a, NULL);
    15. TestUI w;
    16. w.show();
    17. result = myQapp.exec();
    18. }
    19. public:
    20. AppThread() {}
    21. };
    22.  
    23. #endif // APPTHREAD_H
    To copy to clipboard, switch view to plain text mode 
    Last edited by Exetra; 24th December 2012 at 18:55.

Similar Threads

  1. 64 bit application for Windows using QT library
    By ilgale in forum Qt Programming
    Replies: 10
    Last Post: 4th June 2016, 16:57
  2. Problem with vlc library on QT application
    By andzoff in forum Qt Programming
    Replies: 0
    Last Post: 5th June 2012, 08:09
  3. Calling a .NET library (.dll) from a Qt application
    By magpielover in forum Qt Programming
    Replies: 0
    Last Post: 11th January 2012, 15:21
  4. Replies: 2
    Last Post: 8th July 2010, 07:10
  5. Replies: 0
    Last Post: 22nd February 2010, 16:36

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.