3 Replies - 1743 Views - Last Post: 19 November 2011 - 05:58 PM Rate Topic: -----

#1 Recoil  Icon User is offline

  • D.I.C Regular

Reputation: 24
  • View blog
  • Posts: 292
  • Joined: 28-June 08

Global keyboard hook mouse issue, program shutdown issue.

Posted 19 November 2011 - 03:51 PM

There are several parts to this issue so I will break it down as best as I can.

Due to my program needing to be able to close another application that it has started I have globally hooked the keyboard to capture the escape key, and unhook when my program shuts down. Once the program is running I can hit escape and it shuts the program down. This works. However, I have also noticed that this causes drag and drop to stop working on my system until I reboot (it isn't until I have hit the escape key)...If I run my program, hook the keyboard, don't use escape to close anything, close my program which unhooks the keyboard, I do not have this issue. I am wondering if anyone who has used global keyboard hooks if they have run into this issue. Note: due to certain features of hooking the keyboard I am not going to post this code, and if it is needed to obtain assistance I will do so in pm's with certain members.

Another issue I am having is when the actual other program is running. Through some intense searches it has become apparent that I am never going to be able to "add owned form" for a completely separate program...kind of like hosting it within my program, which is why I require the global keyboard hooks. Sometimes the other program will error and shutting it down keeps my program in standby...if the escape hook is pressed, there is no program for it to shutdown to move on to bringing my program up out of standby. So when it errors I have to go ahead and hit the escape...other people testing my program (the kids) don't do this, and just shut down the other program, and there is no way to shut my program down when it is in standby except with [ctrl]-[alt]-[del]...

I have tried setting a timer to run that will catch when the other program is running ("If process.HasExited..."), and if it isn't there anymore, bring my program up out of standby...but this isn't working because the timer only runs when my program is in focus. I need like a global timer, but have been unsuccessful in locating anything like I am this. I think I am looking for the wrong thing, and wonder what I should be looking for, or a better approach to solve this issue.

Is This A Good Question/Topic? 0
  • +

Replies To: Global keyboard hook mouse issue, program shutdown issue.

#2 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 583
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Global keyboard hook mouse issue, program shutdown issue.

Posted 19 November 2011 - 04:19 PM

@Recoil, we can't help you until we see the code that you're working on. It kind of helps.
Was This Post Helpful? 0
  • +
  • -

#3 Recoil  Icon User is offline

  • D.I.C Regular

Reputation: 24
  • View blog
  • Posts: 292
  • Joined: 28-June 08

Re: Global keyboard hook mouse issue, program shutdown issue.

Posted 19 November 2011 - 04:47 PM

Quote

I am wondering if anyone who has used global keyboard hooks if they have run into this issue.


Quote

Note: due to certain features of hooking the keyboard I am not going to post this code, and if it is needed to obtain assistance I will do so in pm's with certain members.


Quote

I think I am looking for the wrong thing, and wonder what I should be looking for, or a better approach to solve this issue.


I am not asking for code.

And just about every post concerning global hooking is likely not to get answered as people can use it for malicious reasons, which is why I don't post that particular portion, yet, not asking for code help, just if it has been an issue for anyone else.

Looking for an idea about the second part. What I have tried will not work as my form does not have focus. I can get it to work, perfectly, and don't need any assistance what-so-ever getting it to work, until my form loses focus, which, in itself, is the main problem, and posting code for this entire issue just for someone to tell me "it's not going to work because your form doesn't have focus...", doesn't logically work for me. I am having an issue getting something in my code to run that works perfectly until my form loses focus, which is the problem of not having focus on my form, which doesn't have focus because it's purpose is to not have focus for running another application, at which time the other program may or may not error and shut down, which is where something like a global timer (if it even exists and what I am asking about), or some other idea that I have yet to come across that pertains actually to little-to-no-coding assistance...in a nutshell, if all 21000 lines of my code is absolutely needed just for getting an idea of what I am looking for to solve the issue, I must take back my requests for a point in the right direction...
Was This Post Helpful? 0
  • +
  • -

#4 Recoil  Icon User is offline

  • D.I.C Regular

Reputation: 24
  • View blog
  • Posts: 292
  • Joined: 28-June 08

Re: Global keyboard hook mouse issue, program shutdown issue.

Posted 19 November 2011 - 05:58 PM

I got this...in order for me to catch if the other program has errored in a timer event, the timer will have to run in a windows service...I am probably having a similar issue with hooking the keyboard issue, and the mouse portion not unhooking properly.

Sorry for the inconvenience...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1