Results 1 to 4 of 4

Thread: How to create dllmain?

  1. #1
    Join Date
    Feb 2015
    Posts
    21
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default How to create dllmain?

    When ever I create project using Library->C++ library in qtcreator it gives me a class
    Qt Code:
    1. #ifndef UNTITLED_H
    2. #define UNTITLED_H
    3.  
    4. #include "untitled_global.h"
    5.  
    6. class UNTITLEDSHARED_EXPORT Untitled
    7. {
    8.  
    9. public:
    10. Untitled();
    11. };
    12.  
    13. #endif // UNTITLED_H
    To copy to clipboard, switch view to plain text mode 

    How do I create a project using dllmain?
    Qt Code:
    1. BOOL WINAPI DllMain(HINSTANCE module_handle, DWORD reason_for_call, LPVOID reserved)
    2. {
    3. if (reason_for_call == DLL_PROCESS_ATTACH) // Self-explanatory
    4. {}
    5. return true;
    6. }
    To copy to clipboard, switch view to plain text mode 

    Is there any way to execute dll functions when I attach qt created dll to another process?
    I want to perform same task as DLL_PROCESS_ATTACH does but with the dll created using qt creator.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to create dllmain?

    If you have used the Library, C++ Library then Qt Creator arranges qmake to link a generic DllMain that does Qt library setup on load.

    If you want a completely non-Qt project, as it seems from your other post, then create your basic source file and Makefile and use the Qt Creator wizard to Import Project, Import Other Project.you get complete control of everything in your project.

  3. #3
    Join Date
    Feb 2015
    Posts
    21
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to create dllmain?

    Sorry for being such a noob. But how do I create a makefile?
    Never created a makefile.
    Are there any tool to create makefile? Or sources?

    Btw, Is there any way in qt sdk so that dll auto attaches itself to the process similarly as dllmain?

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to create dllmain?

    A Qt project with TEMPLATE = lib and static not in CONFIG will generate a DLL from your sources and link it to a suitable DllMain() on Windows.

    If you need to extend or modify the DllMain() then you need to build your C project from the ground up, including your own DllMain(). A Makefile is something you write to define the rules for building the project to the make utility (Qmake writes one on your behalf when you are using qmake).

Similar Threads

  1. Replies: 0
    Last Post: 15th October 2013, 09:32
  2. How do I create a DLL for QT
    By zartoch in forum Newbie
    Replies: 2
    Last Post: 8th May 2009, 06:28
  3. Replies: 4
    Last Post: 1st May 2009, 11:00
  4. using QT in DllMain
    By Laser in forum Newbie
    Replies: 2
    Last Post: 21st August 2008, 00:47
  5. how to create pop-ups
    By miguel_mark in forum Newbie
    Replies: 1
    Last Post: 22nd October 2007, 06:16

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.