Вопрос

Good day,

I have the following issue: I have one exe application that writes text files to the disk, and that exe source is unavailable. Customer has asked that, when users press numpad 5, a new window pops up, and does some operations with some files.

Problem is, numpad 5 + new application popup MUST only work when the application is running and has focus (they use numpad 5 for other operations).

I thought about this

  1. create a dll with a form and buttons that do the required actions
  2. inject the dll in the process

But I'm struggling to understand if there is a way to create a "keypress loop" in the dll.

Please note that I'm a beginner in c++ and forms, but I just need a feasibility check and a direction.

Is it possible to create a window application that waits for a keypress in an injected dll? Is it there any simple example of this? Using google like a madman I was unable to find references to this so I think I have a problem with the proper terms.

My main issue is that the dllmain is obviously a one shot routine, and I don't understand how to create an "event loop".

Thanks for any information provided.

Это было полезно?

Решение

If you have successfully managed to inject your DLL in the traget process, use the _beginthread API in DllMain to start a new thread, and in that thread you can create a Dialog Box and have a message loop in the usal way.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top