Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have written a program in c# that just pastes into the clipboard
I have pinned it to the task bar.
When I click on the icon the program which had the focus then loses it.

Is there any way I can stop any arbitrary program from losing the focus when I click on the icon for my program?

What I have tried:

I don't know what to try. So any ideas would be useful.
Posted

1 solution

No, you can't. WHen you click on the task bar, you switch the focus from the current application to the desktop - which then decides it's a task bar icon, and activate sthe application associated with it.
Unfortunately, Windows doesn't maintain any "focus history" so you can;t even find out which application previously had the focus and switch back to it.
The alternative is you set your app up as a "smart key" and get Windows to activate it when a specific combination is pressed.
 
Share this answer
 
Comments
KevinBadger 20-Feb-16 7:20am    
Thanks,
I will look into that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900