Important: Please read the Qt Code of Conduct -

QT dll and winapi

  • Hi,

    OS: Win 10

    I created dll using QT. In this dll I have 4 functions:

    1. hook(), where I have only one command: SetWindowsHookEx()
    2. unhook(), where I have only one command: UnhookWindowsHookEx()
    3. DllMain(), where I don't have many interesting things, only set variables :)
    4. callback function with hook code

    I created example.exe app, where I get this dll and execute functions hook() and unhook(). My goal is to have global WH_CBT hook. In callback function in dll i have write to file on Desktop text with the name of App, which go to this callback function to check is that hook is really global. When I run my QT apps, which I wrote and run them ( from qt creator or from desktop ) I see that apps are infected by dll. Perfect. But when I run other apps I don't see their names. I tried run for example Oracle Virtual Box. My dll is 64 bits and Oracle VB is 64 bits, so my dll should infected VB too. Why this doesn't work? Maybe because of that dll is created by QT?

  • Banned

    This post is deleted!

  • Lifetime Qt Champion


    Something I do not get, how is that dll supposed to be injected in your other processes ?

  • @SGaist I don't understand you question, so I show you my code :) I ask about that in other forum:

    When the fourth arg in SetWindowsHookEx will be 0, my dll should be ijected to other processes.

  • Lifetime Qt Champion

    Does it work if you do not use any Qt code in your .dll ?

Log in to reply