I want to call ShowDialog() when a keyboard hook event is triggered but I'm having some difficulties:
- ShowDialog() blocks so I can't call it from the hook triggered event because it will block the OS.
- I can start a new thread and call ShowDialog() from there, but I get some nasty exception. I guess I can't call ShowDialog() in any other thread.
- I can start a timer: in the next 50 milliseconds call ShowDialog() (which is a nasty hack btw and I rather no do this) But then the timer fires in a new thread and I get then I run into the same problem explained in the previous bullet
I'm sure there must be a way.