INTERACT FORUM

Windows => Third Party Plug-ins, Programs, and Skins => Topic started by: Jeronimo on January 31, 2010, 01:02:41 pm

Title: [Problem] Plugin doesn't reviece windows messages after focus switched
Post by: Jeronimo on January 31, 2010, 01:02:41 pm
Hello everybody.

I'm developing a global hotkey plugin in C#, which works when outside MJ12 (Control in a Form) but has a small problem. Whenever I change the focus in MJ e.g to Playing Now, Audio or somewhere else the plugin is disposed :-( I need the context though, so that the plugin doesn't need to have focus to function.
 How is this accomplished ?

Thank you !
Title: Re: [Problem] Plugin disposed after focus switched
Post by: JimH on February 01, 2010, 07:13:30 am
disposed may not be the right word.
Title: Re: [Problem] Plugin disposed after focus switched
Post by: Jeronimo on February 02, 2010, 02:08:07 am
Yeah you're right it isn't. The control just isn't visible anymore.

Well anyway evertime the control is opened it isn't just made visible. It recreated but that isn't a (big) problem anymore cuz I saved the hotkeys in a file.

 My problem now is the control doesn't recieve any WM_HOTKEY messages anymore. I hope this is not basic knowledge concerning controls but when it isn't visible no WH_*** messages are recieved in the WinProc :-( Is this normal behaviour ?

 If this is normal behaviour is there some kind of design pattern or algorithm that is used ?

Thanx
Title: Re: [Problem] Plugin doesn't reviece windows messages after focus switched
Post by: Messiahs on February 02, 2010, 12:13:35 pm
I think you will need a "global hook".
http://www.codeproject.com/KB/cs/globalhook.aspx
http://www.codeproject.com/KB/system/globalsystemhook.aspx
Title: Re: [Problem] Plugin doesn't reviece windows messages after focus switched
Post by: Jeronimo on February 02, 2010, 12:33:32 pm
I was hoping you wouldn't say that :-( Not that it would be hard to do, but because the WM_HOTKEY message is there for a reason and a global hook would just be a workaround and not an actual solution. :-\

I'm also thinking about creating an invisible form, which would call the usercontrol's function...that'd be a very ugly solution. Aw man :-(

Thanks for hint Messiahs.

Edit: I just noticed I posted in the wrong forum. Mods please move the post if you feel like it.
Edit2: Does anybody know why the control doesn't receive any windows messages when invisible ?